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:
Avery Pennarun 2012-02-08 00:33:00 -05:00
commit 7822f5a5bb
170 changed files with 100 additions and 80 deletions

5
t/950-curse/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
*.n1
*.n2
*.count
*.countall
countall

6
t/950-curse/all.do Normal file
View file

@ -0,0 +1,6 @@
. ./check-1.sh
redo-ifchange 1.n0 2.n0 3.n0
DEPS=$(./seq 10 | sed 's/$/.n1/')
redo-ifchange $DEPS
. ../skip-if-minimal-do.sh
. ./check-2.sh

3
t/950-curse/check-1.sh Normal file
View file

@ -0,0 +1,3 @@
rm -f in.countall out.countall *.count
touch in.countall out.countall
echo x >x.count

12
t/950-curse/check-2.sh Normal file
View file

@ -0,0 +1,12 @@
COUNT_IN=$(ls *.count | wc -l)
COUNT_OUT=$(cat *.count | wc -l)
if [ "$COUNT_IN" -ne "$COUNT_OUT" ]; then
echo "expected $COUNT_IN individual writes, got $COUNT_OUT" >&2
exit 42
fi
COUNTALL_IN=$(cat in.countall | wc -l)
COUNTALL_OUT=$(cat out.countall | wc -l)
if [ "$COUNTALL_IN" -ne "$COUNTALL_OUT" ]; then
echo "expected $COUNTALL_IN allwrites, got $COUNTALL_OUT" >&2
exit 43
fi

3
t/950-curse/clean.do Normal file
View file

@ -0,0 +1,3 @@
rm -f *~ .*~ *.n0 *.n1 *.n2 *.tmp *.count countall *.countall

2
t/950-curse/countall.do Normal file
View file

@ -0,0 +1,2 @@
echo $1 >>out.countall
echo hello

View file

@ -0,0 +1,2 @@
DEPS=$(./seq 10 | sed 's/$/.n1/')
redo-ifchange $DEPS

View file

@ -0,0 +1,3 @@
DEPS=$(./seq 100 | sed 's/$/.n2/')
redo-ifchange $DEPS
echo n1-$2

View file

@ -0,0 +1,9 @@
echo n2-$2
echo $2 >>$2.count
echo $2 >>in.countall
# we deliberately use 'redo' here instead of redo-ifchange, because this *heavily*
# stresses redo's locking when building in parallel. We end up with 100
# different targets that all not only depend on this file, but absolutely must
# acquire the lock on this file, build it atomically, and release the lock.
redo countall

6
t/950-curse/seq Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
i=0
while [ "$i" -lt "$1" ]; do
i=$(($i + 1))
echo $i
done