Add t/deps/basic, to test basic autodependency behaviour.

Unfortunately it failed before the previous patch, so that's why this test
is needed :(

The test is a little ugly, because the bug I'm testing for didn't happen
except if you ran 'redo' two times in a row, not two times inside the same
redo session.  That's because dependency caching inside the one session
prevents the accidental rebuild.
This commit is contained in:
Avery Pennarun 2010-11-22 22:44:08 -08:00
commit 3fcd677428
7 changed files with 23 additions and 3 deletions

2
t/deps/basic/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.log
*.out

1
t/deps/basic/1.in Normal file
View file

@ -0,0 +1 @@
this is 1

1
t/deps/basic/2.in Normal file
View file

@ -0,0 +1 @@
this is 2

View file

@ -0,0 +1,3 @@
redo-ifchange $1.in
echo $$
echo $$ >>$1.log

12
t/deps/basic/test.do Normal file
View file

@ -0,0 +1,12 @@
rm -f *.out *.log
. ../../flush-cache.sh
redo-ifchange 1.out 2.out
[ "$(cat 1.log | wc -l)" = 1 ] || exit 55
[ "$(cat 2.log | wc -l)" = 1 ] || exit 56
. ../../flush-cache.sh
touch 1.in
redo-ifchange 1.out 2.out
[ "$(cat 1.log | wc -l)" = 2 ] || exit 57
[ "$(cat 2.log | wc -l)" = 1 ] || exit 58

View file

@ -1,3 +1 @@
redo test1 test2 ifchange-fail overwrite
redo test1 test2 ifchange-fail overwrite basic/test

3
t/flush-cache.sh Normal file
View file

@ -0,0 +1,3 @@
echo "Flushing redo cache..." >&2
find "$REDO_BASE/.redo" -name 'built^*' -o -name 'mark^*' |
xargs rm -f >&2