aboutsummaryrefslogtreecommitdiff
path: root/tests/readfile-context.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/readfile-context.sh')
-rw-r--r--tests/readfile-context.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/readfile-context.sh b/tests/readfile-context.sh
new file mode 100644
index 000000000..31e70ddb1
--- /dev/null
+++ b/tests/readfile-context.sh
@@ -0,0 +1,16 @@
+source common.sh
+
+clearStore
+
+outPath=$(nix-build --no-out-link readfile-context.nix)
+
+# Set a GC root.
+ln -s $outPath "$NIX_STATE_DIR"/gcroots/foo
+
+# Check that file exists.
+[ "$(cat $(cat $outPath))" = "Hello World!" ]
+
+nix-collect-garbage
+
+# Check that file still exists.
+[ "$(cat $(cat $outPath))" = "Hello World!" ]