From ab517fa1c034851b0c33b366d73e79379e985387 Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Fri, 6 Nov 2020 18:33:43 -0800 Subject: [PATCH 03/29] tests: Ensure tests that require %bootstrap-guile are only run when network is reachable. --- tests/gexp.scm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) Index: guix-debian/tests/gexp.scm =================================================================== --- guix-debian.orig/tests/gexp.scm +++ guix-debian/tests/gexp.scm @@ -306,6 +306,7 @@ (package-derivation %store coreutils))))) (equal? `(begin ,e ,e) (gexp->sexp* exp)))))) +(unless (network-reachable?) (test-skip 1)) (test-assert "two input packages, one derivation, one file" (let* ((drv (build-expression->derivation %store "foo" 'bar @@ -333,6 +334,7 @@ (e3 `(display ,txt))) (equal? `(begin ,e0 ,e1 ,e2 ,e3) (gexp->sexp* exp)))))) +(unless (network-reachable?) (test-skip 1)) (test-assert "file-append" (let* ((drv (package-derivation %store %bootstrap-guile)) (fa (file-append %bootstrap-guile "/bin/guile")) @@ -411,6 +413,7 @@ (return (string=? (derivation-file-name drv) (derivation-file-name result))))) +(unless (network-reachable?) (test-skip 1)) (test-assert "with-parameters + file-append" (let* ((system (match (%current-system) ("aarch64-linux" "x86_64-linux") @@ -497,6 +500,7 @@ (equal? (gexp->sexp* #~(list #$mixed) "powerpc64le-linux-gnu") (gexp->sexp* #~(list #$sed) "powerpc64le-linux-gnu"))))) +(unless (network-reachable?) (test-skip 1)) (test-assert "ungexp + ungexp-native" (let* ((exp (gexp (list (ungexp-native %bootstrap-guile) (ungexp coreutils) @@ -520,6 +524,7 @@ (equal? `(list ,guile ,cu ,libc ,bu) (gexp->sexp* exp target))))) +(unless (network-reachable?) (test-skip 1)) (test-equal "ungexp + ungexp-native, nested" `((,%bootstrap-guile "out" #f) (,coreutils "out" #t)) (let* ((exp (gexp (list (ungexp-native (gexp (ungexp coreutils))) @@ -533,6 +538,7 @@ (exp (gexp (bar (ungexp foo))))) (map gexp-input->tuple (gexp-inputs exp)))) +(unless (network-reachable?) (test-skip 1)) (test-assert "input list" (let ((exp (gexp (display '(ungexp (list %bootstrap-guile coreutils))))) @@ -546,6 +552,7 @@ (equal? `(display '(,guile ,cu)) (gexp->sexp* exp))))) +(unless (network-reachable?) (test-skip 1)) (test-assert "input list + ungexp-native" (let* ((target "mips64el-linux-gnu") (exp (gexp (display @@ -566,6 +573,7 @@ (equal? `(display (cons '(,guile ,cu) '(,xlibc ,xbu))) (gexp->sexp* exp target))))) +(unless (network-reachable?) (test-skip 1)) (test-assert "input list splicing" (let* ((inputs (list (gexp-input glibc "debug") %bootstrap-guile)) (outputs (list (derivation->output-path @@ -580,6 +588,7 @@ (equal? (gexp->sexp* exp) `(list ,@(cons 5 outputs)))))) +(unless (network-reachable?) (test-skip 1)) (test-assert "input list splicing + ungexp-native-splicing" (let* ((inputs (list (gexp-input glibc "debug" #:native? #t) %bootstrap-guile)) @@ -630,6 +639,7 @@ (gexp-outputs exp2)) (= 2 (length (gexp-outputs exp2)))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "gexp->file" (mlet* %store-monad ((exp -> (gexp (display (ungexp %bootstrap-guile)))) (guile (package-file %bootstrap-guile)) @@ -641,6 +651,7 @@ (return (and (equal? sexp (call-with-input-file out read)) (equal? (list guile) refs))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "gexp->file + file-append" (mlet* %store-monad ((exp -> #~#$(file-append %bootstrap-guile "/bin/guile")) @@ -653,6 +664,7 @@ (call-with-input-file out read)) (equal? (list guile) refs))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "gexp->file + #:splice?" (mlet* %store-monad ((exp -> (list #~(define foo 'bar) @@ -671,6 +683,7 @@ (list (read port) (read port) (read port))))) (equal? (list guile) refs))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "gexp->derivation" (mlet* %store-monad ((file (text-file "foo" "Hello, world!")) (exp -> (gexp @@ -703,6 +716,7 @@ (return (equal? '((type . test)) (derivation-properties drv))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "gexp->derivation vs. grafts" (mlet* %store-monad ((graft? (set-grafting #f)) (p0 -> (dummy-package "dummy" @@ -722,6 +736,7 @@ (string=? (derivation->output-path drv0) (derivation->output-path drv1*)))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "gexp->derivation, composed gexps" (mlet* %store-monad ((exp0 -> (gexp (begin (mkdir (ungexp output)) @@ -1040,6 +1055,7 @@ importing.* \\(guix config\\) from the h '() ((@@ (guix gexp) gexp-extensions) #t)) +(unless (network-reachable?) (test-skip 1)) (test-assertm "gexp->derivation & with-extensions" ;; Create a fake Guile extension and make sure it is accessible both to the ;; imported modules and to the derivation build script. @@ -1071,6 +1087,7 @@ importing.* \\(guix config\\) from the h (built-derivations (list drv)) (return (equal? '(42 84) (call-with-input-file out read)))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "lower-gexp" (mlet* %store-monad ((extension -> %extension-package) @@ -1134,6 +1151,7 @@ importing.* \\(guix config\\) from the h (run-with-store %store (lower-gexp #~(#\+))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "gexp->derivation #:references-graphs" (mlet* %store-monad ((one (text-file "one" (random-text))) @@ -1184,6 +1202,7 @@ importing.* \\(guix config\\) from the h (call-with-input-file g-guile read) (list (derivation->output-path guile-drv) bash)))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "gexp->derivation #:references-graphs cross-compilation" ;; The objects passed in #:references-graphs implicitly refer to ;; cross-compiled derivations. Make sure this is the case. @@ -1229,6 +1248,7 @@ importing.* \\(guix config\\) from the h (gexp-input in "ok"))))) (built-derivations (list drv)))) +(unless (network-reachable?) (test-skip 1)) (test-assert "gexp->derivation #:allowed-references, disallowed" (let ((drv (run-with-store %store (gexp->derivation "allowed-refs" @@ -1241,6 +1261,7 @@ importing.* \\(guix config\\) from the h (build-derivations %store (list drv)) #f))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "gexp->derivation #:disallowed-references, allowed" (mlet %store-monad ((drv (gexp->derivation "disallowed-refs" #~(begin @@ -1253,6 +1274,7 @@ importing.* \\(guix config\\) from the h (built-derivations (list drv)))) +(unless (network-reachable?) (test-skip 1)) (test-assert "gexp->derivation #:disallowed-references" (let ((drv (run-with-store %store (gexp->derivation "disallowed-refs" @@ -1273,6 +1295,7 @@ importing.* \\(guix config\\) from the h ;; systems), then skip the following test. (test-skip (if (> (string-length shebang) 127) 2 0)) +(unless (network-reachable?) (test-skip 1)) (test-assertm "gexp->script" (mlet* %store-monad ((n -> (random (expt 2 50))) (exp -> (gexp @@ -1323,6 +1346,7 @@ importing.* \\(guix config\\) from the h (and (string=? str* str) (not (member directory load-path))))))))))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "program-file" (let* ((n (random (expt 2 50))) (exp (with-imported-modules '((guix build utils)) @@ -1340,6 +1364,7 @@ importing.* \\(guix config\\) from the h (return (and (zero? (close-pipe pipe)) (= n (string->number str))))))))) +(unless (network-reachable?) (test-skip 1)) (test-assert "program-file #:module-path" (call-with-temporary-directory (lambda (directory) @@ -1368,6 +1393,7 @@ importing.* \\(guix config\\) from the h (return (and (zero? (close-pipe pipe)) (string=? text str))))))))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "program-file & with-extensions" (let* ((exp (with-extensions (list %extension-package) (gexp (begin @@ -1434,6 +1460,7 @@ importing.* \\(guix config\\) from the h (equal? (readlink out) (derivation-file-name dep)) (equal? refs (list (derivation-file-name dep)))))))))) +(unless (network-reachable?) (test-skip 1)) (test-assert "text-file*" (run-with-store %store (mlet* %store-monad @@ -1457,6 +1484,7 @@ importing.* \\(guix config\\) from the h file))))) #:guile-for-build (package-derivation %store %bootstrap-guile))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "mixed-text-file" (mlet* %store-monad ((file -> (mixed-text-file "mixed" #:guile %bootstrap-guile @@ -1503,6 +1531,7 @@ importing.* \\(guix config\\) from the h (parameterize ((%current-target-system "fooooo")) (derivation? (run-with-store %store mval))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "lower-object" (mlet %store-monad ((drv1 (lower-object %bootstrap-guile)) (drv2 (lower-object (package-source coreutils))) @@ -1510,6 +1539,7 @@ importing.* \\(guix config\\) from the h (return (and (derivation? drv1) (derivation? drv2) (store-path? item))))) +(unless (network-reachable?) (test-skip 1)) (test-assertm "lower-object, computed-file" (let* ((text (plain-file "foo" "Hello!")) (exp #~(begin @@ -1567,6 +1597,7 @@ importing.* \\(guix config\\) from the h get-string-all) (derivation->output-path drv0)))) +(unless (network-reachable?) (test-skip 1)) (test-equal "lower-object, computed-file, #:system" '("mips64el-linux") (run-with-store %store