From 19437785ebf515aa0ac63541566d28267f63a333 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Wed, 26 Feb 2014 17:53:51 +0100
Subject: [PATCH] Test nix-store --optimise

---
 tests/optimise-store.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tests/optimise-store.sh b/tests/optimise-store.sh
index 6eb54ca50..ea4478693 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
-- 
GitLab