mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 06:42:28 +00:00
housekeeping: shellcheck for tests/functional/chroot-store.sh
This commit is contained in:
parent
63272235e2
commit
48520cb71e
@ -2,34 +2,34 @@
|
||||
|
||||
source common.sh
|
||||
|
||||
echo example > $TEST_ROOT/example.txt
|
||||
mkdir -p $TEST_ROOT/x
|
||||
echo example > "$TEST_ROOT"/example.txt
|
||||
mkdir -p "$TEST_ROOT/x"
|
||||
|
||||
export NIX_STORE_DIR=/nix2/store
|
||||
|
||||
CORRECT_PATH=$(cd $TEST_ROOT && nix-store --store ./x --add example.txt)
|
||||
CORRECT_PATH=$(cd "$TEST_ROOT" && nix-store --store ./x --add example.txt)
|
||||
|
||||
[[ $CORRECT_PATH =~ ^/nix2/store/.*-example.txt$ ]]
|
||||
|
||||
PATH1=$(cd $TEST_ROOT && nix path-info --store ./x $CORRECT_PATH)
|
||||
[ $CORRECT_PATH == $PATH1 ]
|
||||
PATH1=$(cd "$TEST_ROOT" && nix path-info --store ./x "$CORRECT_PATH")
|
||||
[ "$CORRECT_PATH" == "$PATH1" ]
|
||||
|
||||
PATH2=$(nix path-info --store "$TEST_ROOT/x" $CORRECT_PATH)
|
||||
[ $CORRECT_PATH == $PATH2 ]
|
||||
PATH2=$(nix path-info --store "$TEST_ROOT/x" "$CORRECT_PATH")
|
||||
[ "$CORRECT_PATH" == "$PATH2" ]
|
||||
|
||||
PATH3=$(nix path-info --store "local?root=$TEST_ROOT/x" $CORRECT_PATH)
|
||||
[ $CORRECT_PATH == $PATH3 ]
|
||||
PATH3=$(nix path-info --store "local?root=$TEST_ROOT/x" "$CORRECT_PATH")
|
||||
[ "$CORRECT_PATH" == "$PATH3" ]
|
||||
|
||||
# Ensure store info trusted works with local store
|
||||
nix --store $TEST_ROOT/x store info --json | jq -e '.trusted'
|
||||
nix --store "$TEST_ROOT/x" store info --json | jq -e '.trusted'
|
||||
|
||||
# Test building in a chroot store.
|
||||
if canUseSandbox; then
|
||||
|
||||
flakeDir=$TEST_ROOT/flake
|
||||
mkdir -p $flakeDir
|
||||
mkdir -p "$flakeDir"
|
||||
|
||||
cat > $flakeDir/flake.nix <<EOF
|
||||
cat > "$flakeDir"/flake.nix <<EOF
|
||||
{
|
||||
outputs = inputs: rec {
|
||||
packages.$system.default = import ./simple.nix;
|
||||
@ -37,11 +37,12 @@ if canUseSandbox; then
|
||||
}
|
||||
EOF
|
||||
|
||||
cp simple.nix shell.nix simple.builder.sh config.nix $flakeDir/
|
||||
cp simple.nix shell.nix simple.builder.sh config.nix "$flakeDir/"
|
||||
|
||||
outPath=$(nix build --print-out-paths --no-link --sandbox-paths '/nix? /bin? /lib? /lib64? /usr?' --store $TEST_ROOT/x path:$flakeDir)
|
||||
outPath=$(nix build --print-out-paths --no-link --sandbox-paths '/nix? /bin? /lib? /lib64? /usr?' --store "$TEST_ROOT/x" path:"$flakeDir")
|
||||
|
||||
[[ $outPath =~ ^/nix2/store/.*-simple$ ]]
|
||||
|
||||
[[ $(cat $TEST_ROOT/x/nix/store/$(basename $outPath)/hello) = 'Hello World!' ]]
|
||||
base=$(basename "$outPath")
|
||||
[[ $(cat "$TEST_ROOT"/x/nix/store/"$base"/hello) = 'Hello World!' ]]
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user