X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=test%2Finc%2Ftest-eom-align;h=5acdc0eb0897302136934fe4b9e3f7480733ddb6;hb=fc0467751b02b9b35a41b8b87c3aaf2b61201a8e;hp=5d4b61668c8583f278fae1ea5bb6a48f11b1048a;hpb=360f0c24ea63ed5420365703dd11f72caca0d183;p=mmh diff --git a/test/inc/test-eom-align b/test/inc/test-eom-align index 5d4b616..5acdc0e 100755 --- a/test/inc/test-eom-align +++ b/test/inc/test-eom-align @@ -15,13 +15,13 @@ setup_test THISDIR="$srcdir/test/inc" -if [ ! -z "$VALGRIND_ME" ]; then +if [ -z "$VALGRIND_ME" ]; then + VALGRIND= +else require_prog valgrind # Lack of quotes here is important VALGRIND="valgrind --quiet --error-exitcode=1" echo "Running tests under valgrind: takes ages!" -else - VALGRIND= fi # First check that all our various pieces of text are @@ -38,7 +38,7 @@ FILLER="$THISDIR/filler.txt" FROMLINE="$THISDIR/fromline.txt" HDR="$THISDIR/msgheader.txt" -if grep -q From "$FILLER"; then +if grep From "$FILLER" >/dev/null; then echo "Somebody's messed with $FILLER -- it must not contain" echo "anything that might look like a message delimiter!" exit 1 @@ -51,8 +51,8 @@ fi # bigger as well. STDIO_BUFSZ=16384 -FROMLINESZ="$(wc -c "$FROMLINE" | cut -d ' ' -f 1)" -HDRSZ="$(wc -c "$HDR" | cut -d ' ' -f 1)" +FROMLINESZ=`wc -c < "$FROMLINE"` +HDRSZ=`wc -c < "$HDR"` # makembox_A mboxname sz # Assemble a mailbox into file mboxname, with two messages, such @@ -65,7 +65,7 @@ makembox_A () { MBOX="$1" SZ=$2 - WANTSZ="$(($SZ - $HDRSZ - $FROMLINESZ - 1))" + arith_eval $SZ - $HDRSZ - $FROMLINESZ - 1; WANTSZ=$arith_val dd if="$FILLER" of="$MBOX.body" bs="$WANTSZ" count=1 2>/dev/null echo >> "$MBOX.body" cat "$FROMLINE" "$HDR" "$MBOX.body" > "$MBOX" @@ -84,7 +84,7 @@ makembox_B () { MBOX="$1" SZ=$2 - WANTSZ="$(($SZ - $HDRSZ - $FROMLINESZ - 1))" + arith_eval $SZ - $HDRSZ - $FROMLINESZ - 1; WANTSZ=$arith_val dd if="$FILLER" of="$MBOX.body" bs="$WANTSZ" count=1 2>/dev/null echo >> "$MBOX.body" cat "$FROMLINE" "$HDR" "$MBOX.body" > "$MBOX" @@ -124,15 +124,16 @@ do_one_test_B () { # Cover a decent range around the stdio buffer size to make sure we catch # any corner cases whether they relate to total message size equal to # buffer size or to body size equal to buffer size. -START=$(($STDIO_BUFSZ - 16)) -FINISH=$(($STDIO_BUFSZ + $HDRSZ + $FROMLINESZ + 32)) -echo "Testing inc of files with various alignments of eom marker with buffer size..." +arith_eval $STDIO_BUFSZ - 16; START=$arith_val +arith_eval $STDIO_BUFSZ + $HDRSZ + $FROMLINESZ + 32; FINISH=$arith_val +echo \ +"Testing inc of files with various alignments of eom marker with buffer size..." i="$START" while test $i -le $FINISH; do progress_update $i $START $FINISH do_one_test_A $i do_one_test_B $i - i=$(expr $i + 1) + i=`expr $i + 1` done progress_done