nix/tests/functional/readfile-context.sh

21 lines
409 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2017-11-10 22:51:34 +00:00
source common.sh
TODO_NixOS # NixOS doesn't provide $NIX_STATE_DIR (and shouldn't)
2017-11-10 22:51:34 +00:00
clearStore
outPath=$(nix-build --no-out-link readfile-context.nix)
# Set a GC root.
ln -s $outPath "$NIX_STATE_DIR/gcroots/foo"
2017-11-10 22:51:34 +00:00
# Check that file exists.
[ "$(cat $(cat $outPath))" = "Hello World!" ]
nix-collect-garbage
# Check that file still exists.
[ "$(cat $(cat $outPath))" = "Hello World!" ]