diff options
| author | Ricardo Wurmus <rekado@elephly.net> | 2021-12-05 19:17:41 +0100 |
|---|---|---|
| committer | Ricardo Wurmus <rekado@elephly.net> | 2021-12-05 19:17:41 +0100 |
| commit | 9bc0f45df5d6aed217020b1183dca54989844fb0 (patch) | |
| tree | d927e89949ff7f65b5059bc94273c53fd43d0763 /tests/store.scm | |
| parent | 6db3c536e89deb8a204e756f427614925a7d2582 (diff) | |
| parent | 10554e0a57feeea470127a1d0441957d1776b0bd (diff) | |
Merge remote-tracking branch 'origin/master' into core-updates-frozen
Diffstat (limited to 'tests/store.scm')
| -rw-r--r-- | tests/store.scm | 78 |
1 files changed, 78 insertions, 0 deletions
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 | ||
| 958 | URL: http://example.org | ||
| 959 | Compression: none | ||
| 960 | NarSize: ~a | ||
| 961 | NarHash: sha256:0fj9vhblff2997pi7qjj7lhmy7wzhnjwmkm2hmq6gr4fzmg10s0w | ||
| 962 | References: | ||
| 963 | System: 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 | ||
| 1003 | URL: file://~a | ||
| 1004 | Compression: none | ||
| 1005 | NarSize: ~a | ||
| 1006 | NarHash: sha256:~a | ||
| 1007 | References: | ||
| 1008 | System: 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)) |
