t/deps/dirtest: test correct dependency checking for targets named 'dirname'

We had a bug (fixed in the previous commit) where doing 'redo-ifchange
dirname' (which runs dirname/all.do) would not create the stamp correctly,
so that it would always show up as dirty.

It's a little bit complicated to simulate, but this does it.
This commit is contained in:
Avery Pennarun 2010-11-22 22:50:54 -08:00
commit ac36c5bbb1
10 changed files with 34 additions and 2 deletions

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

@ -0,0 +1,2 @@
log
dir1/stinky

1
t/deps/dirtest/clean.do Normal file
View file

@ -0,0 +1 @@
rm -f *~ .*~ dir1/*~ dir1/.*~ dir1/stinky dir1/log log

View file

@ -0,0 +1,2 @@
redo-ifchange stinky
echo $$ >>log

View file

@ -0,0 +1 @@
echo "I'm stinky"

2
t/deps/dirtest/t1.do Normal file
View file

@ -0,0 +1,2 @@
redo-ifchange dir1/
echo $$ >>log

2
t/deps/dirtest/t2.do Normal file
View file

@ -0,0 +1,2 @@
redo-ifchange dir1
echo $$ >>log

2
t/deps/dirtest/t3.do Normal file
View file

@ -0,0 +1,2 @@
redo-ifchange dir1/all
echo $$ >>log

19
t/deps/dirtest/test.do Normal file
View file

@ -0,0 +1,19 @@
touch t?.do
for first in t1 t2 t3; do
for second in t1 t2 t3; do
rm -f log dir1/log dir1/stinky
. ../../flush-cache.sh
redo $first
touch $second.do
. ../../flush-cache.sh
redo $second
. ../../flush-cache.sh
redo-ifchange $second
C1="$(wc -l <dir1/log)"
C2="$(wc -l <log)"
if [ "$C1" != 1 -o "$C2" != 2 ]; then
echo "failed: $first>$second, c1=$C1, c2=$C2" >&2
exit 55
fi
done
done

View file

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

View file

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