Fixed mhstore to honor nmh-storage profile entry even with -auto [Bug #35303].
[mmh] / test / inc / test-eom-align
index c0cae7c..48c3c01 100755 (executable)
@@ -4,11 +4,16 @@
 
 set -e
 
-. ${MH_TEST_COMMON}
+if test -z "${MH_OBJ_DIR}"; then
+    srcdir=`dirname "$0"`/../..
+    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
+fi
+
+. "$MH_OBJ_DIR/test/common.sh"
 
 setup_test
 
-THISDIR="${srcdir}/test/inc"
+THISDIR="$srcdir/test/inc"
 
 if [ ! -z "$VALGRIND_ME" ]; then
     require_prog valgrind
@@ -24,7 +29,7 @@ fi
 # minor corruptions such as line ending changes could
 # render the tests useless.)
 (cd "$THISDIR" && output_md5 *.txt > "$MH_TEST_DIR/inctest.md5sums")
-diff -u "$THISDIR/md5sums" "$MH_TEST_DIR/inctest.md5sums"
+check "$THISDIR/md5sums" "$MH_TEST_DIR/inctest.md5sums" 'keep first'
 
 FILLER="$THISDIR/filler.txt"
 FROMLINE="$THISDIR/fromline.txt"
@@ -91,10 +96,12 @@ do_one_test_A () {
   $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.
-  sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/11" > "$MH_TEST_DIR/eom-align.inbox.body1"
-  sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/12" > "$MH_TEST_DIR/eom-align.inbox.body2"
-  diff -u "$MH_TEST_DIR/eom-align.mbox.body" "$MH_TEST_DIR/eom-align.inbox.body1"
-  diff -u "$FILLER" "$MH_TEST_DIR/eom-align.inbox.body2"
+  body1="$MH_TEST_DIR/eom-align.inbox.body1"
+  body2="$MH_TEST_DIR/eom-align.inbox.body2"
+  sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/11" > "$body1"
+  sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/12" > "$body2"
+  check "$MH_TEST_DIR/eom-align.mbox.body" "$body1" 'keep first'
+  check "$FILLER" "$body2" 'keep first'
   rmm 11 12
 }
 
@@ -105,12 +112,12 @@ do_one_test_B () {
   makembox_B "$MH_TEST_DIR/eom-align.mbox" $STDIO_BUFSZ
   $VALGRIND inc -silent -file "$MH_TEST_DIR/eom-align.mbox"
   # We know the message should be 11 in the inbox
-  sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/11" > "$MH_TEST_DIR/eom-align.inbox.body1"
-  diff -u "$MH_TEST_DIR/eom-align.mbox.body" "$MH_TEST_DIR/eom-align.inbox.body1"
+  body1="$MH_TEST_DIR/eom-align.inbox.body1"
+  sed -e '1,/^$/d' "$MH_TEST_DIR/Mail/inbox/11" > "$body1"
+  check "$MH_TEST_DIR/eom-align.mbox.body" "$body1" 'keep first'
   rmm 11
 }
 
-
 # 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.
@@ -119,9 +126,14 @@ FINISH=$(($STDIO_BUFSZ + $HDRSZ + $FROMLINESZ + 32))
 echo "Testing inc of files with various alignments of eom marker with buffer size..."
 i="$START"
 while test $i -le $FINISH; do
-  progress_update $sz $START $FINISH
-  do_one_test_A $sz
-  do_one_test_B $sz
+  progress_update $i $START $FINISH
+  do_one_test_A $i
+  do_one_test_B $i
   i=$(expr $i + 1)
 done
 progress_done
+
+test ${failed:-0} -eq 0  &&  \
+rm "$MH_TEST_DIR/eom-align.mbox" "$MH_TEST_DIR/eom-align.mbox.body"
+
+exit $failed