summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakub Kądziołka <kuba@kadziolka.net>2020-03-29 00:38:13 +0100
committerJakub Kądziołka <kuba@kadziolka.net>2020-03-29 00:38:13 +0100
commit44fb8cf84107bf2baa207216fda0ee5476bafb74 (patch)
treeccfe580739e308a604fea9b05943294e2f2e9e69 /tests
parent87bc9f022cdd3487e85cf83cf82222315246abf9 (diff)
parent62b9ad19e3a6638f8e077753454fdf08ba586146 (diff)
Merge branch 'master' into staging
Diffstat (limited to 'tests')
-rw-r--r--tests/cache.scm9
-rw-r--r--tests/guix-package.sh3
-rw-r--r--tests/inferior.scm3
-rw-r--r--tests/store.scm34
-rw-r--r--tests/ui.scm4
5 files changed, 40 insertions, 13 deletions
diff --git a/tests/cache.scm b/tests/cache.scm
index e46cdd816d..80b44d69aa 100644
--- a/tests/cache.scm
+++ b/tests/cache.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -24,13 +24,6 @@
#:use-module ((guix utils) #:select (call-with-temporary-directory))
#:use-module (ice-9 match))
-(cond-expand
- (guile-2.2
- ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and
- ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it.
- (define time-monotonic time-tai))
- (else #t))
-
(test-begin "cache")
(test-equal "remove-expired-cache-entries"
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index f9fb31033e..1f955257be 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -189,8 +189,7 @@ emacs_tarball="$module_dir/emacs-42.5.9rc7.tar.gz"
touch "$emacs_tarball"
guix package -p "$profile" -i emacs --with-source="$emacs_tarball" -n \
2> "$tmpfile"
-grep -E 'emacs[[:blank:]]+42\.5\.9rc7[[:blank:]]+.*-emacs-42.5.9rc7' \
- "$tmpfile"
+grep -E 'emacs[[:blank:]]+42\.5\.9rc7' "$tmpfile"
rm "$emacs_tarball" "$tmpfile"
rmdir "$module_dir"
diff --git a/tests/inferior.scm b/tests/inferior.scm
index b4417d8629..2f5215920b 100644
--- a/tests/inferior.scm
+++ b/tests/inferior.scm
@@ -68,6 +68,9 @@
(guard (c ((inferior-exception? c)
(close-inferior inferior)
(and (eq? inferior (inferior-exception-inferior c))
+ (match (inferior-exception-stack c)
+ (((_ (files lines columns)) ..1)
+ (member "guix/repl.scm" files)))
(inferior-exception-arguments c))))
(inferior-eval '(throw 'a 'b 'c 'd) inferior)
'badness)))
diff --git a/tests/store.scm b/tests/store.scm
index 2b14a4af0a..b61a981b28 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -380,6 +380,38 @@
(equal? (valid-derivers %store o)
(list (derivation-file-name d))))))
+(test-equal "with-build-handler"
+ 'success
+ (let* ((b (add-text-to-store %store "build" "echo $foo > $out" '()))
+ (s (add-to-store %store "bash" #t "sha256"
+ (search-bootstrap-binary "bash"
+ (%current-system))))
+ (d1 (derivation %store "the-thing"
+ s `("-e" ,b)
+ #:env-vars `(("foo" . ,(random-text)))
+ #:sources (list b s)))
+ (d2 (derivation %store "the-thing"
+ s `("-e" ,b)
+ #:env-vars `(("foo" . ,(random-text))
+ ("bar" . "baz"))
+ #:sources (list b s)))
+ (o1 (derivation->output-path d1))
+ (o2 (derivation->output-path d2)))
+ (with-build-handler
+ (let ((counter 0))
+ (lambda (continue store things mode)
+ (match things
+ ((drv)
+ (set! counter (+ 1 counter))
+ (if (string=? drv (derivation-file-name d1))
+ (continue #t)
+ (and (string=? drv (derivation-file-name d2))
+ (= counter 2)
+ 'success))))))
+ (build-derivations %store (list d1))
+ (build-derivations %store (list d2))
+ 'fail)))
+
(test-assert "topologically-sorted, one item"
(let* ((a (add-text-to-store %store "a" "a"))
(b (add-text-to-store %store "b" "b" (list a)))
diff --git a/tests/ui.scm b/tests/ui.scm
index 05eace6721..3dc6952e1f 100644
--- a/tests/ui.scm
+++ b/tests/ui.scm
@@ -252,12 +252,12 @@ Second line" 24))
(let* ((m (manifest (list guile-1.8.8)))
(t (manifest-transaction (install (list guile-2.0.9)))))
(with-store store
- (and (string-match "guile\t1.8.8 → 2.0.9"
+ (and (string-match "guile +1.8.8 → 2.0.9"
(with-fluids ((%default-port-encoding "UTF-8"))
(with-error-to-string
(lambda ()
(show-manifest-transaction store m t)))))
- (string-match "guile\t1.8.8 -> 2.0.9"
+ (string-match "guile +1.8.8 -> 2.0.9"
(with-error-to-string
(lambda ()
;; In Guile 2.2, %DEFAULT-PORT-ENCODING doesn't