X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/8f75811e49388577186fc634e931edc1834b59c9..3e90f7c100988b1f90706e2212fec687d2cd7f52:/test/inc/test-eom-align diff --git a/test/inc/test-eom-align b/test/inc/test-eom-align index c6e6225f..5c81d74d 100755 --- a/test/inc/test-eom-align +++ b/test/inc/test-eom-align @@ -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 @@ -95,7 +95,8 @@ makembox_B () { # Do a single test with message one's body of size sz. do_one_test_A () { SZ=$1 - makembox_A "$MH_TEST_DIR/eom-align.mbox" $STDIO_BUFSZ + printf '%5s A\r' $SZ + makembox_A "$MH_TEST_DIR/eom-align.mbox" $SZ $VALGRIND inc -silent -file "$MH_TEST_DIR/eom-align.mbox" # We know the messages should be 11 and 12 in inbox # Now get the bodies back out. @@ -112,7 +113,8 @@ do_one_test_A () { # Do a test type B do_one_test_B () { SZ=$1 - makembox_B "$MH_TEST_DIR/eom-align.mbox" $STDIO_BUFSZ + printf '%5s B\r' $SZ + makembox_B "$MH_TEST_DIR/eom-align.mbox" $SZ $VALGRIND inc -silent -file "$MH_TEST_DIR/eom-align.mbox" # We know the message should be 11 in the inbox body1="$MH_TEST_DIR/eom-align.inbox.body1" @@ -126,16 +128,27 @@ do_one_test_B () { # buffer size or to body size equal to buffer size. arith_eval $STDIO_BUFSZ - 16; START=$arith_val arith_eval $STDIO_BUFSZ + $HDRSZ + $FROMLINESZ + 32; FINISH=$arith_val -echo \ +[ -t 1 ] && echo \ "Testing inc of files with various alignments of eom marker with buffer size..." + +#### Trouble spots for the particular input, with BUFSZ of 8192: +for sz in 3146 3147 7241 7242 7243 11338 11339 15433 15434 15435; do + do_one_test_A $sz +done + +# Also 155, 174, 175, but they're too small for makembox_B to handle. +for sz in 684 4074 4097 4148 4610 4611 5121 5122 6654 6655 8170 \ + 8193 8244 8364 12266 12289 12340 16362 16385 16436; do + do_one_test_B $sz +done + 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` done -progress_done +printf '\n' test ${failed:-0} -eq 0 && \ rm "$MH_TEST_DIR/eom-align.mbox" "$MH_TEST_DIR/eom-align.mbox.body"