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:
Avery Pennarun 2010-12-12 05:38:30 -08:00
commit 8f9453a55d
12 changed files with 23 additions and 17 deletions

View file

@ -1,13 +1,13 @@
all:
. ./check-1.sh
$(MAKE) 1.n0 2.n0 3.n0
$(MAKE) $(shell seq 10 | sed 's/$$/.n1/')
$(MAKE) $(shell ./seq 10 | sed 's/$$/.n1/')
. ./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-$* >$@
.PRECIOUS: %.n2

View file

@ -1,12 +1,12 @@
COUNT_IN=$(ls *.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
exit 42
fi
COUNTALL_IN=$(cat in.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
exit 43
fi

View file

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

View file

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

6
t/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

View file

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