aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-11-14 21:20:46 +0100
committerMarius Bakke <mbakke@fastmail.com>2018-11-14 21:20:46 +0100
commit79ee97a144aaaa890be0724aaf796e2a771179d7 (patch)
treefddd2f20003d60e42eed7a614acea91a13d854d7 /tests
parent7d9d521fbcf1423f66d6f33208c03d5dacb7ba50 (diff)
parente921993c25626541385f191f0463cad8e5e5c5c7 (diff)
downloadpatches-79ee97a144aaaa890be0724aaf796e2a771179d7.tar
patches-79ee97a144aaaa890be0724aaf796e2a771179d7.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'tests')
-rw-r--r--tests/challenge.scm8
-rw-r--r--tests/debug-link.scm8
-rw-r--r--tests/gexp.scm5
-rw-r--r--tests/guix-package.sh4
-rw-r--r--tests/nar.scm47
-rw-r--r--tests/profiles.scm11
-rw-r--r--tests/size.scm8
7 files changed, 43 insertions, 48 deletions
diff --git a/tests/challenge.scm b/tests/challenge.scm
index 4b13ec278e..c962800f3f 100644
--- a/tests/challenge.scm
+++ b/tests/challenge.scm
@@ -31,17 +31,9 @@
#:use-module (rnrs bytevectors)
#:use-module (ice-9 match))
-(define %store
- (open-connection-for-tests))
-
(define query-path-hash*
(store-lift query-path-hash))
-(define-syntax-rule (test-assertm name exp)
- (test-assert name
- (run-with-store %store exp
- #:guile-for-build (%guile-for-build))))
-
(define* (call-with-derivation-narinfo* drv thunk hash)
(lambda (store)
(with-derivation-narinfo drv (sha256 => hash)
diff --git a/tests/debug-link.scm b/tests/debug-link.scm
index 2dde3cb460..a1ae4f141c 100644
--- a/tests/debug-link.scm
+++ b/tests/debug-link.scm
@@ -43,14 +43,6 @@
(define read-elf
(compose parse-elf get-bytevector-all))
-(define %store
- (open-connection-for-tests))
-
-(define-syntax-rule (test-assertm name exp)
- (test-assert name
- (run-with-store %store exp
- #:guile-for-build (%guile-for-build))))
-
(test-begin "debug-link")
diff --git a/tests/gexp.scm b/tests/gexp.scm
index d5bc5dbc71..ff68d26ba9 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -62,11 +62,6 @@
#:target target)
#:guile-for-build (%guile-for-build)))
-(define-syntax-rule (test-assertm name exp)
- (test-assert name
- (run-with-store %store exp
- #:guile-for-build (%guile-for-build))))
-
(define %extension-package
;; Example of a package to use when testing 'with-extensions'.
(dummy-package "extension"
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index f7dfbfad00..7eeb4304d1 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -106,6 +106,10 @@ guix package --show=guile | grep "^name: guile"
# Ensure `--show' doesn't fail for packages with non-package inputs.
guix package --show=texlive
+# Fail for non-existent packages or package/version pairs.
+if guix package --show=does-not-exist; then false; else true; fi
+if guix package --show=emacs@42; then false; else true; fi
+
# Search.
LC_MESSAGES=C
export LC_MESSAGES
diff --git a/tests/nar.scm b/tests/nar.scm
index d610ea53f7..5ffe68c9e2 100644
--- a/tests/nar.scm
+++ b/tests/nar.scm
@@ -25,6 +25,8 @@
#:select (open-sha256-port open-sha256-input-port))
#:use-module ((guix packages)
#:select (base32))
+ #:use-module ((guix build utils)
+ #:select (find-files))
#:use-module (rnrs bytevectors)
#:use-module (rnrs io ports)
#:use-module (srfi srfi-1)
@@ -332,13 +334,6 @@
(lambda ()
(rmdir input)))))
-;; 'restore-file-set' depends on 'open-sha256-input-port', which in turn
-;; relies on a Guile 2.0.10+ feature.
-(test-skip (if (false-if-exception
- (open-sha256-input-port (%make-void-port "r")))
- 0
- 3))
-
(test-assert "restore-file-set (signed, valid)"
(with-store store
(let* ((texts (unfold (cut >= <> 10)
@@ -361,7 +356,43 @@
(map (lambda (file)
(call-with-input-file file
get-string-all))
- files))))))))
+ files))
+ (every canonical-file? files)))))))
+
+(test-assert "restore-file-set with directories (signed, valid)"
+ ;; <https://bugs.gnu.org/33361> describes a bug whereby directories
+ ;; containing files subject to deduplication were not canonicalized--i.e.,
+ ;; their mtime and permissions were not reset. Ensure that this bug is
+ ;; gone.
+ (with-store store
+ (let* ((text1 (random-text))
+ (text2 (random-text))
+ (tree `("tree" directory
+ ("a" regular (data ,text1))
+ ("b" directory
+ ("c" regular (data ,text2))
+ ("d" regular (data ,text1))))) ;duplicate
+ (file (add-file-tree-to-store store tree))
+ (dump (call-with-bytevector-output-port
+ (cute export-paths store (list file) <>))))
+ (delete-paths store (list file))
+ (and (not (file-exists? file))
+ (let* ((source (open-bytevector-input-port dump))
+ (imported (restore-file-set source)))
+ (and (equal? imported (list file))
+ (file-exists? file)
+ (valid-path? store file)
+ (string=? text1
+ (call-with-input-file (string-append file "/a")
+ get-string-all))
+ (string=? text2
+ (call-with-input-file
+ (string-append file "/b/c")
+ get-string-all))
+ (= (stat:ino (stat (string-append file "/a"))) ;deduplication
+ (stat:ino (stat (string-append file "/b/d"))))
+ (every canonical-file?
+ (find-files file #:directories? #t))))))))
(test-assert "restore-file-set (missing signature)"
(let/ec return
diff --git a/tests/profiles.scm b/tests/profiles.scm
index 9f366a04ef..1f9bbd099d 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -47,17 +47,6 @@
;; Globally disable grafts because they can trigger early builds.
(%graft? #f)
-(define-syntax-rule (test-assertm name exp)
- (test-assert name
- (run-with-store %store exp
- #:guile-for-build (%guile-for-build))))
-
-(define-syntax-rule (test-equalm name value exp)
- (test-equal name
- value
- (run-with-store %store exp
- #:guile-for-build (%guile-for-build))))
-
;; Example manifest entries.
(define guile-1.8.8
diff --git a/tests/size.scm b/tests/size.scm
index 575b1abfdd..0aaa8fbc29 100644
--- a/tests/size.scm
+++ b/tests/size.scm
@@ -30,14 +30,6 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-64))
-(define %store
- (open-connection-for-tests))
-
-(define-syntax-rule (test-assertm name exp)
- (test-assert name
- (run-with-store %store exp
- #:guile-for-build (%guile-for-build))))
-
(test-begin "size")