File: 0002-tests-Only-run-tests-requiring-bootstrap-binaries-wh.patch

package info (click to toggle)
guix 1.4.0-9
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 161,500 kB
  • sloc: lisp: 861,023; cpp: 10,741; javascript: 9,632; sh: 8,913; makefile: 951; ansic: 558; python: 129; sql: 33; sed: 16
file content (278 lines) | stat: -rw-r--r-- 11,475 bytes parent folder | download
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
From 5acb808b9f32e3b5703855d2cd2f5f5608f7c0fe Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Fri, 6 Nov 2020 18:25:03 -0800
Subject: [PATCH 02/29] tests: Only run tests requiring bootstrap binaries when
 network is available.

---
 tests/derivations.scm | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

Index: guix-debian/tests/derivations.scm
===================================================================
--- guix-debian.orig/tests/derivations.scm
+++ guix-debian/tests/derivations.scm
@@ -114,6 +114,7 @@
          (equal? (directory-contents dir)
                  (directory-contents drv)))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation with no inputs"
   (let* ((builder  (add-text-to-store %store "my-builder.sh"
                                       "echo hello, world\n"
@@ -124,6 +125,7 @@
     (and (store-path? (derivation-file-name drv))
          (valid-path? %store (derivation-file-name drv)))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "build derivation with 1 source"
   (let* ((builder (add-text-to-store %store "my-builder.sh"
                                      "echo hello, world > \"$out\"\n"
@@ -142,6 +144,7 @@
                 (string=? (call-with-input-file path read-line)
                           "hello, world"))))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation fails but keep going"
   ;; In keep-going mode, 'build-derivations' should fail because of D1, but it
   ;; must return only after D2 has succeeded.
@@ -169,6 +172,7 @@
         (build-derivations %store (list d1 d2))
         #f))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "identical files are deduplicated"
   ;; Note: DATA must be longer than %DEDUPLICATION-MINIMUM-SIZE.
   (let* ((data    (make-string 9000 #\a))
@@ -276,11 +280,13 @@
                          get-string-all)
                        text))))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-equal "derivation-name"
   "foo-0.0"
   (let ((drv (derivation %store "foo-0.0" %bash '())))
     (derivation-name drv)))
 
+(unless (network-reachable?) (test-skip 1))
 (test-equal "derivation-output-names"
   '(("out") ("bar" "chbouib"))
   (let ((drv1 (derivation %store "foo-0.0" %bash '()))
@@ -289,6 +295,7 @@
     (list (derivation-output-names drv1)
           (derivation-output-names drv2))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "offloadable-derivation?"
   (and (offloadable-derivation? (derivation %store "foo" %bash '()))
        (offloadable-derivation?               ;see <http://bugs.gnu.org/18747>
@@ -298,6 +305,7 @@
              (derivation %store "foo" %bash '()
                          #:local-build? #t)))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "substitutable-derivation?"
   (and (substitutable-derivation? (derivation %store "foo" %bash '()))
        (substitutable-derivation?             ;see <http://bugs.gnu.org/18747>
@@ -307,6 +315,7 @@
              (derivation %store "foo" %bash '()
                          #:substitutable? #f)))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "fixed-output-derivation?"
   (let* ((builder    (add-text-to-store %store "my-fixed-builder.sh"
                                         "echo -n hello > $out" '()))
@@ -317,6 +326,7 @@
                                  #:hash hash #:hash-algo 'sha256)))
     (fixed-output-derivation? drv)))
 
+(unless (network-reachable?) (test-skip 1))
 (test-equal "fixed-output derivation"
   '(sha1 sha256 sha512)
   (map (lambda (hash-algorithm)
@@ -341,6 +351,7 @@
                   hash-algorithm))))
        '(sha1 sha256 sha512)))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "fixed-output derivation: output paths are equal"
   (let* ((builder1   (add-text-to-store %store "fixed-builder1.sh"
                                         "echo -n hello > $out" '()))
@@ -358,6 +369,7 @@
          (equal? (derivation->output-path drv1)
                  (derivation->output-path drv2)))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "fixed-output derivation, recursive"
   (let* ((builder    (add-text-to-store %store "my-fixed-builder.sh"
                                         "echo -n hello > $out" '()))
@@ -375,6 +387,7 @@
                         (call-with-input-file p get-bytevector-all))
                 (bytevector? (query-path-hash %store p)))))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation with a fixed-output input"
   ;; A derivation D using a fixed-output derivation F doesn't has the same
   ;; output path when passed F or F', as long as F and F' have the same output
@@ -411,6 +424,7 @@
          (equal? (derivation->output-path final1)
                  (derivation->output-path final2)))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation with duplicate fixed-output inputs"
   ;; Here we create a derivation that has two inputs, both of which are
   ;; fixed-output leading to the same result.  This test ensures the hash of
@@ -479,6 +493,7 @@
             (lset= string=? (derivation-input-sub-derivations input)
                    '("one" "two")))))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "multiple-output derivation"
   (let* ((builder    (add-text-to-store %store "my-fixed-builder.sh"
                                         "echo one > $out ; echo two > $second"
@@ -500,6 +515,7 @@
                 (eq? 'one (call-with-input-file one read))
                 (eq? 'two (call-with-input-file two read)))))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "multiple-output derivation, non-alphabetic order"
   ;; Here, the outputs are not listed in alphabetic order.  Yet, the store
   ;; path computation must reorder them first.
@@ -517,6 +533,7 @@
            (and (eq? 'one (call-with-input-file one read))
                 (eq? 'two (call-with-input-file two read)))))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "read-derivation vs. derivation"
   ;; Make sure 'derivation' and 'read-derivation' return objects that are
   ;; identical.
@@ -544,6 +561,7 @@
                     read-derivation)))
     (equal? drv* drv)))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "multiple-output derivation, derivation-path->output-path"
   (let* ((builder    (add-text-to-store %store "builder.sh"
                                         "echo one > $out ; echo two > $second"
@@ -561,6 +579,7 @@
          (string=? first one)
          (string=? second two))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "user of multiple-output derivation"
   ;; Check whether specifying several inputs coming from the same
   ;; multiple-output derivation works.
@@ -594,6 +613,7 @@
            (and (valid-path? %store p)
                 (equal? '(one two) (call-with-input-file p read)))))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation with #:references-graphs"
   (let* ((input1  (add-text-to-store %store "foo" "hello"
                                      (list %bash)))
@@ -644,6 +664,7 @@
                                                ((p2 . _)
                                                 (string<? p1 p2)))))))))))))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation #:allowed-references, ok"
   (let ((drv (derivation %store "allowed" %bash
                          '("-c" "echo hello > $out")
@@ -651,6 +672,7 @@
                          #:allowed-references '())))
     (build-derivations %store (list drv))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation #:allowed-references, not allowed"
   (let* ((txt (add-text-to-store %store "foo" "Hello, world."))
          (drv (derivation %store "disallowed" %bash
@@ -663,6 +685,7 @@
       (build-derivations %store (list drv))
       #f)))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation #:allowed-references, self allowed"
   (let ((drv (derivation %store "allowed" %bash
                          '("-c" "echo $out > $out")
@@ -670,6 +693,7 @@
                          #:allowed-references '("out"))))
     (build-derivations %store (list drv))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation #:allowed-references, self not allowed"
   (let ((drv (derivation %store "disallowed" %bash
                          `("-c" ,"echo $out > $out")
@@ -681,6 +705,7 @@
       (build-derivations %store (list drv))
       #f)))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation #:disallowed-references, ok"
   (let ((drv (derivation %store "disallowed" %bash
                          '("-c" "echo hello > $out")
@@ -688,6 +713,7 @@
                          #:disallowed-references '("out"))))
     (build-derivations %store (list drv))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation #:disallowed-references, not ok"
   (let* ((txt (add-text-to-store %store "foo" "Hello, world."))
          (drv (derivation %store "disdisallowed" %bash
@@ -704,6 +730,7 @@
 ;; which is a unique value for each test process; this value is the same as
 ;; the one we see in the process executing this file since it is set by
 ;; 'test-env'.
+(unless (network-reachable?) (test-skip 1))
 (test-equal "derivation #:leaked-env-vars"
   (getenv "GUIX_STATE_DIRECTORY")
   (let* ((value (getenv "GUIX_STATE_DIRECTORY"))
@@ -724,7 +751,7 @@
         (package-derivation %store %bootstrap-coreutils&co))))
 
 (test-skip (if %coreutils 0 1))
-
+(unless (network-reachable?) (test-skip 1))
 (test-assert "build derivation with coreutils"
   (let* ((builder
           (add-text-to-store %store "build-with-coreutils.sh"
@@ -747,7 +774,7 @@
                 (file-exists? (string-append p "/good")))))))
 
 (test-skip (if (%guile-for-build) 0 8))
-
+(unless (network-reachable?) (test-skip 1))
 (test-equal "build-expression->derivation and invalid module name"
   '(file-search-error "guix/module/that/does/not/exist.scm")
   (guard (c ((file-search-error? c)
@@ -1016,6 +1043,7 @@
                                          #:mode (build-mode check))
                   (list drv dep))))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "derivation-input-fold"
   (let* ((builder (add-text-to-store %store "my-builder.sh"
                                      "echo hello, world > \"$out\"\n"
@@ -1228,6 +1256,7 @@
          (let ((out (derivation->output-path drv)))
            (string=? (readlink (string-append out "/symlink")) in)))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-assert "build-expression->derivation with #:references-graphs"
   (let* ((input   (add-text-to-store %store "foo" "hello"
                                      (list %bash %mkdir)))
@@ -1269,6 +1298,7 @@
     (list (derivation-properties drv1)
           (derivation-properties drv2))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-equal "map-derivation"
   "hello"
   (let* ((joke (package-derivation %store guile-1.8))
@@ -1292,6 +1322,7 @@
     (and (build-derivations %store (list (pk 'remapped drv4)))
          (call-with-input-file out get-string-all))))
 
+(unless (network-reachable?) (test-skip 1))
 (test-equal "map-derivation, sources"
   "hello"
   (let* ((script1   (add-text-to-store %store "fail.sh" "exit 1"))