forked from lix-project/lix
* TDD! Woohoo!
This commit is contained in:
parent
089c41a0c2
commit
b90787290d
|
@ -32,3 +32,7 @@ export nixinstantiate=$TOP/src/nix-instantiate/nix-instantiate
|
||||||
export nixstore=$TOP/src/nix-store/nix-store
|
export nixstore=$TOP/src/nix-store/nix-store
|
||||||
export nixenv=$TOP/src/nix-env/nix-env
|
export nixenv=$TOP/src/nix-env/nix-env
|
||||||
export nixhash=$TOP/src/nix-hash/nix-hash
|
export nixhash=$TOP/src/nix-hash/nix-hash
|
||||||
|
|
||||||
|
readLink() {
|
||||||
|
ls -l "$1" | sed 's/.*->\ //'
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,15 @@ $nixstore --gc --print-live | grep $outPath
|
||||||
$nixstore --gc --print-dead | grep $drvPath
|
$nixstore --gc --print-dead | grep $drvPath
|
||||||
if $nixstore --gc --print-dead | grep $outPath; then false; fi
|
if $nixstore --gc --print-dead | grep $outPath; then false; fi
|
||||||
|
|
||||||
|
$nixstore --gc --print-dead
|
||||||
|
|
||||||
|
inUse=$(readLink $outPath/input-2)
|
||||||
|
if $nixstore --delete $inUse; then false; fi
|
||||||
|
test -e $inUse
|
||||||
|
|
||||||
|
if $nixstore --delete $outPath; then false; fi
|
||||||
|
test -e $outPath
|
||||||
|
|
||||||
$NIX_BIN_DIR/nix-collect-garbage
|
$NIX_BIN_DIR/nix-collect-garbage
|
||||||
|
|
||||||
# Check that the root and its dependencies haven't been deleted.
|
# Check that the root and its dependencies haven't been deleted.
|
||||||
|
|
|
@ -6,7 +6,9 @@ $nixstore --gc
|
||||||
test "$(cat $TEST_ROOT/result/foobar)" = FOOBAR
|
test "$(cat $TEST_ROOT/result/foobar)" = FOOBAR
|
||||||
|
|
||||||
# The result should be retained by a GC.
|
# The result should be retained by a GC.
|
||||||
target=$(ls -l $TEST_ROOT/result | sed 's/.*->\ //')
|
echo A
|
||||||
|
target=$(readLink $TEST_ROOT/result)
|
||||||
|
echo B
|
||||||
echo target is $target
|
echo target is $target
|
||||||
$nixstore --gc
|
$nixstore --gc
|
||||||
test -e $target/foobar
|
test -e $target/foobar
|
||||||
|
|
|
@ -36,6 +36,6 @@ cat $outPath/input-2/bar
|
||||||
|
|
||||||
# Check that the derivers are set properly.
|
# Check that the derivers are set properly.
|
||||||
test $($nixstore -q --deriver "$outPath") = "$drvPath"
|
test $($nixstore -q --deriver "$outPath") = "$drvPath"
|
||||||
$nixstore -q --deriver $(ls -l $outPath/input-2 | sed 's/.*->\ //') | grep -q -- "-input-2.drv"
|
$nixstore -q --deriver $(readLink $outPath/input-2) | grep -q -- "-input-2.drv"
|
||||||
|
|
||||||
$nixstore --clear-substitutes
|
$nixstore --clear-substitutes
|
||||||
|
|
|
@ -10,3 +10,8 @@ echo "output path is $outPath"
|
||||||
|
|
||||||
text=$(cat "$outPath"/hello)
|
text=$(cat "$outPath"/hello)
|
||||||
if test "$text" != "Hello World!"; then exit 1; fi
|
if test "$text" != "Hello World!"; then exit 1; fi
|
||||||
|
|
||||||
|
# Directed delete: $outPath is not reachable from a root, so it should
|
||||||
|
# be deleteable.
|
||||||
|
$nixstore --delete $outPath
|
||||||
|
if test -e $outPath/hello; then false; fi
|
||||||
|
|
Loading…
Reference in a new issue