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
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
# 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
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"
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"
# 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