summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-gc.sh12
-rw-r--r--tests/guix-package.sh15
-rw-r--r--tests/store.scm26
3 files changed, 48 insertions, 5 deletions
diff --git a/tests/guix-gc.sh b/tests/guix-gc.sh
index a90d085ab2..eac9d82e89 100644
--- a/tests/guix-gc.sh
+++ b/tests/guix-gc.sh
@@ -25,6 +25,18 @@ guix gc --version
trap "rm -f guix-gc-root" EXIT
rm -f guix-gc-root
+# Check the references of a .drv.
+drv="`guix build guile-bootstrap -d`"
+out="`guix build guile-bootstrap`"
+test -f "$drv" && test -d "$out"
+
+guix gc --references "$drv" | grep -e -bash
+guix gc --references "$out"
+guix gc --references "$out/bin/guile"
+
+if guix gc --references /dev/null;
+then false; else true; fi
+
# Add then reclaim a .drv file.
drv="`guix build idutils -d`"
test -f "$drv"
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index cf8bc5c7e8..f84893ba0b 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -33,6 +33,10 @@ rm -f "$profile"
trap 'rm "$profile" "$profile-"[0-9]* ; rm -rf t-home-'"$$" EXIT
+# Use `-e' with a non-package expression.
+if guix package --bootstrap -e +;
+then false; else true; fi
+
guix package --bootstrap -p "$profile" -i guile-bootstrap
test -L "$profile" && test -L "$profile-1-link"
test -f "$profile/bin/guile"
@@ -46,8 +50,9 @@ test -f "$profile/bin/guile"
# Check whether we have network access.
if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
then
- boot_make="`guix build -e '(@@ (gnu packages base) gnu-make-boot0)'`"
- guix package --bootstrap -p "$profile" -i "$boot_make"
+ boot_make="(@@ (gnu packages base) gnu-make-boot0)"
+ boot_make_drv="`guix build -e "$boot_make"`"
+ guix package --bootstrap -p "$profile" -i "$boot_make_drv"
test -L "$profile-2-link"
test -f "$profile/bin/make" && test -f "$profile/bin/guile"
@@ -94,7 +99,7 @@ then
done
# Reinstall after roll-back to the empty profile.
- guix package --bootstrap -p "$profile" -i "$boot_make"
+ guix package --bootstrap -p "$profile" -e "$boot_make"
test "`readlink_base "$profile"`" = "$profile-1-link"
test -x "$profile/bin/guile" && ! test -x "$profile/bin/make"
@@ -104,7 +109,7 @@ then
test -x "$profile/bin/guile" && ! test -x "$profile/bin/make"
# Install Make.
- guix package --bootstrap -p "$profile" -i "$boot_make"
+ guix package --bootstrap -p "$profile" -e "$boot_make"
test "`readlink_base "$profile"`" = "$profile-2-link"
test -x "$profile/bin/guile" && test -x "$profile/bin/make"
@@ -145,7 +150,7 @@ test -f "$HOME/.guix-profile/bin/guile"
if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
then
- guix package --bootstrap -i "$boot_make"
+ guix package --bootstrap -e "$boot_make"
test -f "$HOME/.guix-profile/bin/make"
first_environment="`cd $HOME/.guix-profile ; pwd`"
diff --git a/tests/store.scm b/tests/store.scm
index c90fd3fed9..c2de99e160 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -23,6 +23,7 @@
#:use-module (guix base32)
#:use-module (guix packages)
#:use-module (guix derivations)
+ #:use-module (gnu packages)
#:use-module (gnu packages bootstrap)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
@@ -79,6 +80,31 @@
(> freed 0)
(not (file-exists? p))))))
+(test-assert "references"
+ (let* ((t1 (add-text-to-store %store "random1"
+ (random-text) '()))
+ (t2 (add-text-to-store %store "random2"
+ (random-text) (list t1))))
+ (and (equal? (list t1) (references %store t2))
+ (equal? (list t2) (referrers %store t1))
+ (null? (references %store t1))
+ (null? (referrers %store t2)))))
+
+(test-assert "derivers"
+ (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))))
+ (d (derivation %store "the-thing" (%current-system)
+ s `("-e" ,b) `(("foo" . ,(random-text)))
+ `((,b) (,s))))
+ (o (derivation-path->output-path d)))
+ (and (build-derivations %store (list d))
+ (equal? (query-derivation-outputs %store d)
+ (list o))
+ (equal? (valid-derivers %store o)
+ (list d)))))
+
(test-assert "no substitutes"
(let* ((s (open-connection))
(d1 (package-derivation s %bootstrap-guile (%current-system)))