aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-register.sh29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/guix-register.sh b/tests/guix-register.sh
index ca28fb0d95..ee633af4f9 100644
--- a/tests/guix-register.sh
+++ b/tests/guix-register.sh
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
@@ -29,6 +29,33 @@ rm -rf "$new_store"
exit_hook=":"
trap "chmod -R +w $new_store ; rm -rf $new_store $closure ; \$exit_hook" EXIT
+#
+# Registering items in the current store---i.e., without '--prefix'.
+#
+
+new_file="$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-guix-register-$$"
+echo "Fake store file to test registration." > "$new_file"
+
+# Register the file with zero references and no deriver.
+guix-register <<EOF
+$new_file
+
+0
+EOF
+
+# Make sure it's valid, and delete it.
+guile -c "
+ (use-modules (guix store))
+ (define s (open-connection))
+ (exit (and (valid-path? s \"$new_file\")
+ (null? (references s \"$new_file\"))
+ (pair? (delete-paths s (list \"$new_file\")))))"
+
+
+#
+# Registering items in a new store, with '--prefix'.
+#
+
mkdir -p "$new_store/$storedir"
new_store_dir="`cd "$new_store/$storedir" ; pwd`"
new_store="`cd "$new_store" ; pwd`"