summary refs log tree commit diff
path: root/tests/guix-pack-relocatable.sh
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2020-04-24 14:30:38 +0200
committerLudovic Courtès <ludo@gnu.org>2020-04-24 16:21:13 +0200
commit2520059bdb43fa1663ce102f3f4c442d4918c32b (patch)
tree6b5038f9e65c49c862dfae705a2eaa57b9351a1b /tests/guix-pack-relocatable.sh
parent193192ca77bffddd241b6706df21b5e8bccc4cce (diff)
downloadguix-2520059bdb43fa1663ce102f3f4c442d4918c32b.tar.gz
pack: 'guix pack -R' wrapper correctly reports exit code.
Fixes <https://bugs.gnu.org/40816>.
Reported by Jan (janneke) Nieuwenhuizen <janneke@gnu.org>.

* gnu/packages/aux-files/run-in-namespace.c (main): In the 'default'
case, check 'WIFEXITED (status)' and exit with the corresponding code in
that case.  Exit with 255 in other cases.
* tests/guix-pack-relocatable.sh: Add test.
Diffstat (limited to 'tests/guix-pack-relocatable.sh')
-rw-r--r--tests/guix-pack-relocatable.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/guix-pack-relocatable.sh b/tests/guix-pack-relocatable.sh
index e93610eedc..a3fd45623c 100644
--- a/tests/guix-pack-relocatable.sh
+++ b/tests/guix-pack-relocatable.sh
@@ -1,5 +1,5 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 #
 # This file is part of GNU Guix.
 #
@@ -72,6 +72,10 @@ then
     # mounting an empty file system on top of it.  That way, we exercise the
     # wrapper code that creates the user namespace and bind-mounts the store.
     unshare -mrf sh -c 'mount -t tmpfs none "$STORE_PARENT"; echo "$STORE_PARENT"/*; "$test_directory/Bin/sed" --version > "$test_directory/output"'
+
+    # Check whether the exit code is preserved.
+    if unshare -mrf sh -c 'mount -t tmpfs none "$STORE_PARENT"; echo "$STORE_PARENT"/*; "$test_directory/Bin/sed" --does-not-exist';
+    then false; else true; fi
 else
     # Run the relocatable 'sed' in the current namespaces.  This is a weak
     # test because we're going to access store items from the host store.