* TDD! Woohoo!
This commit is contained in:
parent
089c41a0c2
commit
b90787290d
5 changed files with 22 additions and 2 deletions
|
@ -32,3 +32,7 @@ export nixinstantiate=$TOP/src/nix-instantiate/nix-instantiate
|
|||
export nixstore=$TOP/src/nix-store/nix-store
|
||||
export nixenv=$TOP/src/nix-env/nix-env
|
||||
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
|
||||
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
|
||||
|
||||
# Check that the root and its dependencies haven't been deleted.
|
||||
|
|
|
@ -6,7 +6,9 @@ $nixstore --gc
|
|||
test "$(cat $TEST_ROOT/result/foobar)" = FOOBAR
|
||||
|
||||
# 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
|
||||
$nixstore --gc
|
||||
test -e $target/foobar
|
||||
|
|
|
@ -36,6 +36,6 @@ cat $outPath/input-2/bar
|
|||
|
||||
# Check that the derivers are set properly.
|
||||
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
|
||||
|
|
|
@ -10,3 +10,8 @@ echo "output path is $outPath"
|
|||
|
||||
text=$(cat "$outPath"/hello)
|
||||
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