1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
|
From ab517fa1c034851b0c33b366d73e79379e985387 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
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
|