tests: add fetchTarball test for symlink temporary directories

Change-Id: I6a6a6964dfe85b5ee4f66b8c442fe448c7c5c87c
This commit is contained in:
Emily
2025-10-17 18:41:58 +00:00
committed by Qyriad
parent 013d5e54e9
commit d9eead0eac
+8
View File
@@ -30,6 +30,14 @@ test_tarball() {
# Do not re-fetch paths already present
nix-build -o $TEST_ROOT/result -E "import (fetchTarball { url = \"file:///does-not-exist/must-remain-unused/$tarball\"; sha256 = \"$hash\"; })"
# Regression test: Ensure tarballs can be unpacked when the
# temporary directory is a symbolic link.
(
export HOME=$(mktemp -d)
ln -sf "$TMPDIR" "$HOME/tmp"
nix-build -o "$TEST_ROOT/result" --temp-dir "$HOME/tmp" -E "import (fetchTarball \"file://$tarball\")"
)
nix-build -o $TEST_ROOT/result -E "import (fetchTree \"file://$tarball\")"
nix-build -o $TEST_ROOT/result -E "import (fetchTree { type = \"tarball\"; url = \"file://$tarball\"; })"
nix-build -o $TEST_ROOT/result -E "import (fetchTree { type = \"tarball\"; url = \"file://$tarball\"; narHash = \"$hash\"; })"