summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-12-14 19:52:47 +0100
committerLudovic Courtès <ludo@gnu.org>2015-12-14 19:57:42 +0100
commit9d3994f70095b46b95e6d05562f32c25be326772 (patch)
tree1073f885bc9f3b89500666427ee14b432b1af5bc /tests
parent4fef1e850e4872f2bc7c1f0a10cbac176b50895f (diff)
downloadguix-9d3994f70095b46b95e6d05562f32c25be326772.tar.gz
gexp: 'local-file' resolves relative file names.
* guix/gexp.scm (<local-file>): Rename constructor to '%%local-file'.
Add 'absolute' field.
(%local-file, extract-directory, absolute-file-name): New procedures.
(current-source-directory): New macro.
(local-file): Adjust call to '%local-file'.
(local-file-absolute-file-name): New procedure.
(local-file-compiler): Force the 'absolute' field.
* tests/guix-system.sh: Test whether 'local-file' canonicalization
works.
* doc/guix.texi (G-Expressions): Adjust.
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-system.sh32
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index e20bc98713..02e2524d9e 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -17,7 +17,7 @@
 # along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 #
-# Test the daemon and its interaction with 'guix substitute'.
+# Test 'guix system', mostly error reporting.
 #
 
 set -e
@@ -26,7 +26,15 @@ guix system --version
 
 tmpfile="t-guix-system-$$"
 errorfile="t-guix-system-error-$$"
-trap 'rm -f "$tmpfile" "$errorfile"' EXIT
+
+# Note: This directory is chosen outside $builddir so that relative file name
+# canonicalization doesn't mess up with 'current-source-directory', used by
+# 'local-file' ('load' forces 'relative' for
+# %FILE-PORT-NAME-CANONICALIZATION.)
+tmpdir="${TMPDIR:-/tmp}/t-guix-system-$$"
+mkdir "$tmpdir"
+
+trap 'rm -f "$tmpfile" "$errorfile" "$tmpdir"/*; rmdir "$tmpdir"' EXIT
 
 # Reporting of syntax errors.
 
@@ -180,3 +188,23 @@ make_user_config "users" "group-that-does-not-exist"
 if guix system build "$tmpfile" -n 2> "$errorfile"
 then false
 else grep "supplementary group.*group-that-does-not-exist.*undeclared" "$errorfile"; fi
+
+# Try 'local-file' and relative file name resolution.
+
+cat > "$tmpdir/config.scm"<<EOF
+(use-modules (gnu))
+(use-service-modules networking)
+
+(operating-system
+  $OS_BASE
+  (services (cons (tor-service (local-file "my-torrc"))
+                  %base-services)))
+EOF
+
+cat > "$tmpdir/my-torrc"<<EOF
+# This is an example file.
+EOF
+
+# In both cases 'my-torrc' should be properly resolved.
+guix system build "$tmpdir/config.scm" -n
+(cd "$tmpdir"; guix system build "config.scm" -n)