aboutsummaryrefslogtreecommitdiff
path: root/tests/repair.sh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-09-23 19:09:58 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-09-23 19:09:58 +0200
commit31ab4c3816675b5bf2f7b29dfb10112cd8ec9ceb (patch)
treef93292c8fdfc4b60a54b3c58b981bddfd650f2fd /tests/repair.sh
parentcec94738715275ec4761071cefe4a9ae1a565960 (diff)
Test whether build/repair results are read-only
Diffstat (limited to 'tests/repair.sh')
-rw-r--r--tests/repair.sh13
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/repair.sh b/tests/repair.sh
index ec7ad5dca..ba019028d 100644
--- a/tests/repair.sh
+++ b/tests/repair.sh
@@ -13,14 +13,14 @@ hash=$(nix-hash $path2)
chmod u+w $path2
touch $path2/bad
-if nix-store --verify --check-contents -v; then
- echo "nix-store --verify succeeded unexpectedly" >&2
- exit 1
-fi
+(! nix-store --verify --check-contents -v)
# The path can be repaired by rebuilding the derivation.
nix-store --verify --check-contents --repair
+(! [ -e $path2/bad ])
+(! [ -w $path2 ])
+
nix-store --verify-path $path2
# Re-corrupt and delete the deriver. Now --verify --repair should
@@ -30,10 +30,7 @@ touch $path2/bad
nix-store --delete $(nix-store -qd $path2)
-if nix-store --verify --check-contents --repair; then
- echo "nix-store --verify --repair succeeded unexpectedly" >&2
- exit 1
-fi
+(! nix-store --verify --check-contents --repair)
nix-build dependencies.nix -o $TEST_ROOT/result --repair