about summary refs log tree commit diff
path: root/tests/optimise-store.sh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-26T16·53+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-26T16·53+0100
commit19437785ebf515aa0ac63541566d28267f63a333 (patch)
treee6ea91be0a3390f8c3f6015239f0033b4fb0aa30 /tests/optimise-store.sh
parentfdff3a7eae8a4d2f0e6eae992d3c3cf64e1a3ad3 (diff)
Test nix-store --optimise
Diffstat (limited to 'tests/optimise-store.sh')
-rw-r--r--tests/optimise-store.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/optimise-store.sh b/tests/optimise-store.sh
index 6eb54ca508..ea4478693e 100644
--- a/tests/optimise-store.sh
+++ b/tests/optimise-store.sh
@@ -18,6 +18,23 @@ if [ "$nlink" != 3 ]; then
     exit 1
 fi
 
+outPath3=$(echo 'with import ./config.nix; mkDerivation { name = "foo3"; builder = builtins.toFile "builder" "mkdir $out; echo hello > $out/foo"; }' | nix-build - --no-out-link)
+
+inode3="$(perl -e "print ((lstat('$outPath3/foo'))[1])")"
+if [ "$inode1" = "$inode3" ]; then
+    echo "inodes match unexpectedly"
+    exit 1
+fi
+
+nix-store --optimise
+
+inode1="$(perl -e "print ((lstat('$outPath1/foo'))[1])")"
+inode3="$(perl -e "print ((lstat('$outPath3/foo'))[1])")"
+if [ "$inode1" != "$inode3" ]; then
+    echo "inodes do not match"
+    exit 1
+fi
+
 nix-store --gc
 
 if [ -n "$(ls $NIX_STORE_DIR/.links)" ]; then