t/*: rearrange tests into numbered directories.
It was getting way too ad-hoc in there. Let's reorganize the tests so that there's a good, obvious, suggested sequence to run them in.
This commit is contained in:
parent
116c279e96
commit
7822f5a5bb
170 changed files with 100 additions and 80 deletions
7
t/350-deps/.gitignore
vendored
Normal file
7
t/350-deps/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
t1a
|
||||
t2.count
|
||||
overwrite
|
||||
overwrite[123]
|
||||
genfile2
|
||||
genfile.log
|
||||
static.log
|
||||
2
t/350-deps/all.do
Normal file
2
t/350-deps/all.do
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
redo test1 test2 ifchange-fail overwrite gentest doublestatic \
|
||||
basic/test
|
||||
2
t/350-deps/basic/.gitignore
vendored
Normal file
2
t/350-deps/basic/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*.log
|
||||
*.out
|
||||
1
t/350-deps/basic/1.in
Normal file
1
t/350-deps/basic/1.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
this is 1
|
||||
1
t/350-deps/basic/2.in
Normal file
1
t/350-deps/basic/2.in
Normal file
|
|
@ -0,0 +1 @@
|
|||
this is 2
|
||||
2
t/350-deps/basic/clean.do
Normal file
2
t/350-deps/basic/clean.do
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
rm -f *~ .*~ *.log *.out
|
||||
|
||||
3
t/350-deps/basic/default.out.do
Normal file
3
t/350-deps/basic/default.out.do
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
redo-ifchange $2.in
|
||||
echo $$
|
||||
echo $$ >>$2.log
|
||||
13
t/350-deps/basic/test.do
Normal file
13
t/350-deps/basic/test.do
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
rm -f *.out *.log
|
||||
|
||||
../../flush-cache
|
||||
redo-ifchange 1.out 2.out
|
||||
[ "$(cat 1.log | wc -l)" -eq 1 ] || exit 55
|
||||
[ "$(cat 2.log | wc -l)" -eq 1 ] || exit 56
|
||||
../../flush-cache
|
||||
touch 1.in
|
||||
redo-ifchange 1.out 2.out
|
||||
[ "$(cat 2.log | wc -l)" -eq 1 ] || exit 58
|
||||
. ../../skip-if-minimal-do.sh
|
||||
[ "$(cat 1.log | wc -l)" -eq 2 ] || exit 57
|
||||
|
||||
1
t/350-deps/broken.do
Normal file
1
t/350-deps/broken.do
Normal file
|
|
@ -0,0 +1 @@
|
|||
false
|
||||
3
t/350-deps/clean.do
Normal file
3
t/350-deps/clean.do
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
redo basic/clean dirtest/clean
|
||||
rm -f *~ .*~ *.count t1a overwrite overwrite[123] \
|
||||
genfile2 genfile.log static.log
|
||||
11
t/350-deps/doublestatic.do
Normal file
11
t/350-deps/doublestatic.do
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
rm -f static.log
|
||||
|
||||
redo static1 static2
|
||||
|
||||
touch static.in
|
||||
../flush-cache
|
||||
redo-ifchange static1 static2
|
||||
|
||||
COUNT=$(wc -l <static.log)
|
||||
. ../skip-if-minimal-do.sh
|
||||
[ "$COUNT" -eq 4 ] || exit 55
|
||||
2
t/350-deps/genfile1.do
Normal file
2
t/350-deps/genfile1.do
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
redo-ifchange genfile2
|
||||
echo $$ >>genfile.log
|
||||
21
t/350-deps/gentest.do
Normal file
21
t/350-deps/gentest.do
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
rm -f genfile2 genfile2.do genfile.log
|
||||
|
||||
echo echo hello >genfile2.do
|
||||
../flush-cache
|
||||
redo genfile1
|
||||
|
||||
# this will cause a rebuild:
|
||||
# genfile1 depends on genfile2 depends on genfile2.do
|
||||
rm -f genfile2.do
|
||||
../flush-cache
|
||||
redo-ifchange genfile1
|
||||
|
||||
# but genfile2.do was gone last time, so genfile2 no longer depends on it.
|
||||
# thus, it can be considered up-to-date. Prior versions of redo had a bug
|
||||
# where the dependency on genfile2.do was never dropped.
|
||||
../flush-cache
|
||||
redo-ifchange genfile1
|
||||
|
||||
COUNT=$(wc -l <genfile.log)
|
||||
. ../skip-if-minimal-do.sh
|
||||
[ "$COUNT" -eq 2 ] || exit 77
|
||||
4
t/350-deps/ifchange-fail.do
Normal file
4
t/350-deps/ifchange-fail.do
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
if redo-ifchange broken 2>/dev/null; then
|
||||
echo "expected broken.do to fail, but it didn't" >&2
|
||||
exit 44
|
||||
fi
|
||||
6
t/350-deps/overwrite.do
Normal file
6
t/350-deps/overwrite.do
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
. ../skip-if-minimal-do.sh
|
||||
|
||||
redo overwrite1 2>&1 && exit 55
|
||||
redo overwrite2 2>&1 && exit 56
|
||||
redo overwrite3 2>&1 && exit 57
|
||||
exit 0
|
||||
2
t/350-deps/overwrite1.do
Normal file
2
t/350-deps/overwrite1.do
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# this shouldn't be allowed; we're supposed to write to $3, not $1
|
||||
echo >$1
|
||||
5
t/350-deps/overwrite2.do
Normal file
5
t/350-deps/overwrite2.do
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# this shouldn't be allowed; stdout is connected to $3 already, so if we
|
||||
# replace it *and* write to stdout, we're probably confused.
|
||||
echo hello world
|
||||
rm -f $3
|
||||
echo goodbye world >$3
|
||||
8
t/350-deps/overwrite3.do
Normal file
8
t/350-deps/overwrite3.do
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# we don't delete $3 here, we just truncate and overwrite it. But redo
|
||||
# can detect this by checking the current file position of our stdout when
|
||||
# we exit, and making sure it equals either 0 or the file size.
|
||||
#
|
||||
# If it doesn't, then we accidentally wrote to *both* stdout and a separate
|
||||
# file, and we should get warned about it.
|
||||
echo hello world
|
||||
echo goodbye world >$3
|
||||
0
t/350-deps/static.in
Normal file
0
t/350-deps/static.in
Normal file
2
t/350-deps/static1.do
Normal file
2
t/350-deps/static1.do
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
redo-ifchange static.in
|
||||
echo $$ >>static.log
|
||||
2
t/350-deps/static2.do
Normal file
2
t/350-deps/static2.do
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
redo-ifchange static.in
|
||||
echo $$ >>static.log
|
||||
2
t/350-deps/t1a.do
Normal file
2
t/350-deps/t1a.do
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
redo-ifchange t1dep
|
||||
echo $$
|
||||
1
t/350-deps/t1dep.do
Normal file
1
t/350-deps/t1dep.do
Normal file
|
|
@ -0,0 +1 @@
|
|||
# nothing to do
|
||||
1
t/350-deps/t2.do
Normal file
1
t/350-deps/t2.do
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo $$ >>t2.count
|
||||
15
t/350-deps/test1.do
Normal file
15
t/350-deps/test1.do
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# force-rebuild t1dep
|
||||
redo t1dep
|
||||
|
||||
if [ -e t1a ]; then
|
||||
BEFORE="$(cat t1a)"
|
||||
else
|
||||
BEFORE=
|
||||
fi
|
||||
../flush-cache
|
||||
redo-ifchange t1a # it definitely had to rebuild because t1dep changed
|
||||
AFTER="$(cat t1a)"
|
||||
if [ "$BEFORE" = "$AFTER" ]; then
|
||||
echo "t1a was not rebuilt!" >&2
|
||||
exit 43
|
||||
fi
|
||||
9
t/350-deps/test2.do
Normal file
9
t/350-deps/test2.do
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
rm -f t2.count
|
||||
redo t2
|
||||
redo t2
|
||||
OUT=$(cat t2.count | wc -l)
|
||||
. ../skip-if-minimal-do.sh
|
||||
if [ "$OUT" -ne 2 ]; then
|
||||
echo "t2: expected 2"
|
||||
exit 43
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue