aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-11-19 15:01:00 +0100
committerMarius Bakke <mbakke@fastmail.com>2017-11-19 15:01:00 +0100
commit2dd12924cf4a30a96262b6d392fcde58c9f10d4b (patch)
tree3f74f5426ff214a02b8f6652f6516979657a7f98 /tests
parent259b4f34ba2eaefeafdb7c9f9eb56ee77f16010c (diff)
parenta93447b89a5b132221072e729d13a3f17391b8c2 (diff)
downloadgnu-guix-2dd12924cf4a30a96262b6d392fcde58c9f10d4b.tar
gnu-guix-2dd12924cf4a30a96262b6d392fcde58c9f10d4b.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-build.sh2
-rw-r--r--tests/guix-gc.sh10
-rw-r--r--tests/guix-package.sh2
-rw-r--r--tests/guix-system.sh32
-rw-r--r--tests/services.scm10
-rw-r--r--tests/workers.scm26
6 files changed, 76 insertions, 6 deletions
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 880a582777..004a40dee2 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -184,7 +184,7 @@ test "`guix build superseded -d`" = "`guix build bar -d`"
# Parsing package names and versions.
guix build -n time # PASS
-guix build -n time@1.7 # PASS, version found
+guix build -n time@1.8 # PASS, version found
if guix build -n time@3.2; # FAIL, version not found
then false; else true; fi
if guix build -n something-that-will-never-exist; # FAIL
diff --git a/tests/guix-gc.sh b/tests/guix-gc.sh
index a100f186f5..57c5e7dd61 100644
--- a/tests/guix-gc.sh
+++ b/tests/guix-gc.sh
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2013, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
@@ -25,6 +25,14 @@ guix gc --version
trap "rm -f guix-gc-root" EXIT
rm -f guix-gc-root
+# Below we are using 'drv' and 'out' to contain store file names. If 'drv'
+# and 'out' are environment variables, 'list-runtime-roots' will "see" them
+# and thus prevent $drv and $out from being garbage-collected. Using 'unset'
+# allows us to make sure these are truly local shell variables and not
+# environments variables.
+unset drv
+unset out
+
# For some operations, passing extra arguments is an error.
for option in "" "-C 500M" "--verify" "--optimize"
do
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 99952f130c..ffc8c64e24 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -337,6 +337,6 @@ if guix package --bootstrap -n -m "$module_dir/manifest.scm" \
then false
else
cat "$module_dir/stderr"
- grep "manifest.scm:[1-3]:.*[Uu]nbound variable.*wonderful-package" \
+ grep "manifest.scm:[1-3]:.*wonderful-package.*: unbound variable" \
"$module_dir/stderr"
fi
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index 31ee637133..4bb866adfa 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -68,6 +68,34 @@ else
fi
+# Reporting of module not found errors.
+
+cat > "$tmpfile" <<EOF
+;; Line 1.
+(use-modules (gnu))
+ (use-service-modules openssh)
+EOF
+
+if guix system build "$tmpfile" -n 2> "$errorfile"
+then false
+else
+ grep "$tmpfile:3:2: .*module .*openssh.*not found" "$errorfile"
+ grep "Try.*use-service-modules ssh" "$errorfile"
+fi
+
+cat > "$tmpfile" <<EOF
+;; Line 1.
+(use-modules (gnu))
+ (use-package-modules qemu)
+EOF
+
+if guix system build "$tmpfile" -n 2> "$errorfile"
+then false
+else
+ grep "$tmpfile:3:2: .*module .*qemu.*not found" "$errorfile"
+ grep "Try.*use-package-modules virtualization" "$errorfile"
+fi
+
# Reporting of unbound variables.
cat > "$tmpfile" <<EOF
@@ -95,9 +123,9 @@ else
then
# FIXME: With Guile 2.2.0 the error is reported on line 4.
# See <http://bugs.gnu.org/26107>.
- grep "$tmpfile:[49]:.*[Uu]nbound variable.*GRUB-config" "$errorfile"
+ grep "$tmpfile:[49]:[0-9]: GRUB-config.*[Uu]nbound variable" "$errorfile"
else
- grep "$tmpfile:9:.*[Uu]nbound variable.*GRUB-config" "$errorfile"
+ grep "$tmpfile:9:[0-9]: GRUB-config.*[Uu]nbound variable" "$errorfile"
fi
fi
diff --git a/tests/services.scm b/tests/services.scm
index 8484ee982a..ca32b565c4 100644
--- a/tests/services.scm
+++ b/tests/services.scm
@@ -23,7 +23,8 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
- #:use-module (srfi srfi-64))
+ #:use-module (srfi srfi-64)
+ #:use-module (ice-9 match))
(define live-service
(@@ (gnu services herd) live-service))
@@ -206,4 +207,11 @@
(list (map live-service-provision unload)
(map shepherd-service-provision load)))))
+(test-eq "lookup-service-types"
+ system-service-type
+ (and (null? (lookup-service-types 'does-not-exist-at-all))
+ (match (lookup-service-types 'system)
+ ((one) one)
+ (x x))))
+
(test-end)
diff --git a/tests/workers.scm b/tests/workers.scm
index 44b882f691..4eaefbb43d 100644
--- a/tests/workers.scm
+++ b/tests/workers.scm
@@ -42,4 +42,30 @@
(poll)))
result))
+;; Same as above, but throw exceptions within the workers and make sure they
+;; remain alive.
+(test-equal "exceptions"
+ 4242
+ (let* ((pool (make-pool 10))
+ (result 0)
+ (1+! (let ((lock (make-mutex)))
+ (lambda ()
+ (with-mutex lock
+ (set! result (+ result 1)))))))
+ (let loop ((i 10))
+ (unless (zero? i)
+ (pool-enqueue! pool (lambda ()
+ (throw 'whatever)))
+ (loop (- i 1))))
+ (let loop ((i 4242))
+ (unless (zero? i)
+ (pool-enqueue! pool 1+!)
+ (loop (- i 1))))
+ (let poll ()
+ (unless (pool-idle? pool)
+ (pk 'busy result)
+ (sleep 1)
+ (poll)))
+ result))
+
(test-end)