Fix test failures when $TMPDIR changes

(cherry picked from commit c38c726eb5d447c7e9d894d57cd05ac46c173ddd)
This commit is contained in:
Eelco Dolstra 2019-05-07 21:15:45 +02:00
parent 34fa8ce917
commit 5064971ded
No known key found for this signature in database
GPG Key ID: 8170B4726D7198DE
4 changed files with 8 additions and 10 deletions

View File

@ -8,13 +8,13 @@ clearStore
clearCache
# Ensure this builds successfully first
nix build -f dependencies.nix
nix build --no-link -f dependencies.nix
clearStore
clearCache
# Try --dry-run using old command first
nix-build dependencies.nix --dry-run 2>&1 | grep "will be built"
nix-build --no-out-link dependencies.nix --dry-run 2>&1 | grep "will be built"
# Now new command:
nix build -f dependencies.nix --dry-run 2>&1 | grep "will be built"
@ -27,7 +27,7 @@ clearCache
# Try --dry-run using new command first
nix build -f dependencies.nix --dry-run 2>&1 | grep "will be built"
# Now old command:
nix-build dependencies.nix --dry-run 2>&1 | grep "will be built"
nix-build --no-out-link dependencies.nix --dry-run 2>&1 | grep "will be built"
fi
###################################################

View File

@ -7,7 +7,7 @@ remoteRoot=$TEST_ROOT/store2
chmod -R u+w "$remoteRoot" || true
rm -rf "$remoteRoot"
outPath=$(nix-build dependencies.nix)
outPath=$(nix-build --no-out-link dependencies.nix)
nix copy --to "ssh://localhost?store=$NIX_STORE_DIR&remote-store=$remoteRoot%3fstore=$NIX_STORE_DIR%26real=$remoteRoot$NIX_STORE_DIR" $outPath

View File

@ -27,13 +27,13 @@ output=$(nix-shell --pure --keep SELECTED_IMPURE_VAR shell.nix -A shellDrv --run
# Test nix-shell on a .drv symlink
# Legacy: absolute path and .drv extension required
nix-instantiate shell.nix -A shellDrv --indirect --add-root shell.drv
[[ $(nix-shell --pure $PWD/shell.drv --run \
nix-instantiate shell.nix -A shellDrv --indirect --add-root $TEST_ROOT/shell.drv
[[ $(nix-shell --pure $TEST_ROOT/shell.drv --run \
'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX"') = " - foo - bar" ]]
# New behaviour: just needs to resolve to a derivation in the store
nix-instantiate shell.nix -A shellDrv --indirect --add-root shell
[[ $(nix-shell --pure shell --run \
nix-instantiate shell.nix -A shellDrv --indirect --add-root $TEST_ROOT/shell
[[ $(nix-shell --pure $TEST_ROOT/shell --run \
'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX"') = " - foo - bar" ]]
# Test nix-shell -p

View File

@ -18,5 +18,3 @@ nix-build --no-out-link -E '
";
}
'
echo XYZZY