summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2021-12-05 19:17:41 +0100
committerRicardo Wurmus <rekado@elephly.net>2021-12-05 19:17:41 +0100
commit9bc0f45df5d6aed217020b1183dca54989844fb0 (patch)
treed927e89949ff7f65b5059bc94273c53fd43d0763 /tests
parent6db3c536e89deb8a204e756f427614925a7d2582 (diff)
parent10554e0a57feeea470127a1d0441957d1776b0bd (diff)
Merge remote-tracking branch 'origin/master' into core-updates-frozen
Diffstat (limited to 'tests')
-rw-r--r--tests/hackage.scm20
-rw-r--r--tests/store.scm78
2 files changed, 82 insertions, 16 deletions
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 9919d54f47f..189b9af1730 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -171,10 +171,7 @@ library
171 ('source 171 ('source
172 ('origin 172 ('origin
173 ('method 'url-fetch) 173 ('method 'url-fetch)
174 ('uri ('string-append 174 ('uri ('hackage-uri "foo" 'version))
175 "https://hackage.haskell.org/package/foo/foo-"
176 'version
177 ".tar.gz"))
178 ('sha256 175 ('sha256
179 ('base32 176 ('base32
180 (? string? hash))))) 177 (? string? hash)))))
@@ -214,10 +211,7 @@ library
214 ('source 211 ('source
215 ('origin 212 ('origin
216 ('method 'url-fetch) 213 ('method 'url-fetch)
217 ('uri ('string-append 214 ('uri ('hackage-uri "foo" 'version))
218 "https://hackage.haskell.org/package/foo/foo-"
219 'version
220 ".tar.gz"))
221 ('sha256 215 ('sha256
222 ('base32 216 ('base32
223 (? string? hash))))) 217 (? string? hash)))))
@@ -337,10 +331,7 @@ executable cabal
337 ('source 331 ('source
338 ('origin 332 ('origin
339 ('method 'url-fetch) 333 ('method 'url-fetch)
340 ('uri ('string-append 334 ('uri ('hackage-uri "foo" 'version))
341 "https://hackage.haskell.org/package/foo/foo-"
342 'version
343 ".tar.gz"))
344 ('sha256 335 ('sha256
345 ('base32 336 ('base32
346 (? string? hash))))) 337 (? string? hash)))))
@@ -401,10 +392,7 @@ executable cabal
401 ('source 392 ('source
402 ('origin 393 ('origin
403 ('method 'url-fetch) 394 ('method 'url-fetch)
404 ('uri ('string-append 395 ('uri ('hackage-uri "foo" 'version))
405 "https://hackage.haskell.org/package/foo/foo-"
406 'version
407 ".tar.gz"))
408 ('sha256 396 ('sha256
409 ('base32 397 ('base32
410 (? string? hash))))) 398 (? string? hash)))))
diff --git a/tests/store.scm b/tests/store.scm
index d5edd110ddf..5df28adf0d2 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -943,6 +943,84 @@
943 (build-derivations s (list d)) 943 (build-derivations s (list d))
944 #f)))))) 944 #f))))))
945 945
946(test-equal "substitute query and large size"
947 (+ 100 (expt 2 63)) ;<https://issues.guix.gnu.org/51983>
948 (with-store s
949 (let* ((size (+ 100 (expt 2 63))) ;does not fit in signed 'long long'
950 (item (string-append (%store-prefix)
951 "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bad-size")))
952 ;; Create fake substituter data, to be read by 'guix substitute'.
953 (call-with-output-file (string-append (%substitute-directory)
954 "/" (store-path-hash-part item)
955 ".narinfo")
956 (lambda (port)
957 (format port "StorePath: ~a
958URL: http://example.org
959Compression: none
960NarSize: ~a
961NarHash: sha256:0fj9vhblff2997pi7qjj7lhmy7wzhnjwmkm2hmq6gr4fzmg10s0w
962References:
963System: x86_64-linux~%"
964 item size)))
965
966 ;; Remove entry from the local cache.
967 (false-if-exception
968 (delete-file-recursively (string-append (getenv "XDG_CACHE_HOME")
969 "/guix/substitute")))
970
971 ;; Make sure 'guix substitute' correctly communicates the above
972 ;; data.
973 (set-build-options s #:use-substitutes? #t
974 #:substitute-urls (%test-substitute-urls))
975 (match (pk 'spi (substitutable-path-info s (list item)))
976 (((? substitutable? s))
977 (and (equal? (substitutable-path s) item)
978 (substitutable-nar-size s)))))))
979
980(test-equal "substitute and large size"
981 (+ 100 (expt 2 31)) ;<https://issues.guix.gnu.org/46212>
982 (with-store s
983 (let* ((size (+ 100 (expt 2 31))) ;does not fit in signed 'int'
984 (item (string-append (%store-prefix)
985 "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bad-size-"
986 (random-text)))
987 (nar (string-append (%substitute-directory) "/nar")))
988 ;; Create a dummy nar to allow for substitution.
989 (call-with-output-file nar
990 (lambda (port)
991 (write-file-tree (store-path-package-name item) port
992 #:file-type+size (lambda _
993 (values 'regular 12))
994 #:file-port (lambda _
995 (open-input-string "Hello world.")))))
996
997 ;; Create fake substituter data, to be read by 'guix substitute'.
998 (call-with-output-file (string-append (%substitute-directory)
999 "/" (store-path-hash-part item)
1000 ".narinfo")
1001 (lambda (port)
1002 (format port "StorePath: ~a
1003URL: file://~a
1004Compression: none
1005NarSize: ~a
1006NarHash: sha256:~a
1007References:
1008System: x86_64-linux~%"
1009 item nar size
1010 (bytevector->nix-base32-string (gcrypt:file-sha256 nar)))))
1011
1012 ;; Remove entry from the local cache.
1013 (false-if-exception
1014 (delete-file-recursively (string-append (getenv "XDG_CACHE_HOME")
1015 "/guix/substitute")))
1016
1017 ;; Make sure 'guix substitute' correctly communicates the above
1018 ;; data.
1019 (set-build-options s #:use-substitutes? #t
1020 #:substitute-urls (%test-substitute-urls))
1021 (ensure-path s item)
1022 (path-info-nar-size (query-path-info s item)))))
1023
946(test-assert "export/import several paths" 1024(test-assert "export/import several paths"
947 (let* ((texts (unfold (cut >= <> 10) 1025 (let* ((texts (unfold (cut >= <> 10)
948 (lambda _ (random-text)) 1026 (lambda _ (random-text))