From: Ken Hornstein Date: Fri, 10 Feb 2012 20:11:05 +0000 (-0500) Subject: Make the test suite work on systems other than Linux. Still needs work. X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=8ae191f927b3e294b7a50124b8c806365c4dbeb8;p=mmh Make the test suite work on systems other than Linux. Still needs work. --- diff --git a/.gitignore b/.gitignore index df57aa8..159cacf 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ /config.h /config.log /config.status +/test/common.sh /stamp-h1 # Removed by clean: diff --git a/Makefile.am b/Makefile.am index 41dee6c..1340639 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,9 +40,13 @@ testdir = $(srcdir)/test ## And it would be easier to clean up if tests were launched from a ## tmp directory, and/or each test cleaned up after itself on ## successful completion. -MOSTLYCLEANFILES = test/testinstall/*.actual* test/testinstall/*.expected* \ - test/testinstall/*.replgroupcomps test/testinstall/*.draft \ - test/testinstall/,*.draft* \* +##MOSTLYCLEANFILES = test/testinstall/*.actual* test/testinstall/*.expected* \ +## test/testinstall/*.replgroupcomps test/testinstall/*.draft \ +## test/testinstall/,*.draft* + +mostlyclean-local: + rm -rf test/testinstall + rm -rf test/testbuild ## ## Stuff that should be cleaned via "make clean" @@ -180,7 +184,9 @@ EXTRA_DIST = config/version.sh sbr/sigmsg.awk etc/mts.conf.in etc/sendfiles.in \ man/rcvpack.man man/rcvstore.man man/rcvtty.man man/refile.man \ man/repl.man man/rmf.man man/rmm.man man/scan.man man/send.man \ man/sendfiles.man man/show.man man/slocal.man man/sortm.man \ - man/unseen.man man/whatnow.man man/whom.man + man/unseen.man man/whatnow.man man/whom.man test/common.sh.in \ + test/README test/runalltests test/runtest test/setup-test \ + test/teardown-test test/tests ## ## These are all of the definitions for each of the programs listed above. diff --git a/configure.ac b/configure.ac index a6b5525..2e8cbd7 100644 --- a/configure.ac +++ b/configure.ac @@ -247,7 +247,17 @@ AC_PROG_LEX dnl Check for lex/flex dnl Look for `cut' pathtmp=/usr/bin:/bin:/usr/local/bin:/usr/xpg4/bin:/usr/ucb -AC_PATH_PROG(cutpath, cut, no, [$pathtmp]) +AC_PATH_PROG([cutpath], [cut], [no], [$pathtmp]) + +dnl +dnl Check for MD5 program and formatting command +dnl +AC_CHECK_PROGS([MD5SUM], [md5sum md5], [missing]) +AS_CASE(["${MD5SUM}"], + [md5sum], [MD5FMT="cat"], + [md5], [[MD5FMT="${SED} -e 's/MD5 *(\(.*\)) *= \([0-9a-f]*\)/\2 \1/'"]], + [MD5FMT="missing"]) +AC_SUBST([MD5FMT]) dnl ---------------------------------------------- dnl check for lclint, and lint if it doesn't exist @@ -760,5 +770,5 @@ TLS support : ${tls_support} dnl --------------- dnl OUTPUT MAKEFILE dnl --------------- -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile test/common.sh]) AC_OUTPUT diff --git a/test/common.sh b/test/common.sh.in similarity index 95% rename from test/common.sh rename to test/common.sh.in index 5d46c8c..c7d557a 100644 --- a/test/common.sh +++ b/test/common.sh.in @@ -1,4 +1,10 @@ # Common helper routines for test shell scripts -- intended to be sourced by them + +output_md5() +{ + @MD5SUM@ $* | @MD5FMT@ +} + test_skip () { WHY="$1" diff --git a/test/runtest b/test/runtest index 5cfc158..f23608b 100755 --- a/test/runtest +++ b/test/runtest @@ -22,7 +22,7 @@ mkdir $MH_TEST_DIR/Mail echo "Path: $MH_TEST_DIR/Mail" > $MH folder -create +inbox > /dev/null # create 10 basic messages -for i in `seq 1 10`; +for i in 1 2 3 4 5 6 7 8 9 10; do cat > $MH_TEST_DIR/Mail/inbox/$i < @@ -47,7 +47,7 @@ elif [ $return_value -eq 120 ]; then # indicates test was skipped (eg needed program not found) # test itself should have printed a message about this, # so print nothing here. - : + status=0 else echo Test $1 FAIL fi diff --git a/test/tests/inc/test-deb359167 b/test/tests/inc/test-deb359167 index 36cd1c2..ef0abc8 100644 --- a/test/tests/inc/test-deb359167 +++ b/test/tests/inc/test-deb359167 @@ -10,7 +10,7 @@ require_prog valgrind TESTMBOX="$THISDIR/deb359167.mbox" -if [ "$(md5sum "$TESTMBOX" | cut -d ' ' -f 1)" != "e6ac458b8cccba2b2fd866fb505aeb5e" ]; then +if [ "$(${MD5SUM} "$TESTMBOX" | cut -d ' ' -f 1)" != "e6ac458b8cccba2b2fd866fb505aeb5e" ]; then echo "Test mailbox has been corrupted" exit 1 fi diff --git a/test/tests/inc/test-eom-align b/test/tests/inc/test-eom-align index 3b6c677..2c1c67e 100644 --- a/test/tests/inc/test-eom-align +++ b/test/tests/inc/test-eom-align @@ -21,7 +21,7 @@ fi # intact. (Since we're dealing in exact byte alignment # minor corruptions such as line ending changes could # render the tests useless.) -(cd "$THISDIR" && md5sum *.txt > "$MH_TEST_DIR/inctest.md5sums") +(cd "$THISDIR" && output_md5 *.txt > "$MH_TEST_DIR/inctest.md5sums") diff -u "$THISDIR/md5sums" "$MH_TEST_DIR/inctest.md5sums" FILLER="$THISDIR/filler.txt" @@ -115,9 +115,11 @@ do_one_test_B () { START=$(($STDIO_BUFSZ - 16)) FINISH=$(($STDIO_BUFSZ + $HDRSZ + $FROMLINESZ + 32)) echo "Testing inc of files with various alignments of eom marker with buffer size..." -for sz in $(seq $START $FINISH); do +i="$START" +while test $i -le $FINISH; do progress_update $sz $START $FINISH do_one_test_A $sz do_one_test_B $sz + i=$(expr $i + 1) done progress_done