summaryrefslogtreecommitdiff
path: root/tests/guix-environment-container.sh
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-10-19 12:51:57 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-10-19 13:11:40 -0400
commit5e2140511c1ad9ccd731438b74d61b62111da1e6 (patch)
treea4ff748ad26e121b88469b5d921001ef1382be8f /tests/guix-environment-container.sh
parent9e3a5ee417ea7fe9721be8804ff047e80c4f22ed (diff)
parent353bdae32f72b720c7ddd706576ccc40e2b43f95 (diff)
downloadguix-patches-5e2140511c1ad9ccd731438b74d61b62111da1e6.tar
guix-patches-5e2140511c1ad9ccd731438b74d61b62111da1e6.tar.gz
Merge branch 'staging'
Conflicts: gnu/packages/admin.scm gnu/packages/commencement.scm gnu/packages/gdb.scm gnu/packages/llvm.scm gnu/packages/package-management.scm gnu/packages/tls.scm
Diffstat (limited to 'tests/guix-environment-container.sh')
-rw-r--r--tests/guix-environment-container.sh25
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh
index 45264d4978..f2d15c8d0c 100644
--- a/tests/guix-environment-container.sh
+++ b/tests/guix-environment-container.sh
@@ -44,6 +44,21 @@ else
test $? = 42
fi
+# Make sure "localhost" resolves.
+guix environment --container --ad-hoc --bootstrap guile-bootstrap \
+ -- guile -c '(exit (pair? (getaddrinfo "localhost" "80")))'
+
+# We should get ECONNREFUSED, not ENETUNREACH, which would indicate that "lo"
+# is down.
+guix environment --container --ad-hoc --bootstrap guile-bootstrap \
+ -- guile -c "(exit (= ECONNREFUSED
+ (catch 'system-error
+ (lambda ()
+ (let ((sock (socket AF_INET SOCK_STREAM 0)))
+ (connect sock AF_INET INADDR_LOOPBACK 12345)))
+ (lambda args
+ (pk 'errno (system-error-errno args))))))"
+
# Make sure '--preserve' is honored.
result="`FOOBAR=42; export FOOBAR; guix environment -C --ad-hoc --bootstrap \
guile-bootstrap -E ^FOO -- guile -c '(display (getenv \"FOOBAR\"))'`"
@@ -127,11 +142,15 @@ grep -e "$NIX_STORE_DIR/.*-bash" $tmpdir/mounts # bootstrap bash
rm $tmpdir/mounts
-# Make sure 'GUIX_ENVIRONMENT' is linked to '~/.guix-profile' when requested
+# Make sure 'GUIX_ENVIRONMENT' is set to '~/.guix-profile' when requested
# within a container.
(
- linktest='(exit (string=? (getenv "GUIX_ENVIRONMENT")
-(readlink (string-append (getenv "HOME") "/.guix-profile"))))'
+ linktest='
+(exit (and (string=? (getenv "GUIX_ENVIRONMENT")
+ (string-append (getenv "HOME") "/.guix-profile"))
+ (string-prefix? "'"$NIX_STORE_DIR"'"
+ (readlink (string-append (getenv "HOME")
+ "/.guix-profile")))))'
cd "$tmpdir" \
&& guix environment --bootstrap --container --link-profile \