mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
shellcheck fix: tests/functional/fixed
This commit is contained in:
parent
4cec876319
commit
f8e351cd94
4 changed files with 21 additions and 19 deletions
|
|
@ -106,9 +106,6 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
excludes = [
|
excludes = [
|
||||||
# We haven't linted these files yet
|
# We haven't linted these files yet
|
||||||
''^tests/functional/fixed\.builder1\.sh$''
|
|
||||||
''^tests/functional/fixed\.builder2\.sh$''
|
|
||||||
''^tests/functional/fixed\.sh$''
|
|
||||||
''^tests/functional/flakes/absolute-paths\.sh$''
|
''^tests/functional/flakes/absolute-paths\.sh$''
|
||||||
''^tests/functional/flakes/check\.sh$''
|
''^tests/functional/flakes/check\.sh$''
|
||||||
''^tests/functional/flakes/config\.sh$''
|
''^tests/functional/flakes/config\.sh$''
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# shellcheck shell=bash
|
||||||
if test "$IMPURE_VAR1" != "foo"; then exit 1; fi
|
if test "$IMPURE_VAR1" != "foo"; then exit 1; fi
|
||||||
if test "$IMPURE_VAR2" != "bar"; then exit 1; fi
|
if test "$IMPURE_VAR2" != "bar"; then exit 1; fi
|
||||||
echo "Hello World!" > $out
|
# shellcheck disable=SC2154
|
||||||
|
echo "Hello World!" > "$out"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
echo dummy: $dummy
|
# shellcheck shell=bash
|
||||||
|
# shellcheck disable=SC2154
|
||||||
|
echo dummy: "$dummy"
|
||||||
if test -n "$dummy"; then sleep 2; fi
|
if test -n "$dummy"; then sleep 2; fi
|
||||||
mkdir $out
|
# shellcheck disable=SC2154
|
||||||
mkdir $out/bla
|
mkdir "$out"
|
||||||
echo "Hello World!" > $out/foo
|
mkdir "$out"/bla
|
||||||
ln -s foo $out/bar
|
echo "Hello World!" > "$out"/foo
|
||||||
|
ln -s foo "$out"/bar
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ TODO_NixOS
|
||||||
|
|
||||||
clearStore
|
clearStore
|
||||||
|
|
||||||
path=$(nix-store -q $(nix-instantiate fixed.nix -A good.0))
|
path=$(nix-store -q "$(nix-instantiate fixed.nix -A good.0)")
|
||||||
|
|
||||||
echo 'testing bad...'
|
echo 'testing bad...'
|
||||||
nix-build fixed.nix -A bad --no-out-link && fail "should fail"
|
nix-build fixed.nix -A bad --no-out-link && fail "should fail"
|
||||||
|
|
@ -14,7 +14,7 @@ nix-build fixed.nix -A bad --no-out-link && fail "should fail"
|
||||||
# Building with the bad hash should produce the "good" output path as
|
# Building with the bad hash should produce the "good" output path as
|
||||||
# a side-effect.
|
# a side-effect.
|
||||||
[[ -e $path ]]
|
[[ -e $path ]]
|
||||||
nix path-info --json $path | grep fixed:md5:2qk15sxzzjlnpjk9brn7j8ppcd
|
nix path-info --json "$path" | grep fixed:md5:2qk15sxzzjlnpjk9brn7j8ppcd
|
||||||
|
|
||||||
echo 'testing good...'
|
echo 'testing good...'
|
||||||
nix-build fixed.nix -A good --no-out-link
|
nix-build fixed.nix -A good --no-out-link
|
||||||
|
|
@ -37,7 +37,7 @@ fi
|
||||||
|
|
||||||
# While we're at it, check attribute selection a bit more.
|
# While we're at it, check attribute selection a bit more.
|
||||||
echo 'testing attribute selection...'
|
echo 'testing attribute selection...'
|
||||||
test $(nix-instantiate fixed.nix -A good.1 | wc -l) = 1
|
test "$(nix-instantiate fixed.nix -A good.1 | wc -l)" = 1
|
||||||
|
|
||||||
# Test parallel builds of derivations that produce the same output.
|
# Test parallel builds of derivations that produce the same output.
|
||||||
# Only one should run at the same time.
|
# Only one should run at the same time.
|
||||||
|
|
@ -51,16 +51,16 @@ echo 'testing sameAsAdd...'
|
||||||
out=$(nix-build fixed.nix -A sameAsAdd --no-out-link)
|
out=$(nix-build fixed.nix -A sameAsAdd --no-out-link)
|
||||||
|
|
||||||
# This is what fixed.builder2 produces...
|
# This is what fixed.builder2 produces...
|
||||||
rm -rf $TEST_ROOT/fixed
|
rm -rf "$TEST_ROOT"/fixed
|
||||||
mkdir $TEST_ROOT/fixed
|
mkdir "$TEST_ROOT"/fixed
|
||||||
mkdir $TEST_ROOT/fixed/bla
|
mkdir "$TEST_ROOT"/fixed/bla
|
||||||
echo "Hello World!" > $TEST_ROOT/fixed/foo
|
echo "Hello World!" > "$TEST_ROOT"/fixed/foo
|
||||||
ln -s foo $TEST_ROOT/fixed/bar
|
ln -s foo "$TEST_ROOT"/fixed/bar
|
||||||
|
|
||||||
out2=$(nix-store --add $TEST_ROOT/fixed)
|
out2=$(nix-store --add "$TEST_ROOT"/fixed)
|
||||||
[ "$out" = "$out2" ]
|
[ "$out" = "$out2" ]
|
||||||
|
|
||||||
out3=$(nix-store --add-fixed --recursive sha256 $TEST_ROOT/fixed)
|
out3=$(nix-store --add-fixed --recursive sha256 "$TEST_ROOT"/fixed)
|
||||||
[ "$out" = "$out3" ]
|
[ "$out" = "$out3" ]
|
||||||
|
|
||||||
out4=$(nix-store --print-fixed-path --recursive sha256 "1ixr6yd3297ciyp9im522dfxpqbkhcw0pylkb2aab915278fqaik" fixed)
|
out4=$(nix-store --print-fixed-path --recursive sha256 "1ixr6yd3297ciyp9im522dfxpqbkhcw0pylkb2aab915278fqaik" fixed)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue