summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2026-01-15 18:19:40 +0000
committerChristopher Baines <mail@cbaines.net>2026-01-28 17:45:33 +0000
commit1c230ec96e29e3f70ddf217e93c448f6f037a470 (patch)
tree11ec1ec3b7d537aac0e39968aba3d11c54d25ce5 /tests
parent86d06b4cad578bf4191bdac8544ffdd0fa35b5cf (diff)
scripts: substitute: Default to fast decompression.
This changes the behaviour for the first one or few nars the substitute script downloads, with uncompressed and zstd compressed nars prefered rather than picking by file size. * guix/scripts/substitute.scm: (%default-fast-decompression?): Change to #t. * tests/substitute.scm ("substitute, preferred nar URL is 404, other is 200"): Adjust test. Change-Id: I89202f084cd6b9d506bcb3d46f75de690c6986b5
Diffstat (limited to 'tests')
-rw-r--r--tests/substitute.scm22
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/substitute.scm b/tests/substitute.scm
index 33a6d6040ae..cd75d56b981 100644
--- a/tests/substitute.scm
+++ b/tests/substitute.scm
@@ -618,16 +618,30 @@ System: mips64el-linux\n")))
618 (with-narinfo* (string-append %narinfo "Signature: " (signature-field %narinfo)) 618 (with-narinfo* (string-append %narinfo "Signature: " (signature-field %narinfo))
619 %main-substitute-directory 619 %main-substitute-directory
620 620
621 (define (compress input output compression)
622 (call-with-output-file output
623 (lambda (port)
624 (call-with-compressed-output-port compression port
625 (lambda (port)
626 (call-with-input-file input
627 (lambda (input)
628 (dump-port input port))))))))
629
630 ;; This test is dependent on which nar the substitute script picks to
631 ;; request first
621 (with-http-server `((200 ,(string-append %narinfo "Signature: " 632 (with-http-server `((200 ,(string-append %narinfo "Signature: "
622 (signature-field %narinfo) 633 (signature-field %narinfo)
623 "\n" 634 "\n"
624 "URL: example.nar.lz\n" 635 "URL: example.nar.lz\n"
625 "Compression: lzip\n")) 636 "Compression: lzip\n"))
626 (404 "Sorry, nar.lz is missing!") 637 (404 "Sorry, nar.lz is missing!")
627 (200 ,(call-with-input-file 638 (200 ,(let ((nar (string-append
628 (string-append %main-substitute-directory 639 %main-substitute-directory
629 "/example.nar") 640 "/example.nar")))
630 get-bytevector-all))) 641 (compress nar (string-append nar ".lz") 'lzip)
642 (call-with-input-file
643 (string-append nar ".lz")
644 get-bytevector-all))))
631 (dynamic-wind 645 (dynamic-wind
632 (const #t) 646 (const #t)
633 (lambda () 647 (lambda ()