mirror of
https://github.com/NixOS/nix
synced 2025-07-08 06:53:54 +02:00
* Test for runtime root finding.
This commit is contained in:
parent
dcded7da47
commit
7adaa6d446
5 changed files with 64 additions and 5 deletions
39
tests/gc-runtime.sh
Normal file
39
tests/gc-runtime.sh
Normal file
|
@ -0,0 +1,39 @@
|
|||
source common.sh
|
||||
|
||||
case $system in
|
||||
*linux*)
|
||||
;;
|
||||
*)
|
||||
exit 0;
|
||||
esac
|
||||
|
||||
set -m # enable job control, needed for kill
|
||||
|
||||
profiles="$NIX_STATE_DIR"/profiles
|
||||
rm -f $profiles/*
|
||||
|
||||
$nixenv -p $profiles/test -f ./gc-runtime.nix -i gc-runtime
|
||||
|
||||
outPath=$($nixenv -p $profiles/test -q --no-name --out-path gc-runtime)
|
||||
echo $outPath
|
||||
|
||||
echo "backgrounding program..."
|
||||
$profiles/test/program &
|
||||
child=$!
|
||||
echo PID=$child
|
||||
|
||||
$nixenv -p $profiles/test -e gc-runtime
|
||||
$nixenv -p $profiles/test --delete-generations old
|
||||
|
||||
cp $TOP/scripts/find-runtime-roots.pl $TEST_ROOT/foo.pl
|
||||
chmod +x $TEST_ROOT/foo.pl
|
||||
NIX_ROOT_FINDER=$TEST_ROOT/foo.pl $nixstore --gc
|
||||
|
||||
kill -- -$child
|
||||
|
||||
if ! test -e $outPath; then
|
||||
echo "running program was garbage collected!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue