Fix tests on MacOS.
This comes down to the lack of a 'seq' command (what?!) and the fact that BSD "wc -l" returns extra whitespace, while the GNU version doesn't. We should be using numeric comparisons instead of string comparisons, and then it's ok.
This commit is contained in:
parent
d21e6612e2
commit
8f9453a55d
12 changed files with 23 additions and 17 deletions
|
|
@ -1,13 +1,13 @@
|
||||||
all:
|
all:
|
||||||
. ./check-1.sh
|
. ./check-1.sh
|
||||||
$(MAKE) 1.n0 2.n0 3.n0
|
$(MAKE) 1.n0 2.n0 3.n0
|
||||||
$(MAKE) $(shell seq 10 | sed 's/$$/.n1/')
|
$(MAKE) $(shell ./seq 10 | sed 's/$$/.n1/')
|
||||||
. ./check-2.sh
|
. ./check-2.sh
|
||||||
|
|
||||||
%.n0: $(shell seq 10 | sed 's/$$/.n1/')
|
%.n0: $(shell ./seq 10 | sed 's/$$/.n1/')
|
||||||
: >$@
|
: >$@
|
||||||
|
|
||||||
%.n1: $(shell seq 100 | sed 's/$$/.n2/')
|
%.n1: $(shell ./seq 100 | sed 's/$$/.n2/')
|
||||||
echo n1-$* >$@
|
echo n1-$* >$@
|
||||||
|
|
||||||
.PRECIOUS: %.n2
|
.PRECIOUS: %.n2
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
COUNT_IN=$(ls *.count | wc -l)
|
COUNT_IN=$(ls *.count | wc -l)
|
||||||
COUNT_OUT=$(cat *.count | wc -l)
|
COUNT_OUT=$(cat *.count | wc -l)
|
||||||
if [ "$COUNT_IN" != "$COUNT_OUT" ]; then
|
if [ "$COUNT_IN" -ne "$COUNT_OUT" ]; then
|
||||||
echo "expected $COUNT_IN individual writes, got $COUNT_OUT" >&2
|
echo "expected $COUNT_IN individual writes, got $COUNT_OUT" >&2
|
||||||
exit 42
|
exit 42
|
||||||
fi
|
fi
|
||||||
COUNTALL_IN=$(cat in.countall | wc -l)
|
COUNTALL_IN=$(cat in.countall | wc -l)
|
||||||
COUNTALL_OUT=$(cat out.countall | wc -l)
|
COUNTALL_OUT=$(cat out.countall | wc -l)
|
||||||
if [ "$COUNTALL_IN" != "$COUNTALL_OUT" ]; then
|
if [ "$COUNTALL_IN" -ne "$COUNTALL_OUT" ]; then
|
||||||
echo "expected $COUNTALL_IN allwrites, got $COUNTALL_OUT" >&2
|
echo "expected $COUNTALL_IN allwrites, got $COUNTALL_OUT" >&2
|
||||||
exit 43
|
exit 43
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
DEPS=$(seq 10 | sed 's/$/.n1/')
|
DEPS=$(./seq 10 | sed 's/$/.n1/')
|
||||||
redo-ifchange $DEPS
|
redo-ifchange $DEPS
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
DEPS=$(seq 100 | sed 's/$/.n2/')
|
DEPS=$(./seq 100 | sed 's/$/.n2/')
|
||||||
redo-ifchange $DEPS
|
redo-ifchange $DEPS
|
||||||
echo n1-$1
|
echo n1-$1
|
||||||
|
|
|
||||||
6
t/curse/seq
Executable file
6
t/curse/seq
Executable file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/sh
|
||||||
|
i=0
|
||||||
|
while [ "$i" -lt "$1" ]; do
|
||||||
|
i=$(($i + 1))
|
||||||
|
echo $i
|
||||||
|
done
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
. ./check-1.sh
|
. ./check-1.sh
|
||||||
redo-ifchange 1.n0 2.n0 3.n0
|
redo-ifchange 1.n0 2.n0 3.n0
|
||||||
DEPS=$(seq 10 | sed 's/$/.n1/')
|
DEPS=$(./seq 10 | sed 's/$/.n1/')
|
||||||
redo-ifchange $DEPS
|
redo-ifchange $DEPS
|
||||||
. ../skip-if-minimal-do.sh
|
. ../skip-if-minimal-do.sh
|
||||||
. ./check-2.sh
|
. ./check-2.sh
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@ rm -f *.out *.log
|
||||||
|
|
||||||
../../flush-cache.sh
|
../../flush-cache.sh
|
||||||
redo-ifchange 1.out 2.out
|
redo-ifchange 1.out 2.out
|
||||||
[ "$(cat 1.log | wc -l)" = 1 ] || exit 55
|
[ "$(cat 1.log | wc -l)" -eq 1 ] || exit 55
|
||||||
[ "$(cat 2.log | wc -l)" = 1 ] || exit 56
|
[ "$(cat 2.log | wc -l)" -eq 1 ] || exit 56
|
||||||
../../flush-cache.sh
|
../../flush-cache.sh
|
||||||
touch 1.in
|
touch 1.in
|
||||||
redo-ifchange 1.out 2.out
|
redo-ifchange 1.out 2.out
|
||||||
[ "$(cat 2.log | wc -l)" = 1 ] || exit 58
|
[ "$(cat 2.log | wc -l)" -eq 1 ] || exit 58
|
||||||
. ../../skip-if-minimal-do.sh
|
. ../../skip-if-minimal-do.sh
|
||||||
[ "$(cat 1.log | wc -l)" = 2 ] || exit 57
|
[ "$(cat 1.log | wc -l)" -eq 2 ] || exit 57
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ redo-ifchange t1
|
||||||
C1="$(wc -l <dir1/log)"
|
C1="$(wc -l <dir1/log)"
|
||||||
C2="$(wc -l <log)"
|
C2="$(wc -l <log)"
|
||||||
. ../../skip-if-minimal-do.sh
|
. ../../skip-if-minimal-do.sh
|
||||||
if [ "$C1" != 1 -o "$C2" != 2 ]; then
|
if [ "$C1" -ne 1 -o "$C2" -ne 2 ]; then
|
||||||
echo "failed: t1>t1, c1=$C1, c2=$C2" >&2
|
echo "failed: t1>t1, c1=$C1, c2=$C2" >&2
|
||||||
exit 55
|
exit 55
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,4 @@ redo-ifchange static1 static2
|
||||||
|
|
||||||
COUNT=$(wc -l <static.log)
|
COUNT=$(wc -l <static.log)
|
||||||
. ../skip-if-minimal-do.sh
|
. ../skip-if-minimal-do.sh
|
||||||
[ "$COUNT" = 4 ] || exit 55
|
[ "$COUNT" -eq 4 ] || exit 55
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,4 @@ redo-ifchange genfile1
|
||||||
|
|
||||||
COUNT=$(wc -l <genfile.log)
|
COUNT=$(wc -l <genfile.log)
|
||||||
. ../skip-if-minimal-do.sh
|
. ../skip-if-minimal-do.sh
|
||||||
[ "$COUNT" = 2 ] || exit 77
|
[ "$COUNT" -eq 2 ] || exit 77
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ redo t2
|
||||||
redo t2
|
redo t2
|
||||||
OUT=$(cat t2.count | wc -l)
|
OUT=$(cat t2.count | wc -l)
|
||||||
. ../skip-if-minimal-do.sh
|
. ../skip-if-minimal-do.sh
|
||||||
if [ "$OUT" != 2 ]; then
|
if [ "$OUT" -ne 2 ]; then
|
||||||
echo "t2: expected 2"
|
echo "t2: expected 2"
|
||||||
exit 43
|
exit 43
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,4 @@ touch makedir/outfile
|
||||||
./flush-cache.sh
|
./flush-cache.sh
|
||||||
redo-ifchange makedir
|
redo-ifchange makedir
|
||||||
COUNT=$(wc -l <makedir.log)
|
COUNT=$(wc -l <makedir.log)
|
||||||
[ "$COUNT" = 1 ] || exit 99
|
[ "$COUNT" -eq 1 ] || exit 99
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue