Add test case for NARs with duplicate directory entries

This test was made by @puckipedia.
This commit is contained in:
Eelco Dolstra 2024-09-05 16:41:15 +02:00
parent 495d32e1b8
commit 83d5b32803
3 changed files with 6 additions and 5 deletions

Binary file not shown.

View File

@ -90,7 +90,7 @@ nix_tests = \
derivation-advanced-attributes.sh \ derivation-advanced-attributes.sh \
import-derivation.sh \ import-derivation.sh \
nix_path.sh \ nix_path.sh \
case-hack.sh \ nars.sh \
placeholders.sh \ placeholders.sh \
ssh-relay.sh \ ssh-relay.sh \
build.sh \ build.sh \

View File

@ -6,13 +6,14 @@ TODO_NixOS
clearStore clearStore
rm -rf "$TEST_ROOT/case" # Check that NARs with duplicate directory entries are rejected.
rm -rf "$TEST_ROOT/out"
opts=("--option" "use-case-hack" "true") expectStderr 1 nix-store --restore "$TEST_ROOT/out" < duplicate.nar | grepQuiet "NAR directory is not sorted"
# Check whether restoring and dumping a NAR that contains case # Check whether restoring and dumping a NAR that contains case
# collisions is round-tripping, even on a case-insensitive system. # collisions is round-tripping, even on a case-insensitive system.
rm -rf "$TEST_ROOT/case"
opts=("--option" "use-case-hack" "true")
nix-store "${opts[@]}" --restore "$TEST_ROOT/case" < case.nar nix-store "${opts[@]}" --restore "$TEST_ROOT/case" < case.nar
nix-store "${opts[@]}" --dump "$TEST_ROOT/case" > "$TEST_ROOT/case.nar" nix-store "${opts[@]}" --dump "$TEST_ROOT/case" > "$TEST_ROOT/case.nar"
cmp case.nar "$TEST_ROOT/case.nar" cmp case.nar "$TEST_ROOT/case.nar"