diff options
author | Marius Bakke <[email protected]> | 2022-12-28 01:02:47 +0100 |
---|---|---|
committer | Marius Bakke <[email protected]> | 2022-12-28 01:02:47 +0100 |
commit | ec0fbb471dfc6f72796da9ebafbb0630daa91267 (patch) | |
tree | 3b42f3d0a6470d85fbb8421179634bb278883e4e /tests | |
parent | f5ef7d34e4deecb80aff585c108b0a2ab1f33ce4 (diff) | |
parent | 0cb8f7125b19264b01962c1249c3df4c5ce85aa9 (diff) |
Merge branch 'master' into staging
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cpio.scm | 12 | ||||
-rw-r--r-- | tests/guix-package.sh | 4 | ||||
-rw-r--r-- | tests/import-github.scm | 2 | ||||
-rw-r--r-- | tests/packages.scm | 4 | ||||
-rw-r--r-- | tests/pki.scm | 6 | ||||
-rw-r--r-- | tests/records.scm | 4 | ||||
-rw-r--r-- | tests/store-deduplication.scm | 17 | ||||
-rw-r--r-- | tests/transformations.scm | 8 | ||||
-rw-r--r-- | tests/ui.scm | 11 |
9 files changed, 53 insertions, 15 deletions
diff --git a/tests/cpio.scm b/tests/cpio.scm index 516de0655b..832101d1bb 100644 --- a/tests/cpio.scm +++ b/tests/cpio.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015 Ludovic Courtès <[email protected]> +;;; Copyright © 2015, 2022 Ludovic Courtès <[email protected]> ;;; ;;; This file is part of GNU Guix. ;;; @@ -31,12 +31,18 @@ (define %cpio-program (which "cpio")) +(define %test-file + (search-path %load-path "guix.scm")) + (test-begin "cpio") +;; The cpio format expects 'ino' to fit in 32 bits. If we have a bigger inode +;; number, skip this test. +(test-skip + (if (>= (stat:ino (lstat %test-file)) (expt 2 32)) 1 0)) (test-assert "file->cpio-header + write-cpio-header + read-cpio-header" - (let* ((file (search-path %load-path "guix.scm")) - (header (file->cpio-header file))) + (let* ((header (file->cpio-header %test-file))) (call-with-values (lambda () (open-bytevector-output-port)) diff --git a/tests/guix-package.sh b/tests/guix-package.sh index dedba2fd74..cc416ec6a1 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -149,11 +149,11 @@ cat > "$module_dir/foo.scm"<<EOF #:use-module (gnu packages base)) (define-public deprecated - (deprecated-package "fileutils" coreutils)) + (deprecated-package "fileutils-is-the-old-name" coreutils)) EOF guix build -L "$module_dir" -e '(@ (foo) deprecated)' -n -test "`guix package -L "$module_dir" -s ^fileutils$ | grep ^name:`" = "" +test "`guix package -L "$module_dir" -s ^fileutils-is-the-old-name$ | grep ^name:`" = "" rm -rf "$module_dir" diff --git a/tests/import-github.scm b/tests/import-github.scm index 4d3f8cfc7e..5100296540 100644 --- a/tests/import-github.scm +++ b/tests/import-github.scm @@ -92,7 +92,7 @@ (define* (found-sexp old-version old-commit tags releases) (and=> (call-with-releases (lambda () - ((upstream-updater-latest %github-updater) + ((upstream-updater-import %github-updater) (example-package old-version old-commit))) tags releases) upstream-source->sexp)) diff --git a/tests/packages.scm b/tests/packages.scm index a5819d8de3..f58c47817b 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -626,6 +626,10 @@ (build-derivations %store (list drv)) (call-with-input-file output get-string-all))) +(test-equal "package-upstream-name*" + (package-upstream-name* (specification->package "guile-gcrypt")) + "gcrypt") + ;;; ;;; Source derivation with snippets. diff --git a/tests/pki.scm b/tests/pki.scm index d6a6b476c7..86daff8ddf 100644 --- a/tests/pki.scm +++ b/tests/pki.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014 Ludovic Courtès <[email protected]> +;;; Copyright © 2013, 2014, 2022 Ludovic Courtès <[email protected]> ;;; ;;; This file is part of GNU Guix. ;;; @@ -66,6 +66,10 @@ (test-assert "authorized-key? public-key singleton" (authorized-key? %public-key (public-keys->acl (list %public-key)))) +(test-equal "public-keys->acl deduplication" + (public-keys->acl (list %public-key)) + (public-keys->acl (make-list 10 %public-key))) + (test-assert "signature-case valid-signature" (let* ((hash (sha256 #vu8(1 2 3))) (data (bytevector->hash-data hash #:key-type (key-type %public-key))) diff --git a/tests/records.scm b/tests/records.scm index 8504c8d5a5..b1203dfeb7 100644 --- a/tests/records.scm +++ b/tests/records.scm @@ -540,8 +540,8 @@ Description: 1st line, (first second) (list first second)) (match-record (foo (first 'a) (second 'b)) <foo> - (second first) - (list first second))))) + (second (first first/new-var)) + (list first/new-var second))))) (test-equal "match-record, unknown field" 'syntax-error diff --git a/tests/store-deduplication.scm b/tests/store-deduplication.scm index 2950fbc1a3..f1845035d8 100644 --- a/tests/store-deduplication.scm +++ b/tests/store-deduplication.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018, 2020-2021 Ludovic Courtès <[email protected]> +;;; Copyright © 2018, 2020-2022 Ludovic Courtès <[email protected]> ;;; ;;; This file is part of GNU Guix. ;;; @@ -136,6 +136,21 @@ (cons (apply = (map (compose stat:ino stat) identical)) (map (compose stat:nlink stat) identical)))))) +(test-assert "copy-file/deduplicate, below %deduplication-minimum-size" + (call-with-temporary-directory + (lambda (store) + (let ((source (string-append store "/input"))) + (call-with-output-file source + (lambda (port) + (display "Hello!\n" port))) + (copy-file/deduplicate source + (string-append store "/a") + #:store store) + (and (not (directory-exists? (string-append store "/.links"))) + (file=? source (string-append store "/a")) + (not (= (stat:ino (stat (string-append store "/a"))) + (stat:ino (stat source))))))))) + (test-assert "copy-file/deduplicate" (call-with-temporary-directory (lambda (store) diff --git a/tests/transformations.scm b/tests/transformations.scm index 47b1fc650d..5c136e1d48 100644 --- a/tests/transformations.scm +++ b/tests/transformations.scm @@ -488,10 +488,10 @@ (name 'dummy) (pred (const #t)) (description "") - (latest (const (upstream-source - (package "foo") - (version "42.0") - (urls '("http://example.org"))))))))) + (import (const (upstream-source + (package "foo") + (version "42.0") + (urls '("http://example.org"))))))))) (let* ((p (dummy-package "foo" (version "1.0"))) (t (options->transformation `((with-latest . "foo"))))) diff --git a/tests/ui.scm b/tests/ui.scm index 6a25a204ca..438acae525 100644 --- a/tests/ui.scm +++ b/tests/ui.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Courtès <[email protected]> +;;; Copyright © 2013-2017, 2019-2020, 2022 Ludovic Courtès <[email protected]> ;;; Copyright © 2022 Taiju HIGASHI <[email protected]> ;;; ;;; This file is part of GNU Guix. @@ -294,6 +294,15 @@ Second line" 24)) (>0 (package-relevance libb2 (map rx '("crypto" "library"))))))) +(test-assert "package-relevance and upstream name" + ;; https://issues.guix.gnu.org/58136 + (let ((ggplot2 (specification->package "r-ggplot2")) + (ggstance (specification->package "r-ggstance")) + (rx (make-regexp "ggplot2" regexp/icase))) + (> (package-relevance ggplot2 (list rx)) + (package-relevance ggstance (list rx)) + 0))) + (define (make-empty-file directory file) ;; Create FILE in DIRECTORY. (close-port (open-output-file (in-vicinity directory file)))) |