Re-work the test suite so it now works with Automake (via "make check").
authorKen Hornstein <kenh@pobox.com>
Sat, 11 Feb 2012 04:09:03 +0000 (23:09 -0500)
committerKen Hornstein <kenh@pobox.com>
Sat, 11 Feb 2012 04:09:03 +0000 (23:09 -0500)
31 files changed:
.gitignore
Makefile.am
test/README
test/bad-input/test-header [moved from test/tests/bad-input/test-header with 91% similarity, mode: 0755]
test/cleanup [new file with mode: 0755]
test/common.sh.in
test/folder/test-create [moved from test/tests/folder/test-create with 73% similarity, mode: 0755]
test/folder/test-total [moved from test/tests/folder/test-total with 65% similarity, mode: 0755]
test/inc/deb359167.mbox [moved from test/tests/inc/deb359167.mbox with 100% similarity]
test/inc/filler.txt [moved from test/tests/inc/filler.txt with 100% similarity]
test/inc/fromline.txt [moved from test/tests/inc/fromline.txt with 100% similarity]
test/inc/md5sums [moved from test/tests/inc/md5sums with 100% similarity]
test/inc/msgheader.txt [moved from test/tests/inc/msgheader.txt with 100% similarity]
test/inc/test-deb359167 [moved from test/tests/inc/test-deb359167 with 85% similarity, mode: 0755]
test/inc/test-eom-align [moved from test/tests/inc/test-eom-align with 98% similarity, mode: 0755]
test/manpages/test-manpages [moved from test/tests/manpages/test-manpages with 91% similarity, mode: 0755]
test/mhbuild/test-forw [moved from test/tests/mhbuild/test-forw with 94% similarity, mode: 0755]
test/mhshow/test-cte-binary [moved from test/tests/mhshow/test-cte-binary with 87% similarity, mode: 0755]
test/mhshow/test-qp [moved from test/tests/mhshow/test-qp with 89% similarity, mode: 0755]
test/mhshow/test-subpart [moved from test/tests/mhshow/test-subpart with 89% similarity, mode: 0755]
test/new/test-basic [moved from test/tests/new/test-basic with 96% similarity, mode: 0755]
test/pick/test-stderr [moved from test/tests/pick/test-stderr with 71% similarity, mode: 0755]
test/repl/test-if-str [moved from test/tests/repl/test-if-str with 85% similarity, mode: 0755]
test/runalltests [deleted file]
test/runtest [deleted file]
test/scan/test-scan [moved from test/tests/scan/test-scan with 85% similarity, mode: 0755]
test/setup-test [deleted file]
test/teardown-test [deleted file]
test/whatnow/test-attach-detach [moved from test/tests/whatnow/test-attach-detach with 86% similarity, mode: 0755]
test/whatnow/test-cd [moved from test/tests/whatnow/test-cd with 81% similarity, mode: 0755]
test/whatnow/test-ls [moved from test/tests/whatnow/test-ls with 79% similarity, mode: 0755]

index 159cacf..b65e540 100644 (file)
@@ -45,8 +45,7 @@ a.out.DSYM/
 /mts/libmts.a
 /sbr/*.a
 /sbr/sigmsg.h
-/test/testbuild/
-/test/testinstall/
+/test/testdir
 /uip/ali
 /uip/anno
 /uip/ap
index 1340639..e2aa952 100644 (file)
@@ -33,20 +33,24 @@ auxexecdir = @libdir@
 ##
 ## nmh _does_ have a test suite!
 ##
-testdir = $(srcdir)/test
-## It might be nice to configure testinstall and testbuild
-## directories, but for now they're hard-coded here and in the test
-## scripts.
-## 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*
-
-mostlyclean-local:
-       rm -rf test/testinstall
-       rm -rf test/testbuild
+
+TESTS_ENVIRONMENT = MH_TEST_DIR=`pwd`/test/testdir \
+                   MH_TEST_COMMON=`pwd`/test/common.sh \
+                   MH_OBJ_DIR=`pwd` mandir=$(mandir) bindir=$(bindir) \
+                   sysconfdir=$(sysconfdir)
+##
+## Important note: the "cleanup" test should always be last
+##
+TESTS = test/bad-input/test-header test/folder/test-create \
+       test/folder/test-total test/inc/test-deb359167 test/inc/test-eom-align \
+       test/manpages/test-manpages test/mhbuild/test-forw \
+       test/mhshow/test-cte-binary test/mhshow/test-qp \
+       test/mhshow/test-subpart test/new/test-basic test/pick/test-stderr \
+       test/repl/test-if-str test/scan/test-scan \
+       test/whatnow/test-attach-detach test/whatnow/test-cd \
+       test/whatnow/test-ls test/cleanup
+
+check_SCRIPTS = test/common.sh
 
 ##
 ## Stuff that should be cleaned via "make clean"
@@ -55,7 +59,7 @@ CLEANFILES = config/version.c sbr/sigmsg.h etc/mts.conf etc/sendfiles \
             etc/mhn.defaults man/man.sed $(man_MANS)
 clean-local:
        @rm -rf RPM a.out.DSYM uip/a.out.DSYM
-       @$(testdir)/teardown-test
+       @rm -rf test/testdir
 
 ##
 ## Stuff that should be cleaned via "make maintainer-clean"
@@ -184,9 +188,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 test/common.sh.in \
-            test/README test/runalltests test/runtest test/setup-test \
-            test/teardown-test test/tests
+            man/unseen.man man/whatnow.man man/whom.man test/README $(TESTS) \
+            test/inc/deb359167.mbox test/inc/fromline.txt \
+            test/inc/msgheader.txt test/inc/filler.txt test/inc/md5sums
 
 ##
 ## These are all of the definitions for each of the programs listed above.
@@ -500,10 +504,6 @@ man/man.sed: Makefile
 .man.$(manext8):
        $(SED) -f man/man.sed $< > $@
 
-test: all
-       @$(testdir)/runalltests
-.PHONY: test
-
 ## Don't include commit hashes in ChangeLog.
 ChangeLog:
        @[ -d .git ]  &&  git --no-pager log --abbrev-commit | \
index c61647e..3d7d478 100644 (file)
@@ -9,28 +9,26 @@ the result by one of:
   * for a test pass: exit with status 0
   * where a test has been skipped (perhaps because it depends on an
     external program which can't be found): print "Test $0 SKIP (reason)"
-    and exit with status 120
+    and exit with status 77
   * for a test fail: exit with some status other than 0 or 120
 
-The Suite is arranged as such:
+The Suite is a re-worked version of the original test suite; it now is
+designed to work with Automake.  To run these tests you can do "make check"
+via the top-level Makefile.  This is also done automatically via
+"make distcheck".
 
-setup-test
-    Create the unit test framework.  This will re-generate your configure
-    script and make files.
+If you wish to write a new test, here are the steps:
 
-teardown-test
-    Remove the temporary files created as part of the unit tests.
+- Make sure your test script sources common.sh (the location of this script
+  is in the MH_TEST_COMMON environment variable and calls the setup_test
+  shell function (the other scripts have examples of this).
 
-runtest
-    Run a single test.
+- Your path will be set up to find the locations of the test nmh binaries.
 
-runalltests
-    Run all tests in the suite
+- Add your script to the TESTS variable in the toplevel Makefile.am.
 
-tests
-    Directory containing the tests.  All files found in this and all
-    subsequent directories which have the name test-* will be treated as a
-    single test.
+- If you need additional files for your tests, be sure to add them to
+  the EXTRA_DIST variable in Makefile.am.  Note that you should insure
+  that you access these files relative to the ${srcdir} environment variable.
 
-Complex tests may be given their own directory as long as there is a file
-named 'test-*' in the directory which will launch the test.
+- Verify that the test works with both "make check" and "make distcheck".
old mode 100644 (file)
new mode 100755 (executable)
similarity index 91%
rename from test/tests/bad-input/test-header
rename to test/bad-input/test-header
index b9e76a1..35d680a
@@ -5,6 +5,14 @@
 #
 ######################################################
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 # TODO: Move to a common file tests can source; need more framework...
 failed=0
 check() {
diff --git a/test/cleanup b/test/cleanup
new file mode 100755 (executable)
index 0000000..82b2261
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# This exists so "make check" will always clean up the "inst" directory
+# after a run, even if tests fail.  That way if you fix a problem and do
+# another "make check", you will get new binaries to test against.
+# 
+
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
+rm -rf ${MH_INST_DIR}
index c7d557a..4c7089c 100644 (file)
@@ -1,4 +1,5 @@
 # Common helper routines for test shell scripts -- intended to be sourced by them
+# @configure_input@
 
 output_md5()
 {
@@ -9,7 +10,7 @@ test_skip ()
 {
   WHY="$1"
   echo "$Test $0 SKIP ($WHY)"
-  exit 120
+  exit 77
 }
 
 # portable implementation of 'which' utility
@@ -56,3 +57,61 @@ progress_done ()
 {
   printf "100%%\n"
 }
+
+setup_test ()
+{
+  export MH=${MH_TEST_DIR}/Mail/.mh_profile
+  export MH_INST_DIR=${MH_TEST_DIR}/inst
+  export MHMTSCONF=${MH_INST_DIR}${sysconfdir}/mts.conf
+  export PATH=${MH_INST_DIR}${bindir}:${PATH}
+
+  if [ -z "${srcdir}" ]; then
+    echo "srcdir not set; aborting"
+    exit 1
+  fi
+
+  #
+  # Only do this once
+  #
+
+  if [ ! -d ${MH_INST_DIR}${bindir} ]; then
+    (cd ${MH_OBJ_DIR} && make DESTDIR=${MH_INST_DIR} install) || exit 1
+  fi
+
+  # clean old test data
+  trap "rm -rf $MH_TEST_DIR/Mail; exit \$status" 0
+  # setup test data
+  mkdir $MH_TEST_DIR/Mail || exit 1
+  cat > $MH <<EOF || exit 1
+Path: ${MH_TEST_DIR}/Mail
+mhlproc: ${MH_OBJ_DIR}/uip/mhl
+EOF
+
+  for f in MailAliases components digestcomps distcomps forwcomps mhl.body \
+          mhl.digest mhl.format mhl.forward mhl.headers mhl.reply \
+          rcvdistcomps replcomps replgroupcomps scan.MMDDYY \
+          scan.YYYYMMDD scan.default scan.mailx scan.nomime scan.size \
+          scan.time scan.timely scan.unseen
+  do
+    cp ${srcdir}/etc/${f} ${MH_TEST_DIR}/Mail || exit 1
+  done
+
+  for f in mhn.defaults mts.conf
+  do
+    cp ${MH_OBJ_DIR}/etc/${f} ${MH_TEST_DIR}/Mail || exit 1
+  done
+
+  folder -create +inbox > /dev/null
+  # create 10 basic messages
+  for i in 1 2 3 4 5 6 7 8 9 10;
+  do
+    cat > $MH_TEST_DIR/Mail/inbox/$i <<EOF || exit 1
+From: Test$i <test$i@example.com>
+To: Some User <user@example.com>
+Date: Fri, 29 Sep 2006 00:00:00
+Subject: Testing message $i
+
+This is message number $i
+EOF
+  done
+}
old mode 100644 (file)
new mode 100755 (executable)
similarity index 73%
rename from test/tests/folder/test-create
rename to test/folder/test-create
index 5b74b23..a3460ee
@@ -5,6 +5,14 @@
 #
 ######################################################
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 folder -create +testfolder > /dev/null
 if [ ! -d "$MH_TEST_DIR/Mail/testfolder" ]; then
     exit 1
old mode 100644 (file)
new mode 100755 (executable)
similarity index 65%
rename from test/tests/folder/test-total
rename to test/folder/test-total
index ff29310..86b304f
@@ -5,6 +5,14 @@
 #
 ######################################################
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 output=`folder -total +inbox`
 if test x"$output" != x'TOTAL = 10 messages in 1 folder.' ; then
     exit 1
similarity index 100%
rename from test/tests/inc/md5sums
rename to test/inc/md5sums
old mode 100644 (file)
new mode 100755 (executable)
similarity index 85%
rename from test/tests/inc/test-deb359167
rename to test/inc/test-deb359167
index ef0abc8..26aea11
@@ -2,9 +2,11 @@
 # Test a variant of a mailbox which caused debian bug 359167.
 set -e
 
-. $MH_TEST_COMMON
+. ${MH_TEST_COMMON}
 
-THISDIR="tests/inc"
+setup_test
+
+THISDIR="${srcdir}/test/inc"
 
 require_prog valgrind
 
old mode 100644 (file)
new mode 100755 (executable)
similarity index 98%
rename from test/tests/inc/test-eom-align
rename to test/inc/test-eom-align
index 2c1c67e..c0cae7c
@@ -4,9 +4,11 @@
 
 set -e
 
-. $MH_TEST_COMMON
+. ${MH_TEST_COMMON}
 
-THISDIR="tests/inc"
+setup_test
+
+THISDIR="${srcdir}/test/inc"
 
 if [ ! -z "$VALGRIND_ME" ]; then
     require_prog valgrind
old mode 100644 (file)
new mode 100755 (executable)
similarity index 91%
rename from test/tests/manpages/test-manpages
rename to test/manpages/test-manpages
index f7acc69..7c221ba
@@ -6,11 +6,13 @@
 #
 ######################################################
 
-. $MH_TEST_COMMON
+. ${MH_TEST_COMMON}
+
+setup_test
 
 require_prog groff
 
-cd $MH_TEST_DIR/share/man
+cd ${MH_INST_DIR}${mandir} || exit 1
 
 # groff will still exit with status zero even if warnings
 # were emitted, so we have to jump through hoops to
old mode 100644 (file)
new mode 100755 (executable)
similarity index 94%
rename from test/tests/mhbuild/test-forw
rename to test/mhbuild/test-forw
index 1dece26..c92242f
@@ -5,6 +5,14 @@
 #
 ######################################################
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 # TODO: Move to a common file tests can source; need more framework...
 failed=0
 check() {
old mode 100644 (file)
new mode 100755 (executable)
similarity index 87%
rename from test/tests/mhshow/test-cte-binary
rename to test/mhshow/test-cte-binary
index 26b0f08..e5654bb
@@ -5,6 +5,13 @@
 #
 ######################################################
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
 expected=$MH_TEST_DIR/$$.expected
 actual=$MH_TEST_DIR/$$.actual
 
old mode 100644 (file)
new mode 100755 (executable)
similarity index 89%
rename from test/tests/mhshow/test-qp
rename to test/mhshow/test-qp
index ae6ec05..c19a343
@@ -7,6 +7,14 @@
 
 set -e
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 expected=$MH_TEST_DIR/$$.expected
 actual=$MH_TEST_DIR/$$.actual
 
old mode 100644 (file)
new mode 100755 (executable)
similarity index 89%
rename from test/tests/mhshow/test-subpart
rename to test/mhshow/test-subpart
index 269c9f4..9d8fe29
@@ -8,6 +8,14 @@
 
 set -e
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 expected=$MH_TEST_DIR/$$.expected
 actual=$MH_TEST_DIR/$$.actual
 
old mode 100644 (file)
new mode 100755 (executable)
similarity index 96%
rename from test/tests/new/test-basic
rename to test/new/test-basic
index 772b72f..3b2befd
@@ -1,5 +1,12 @@
 #!/bin/sh
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
 # TODO: Move to a common file tests can source; need more framework...
 failed=0
 check() {
old mode 100644 (file)
new mode 100755 (executable)
similarity index 71%
rename from test/tests/pick/test-stderr
rename to test/pick/test-stderr
index 35a64ef..f3212da
@@ -5,6 +5,14 @@
 #
 ######################################################
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 expected_err=$MH_TEST_DIR/$$.expected_err
 expected_out=$MH_TEST_DIR/$$.expected_out
 actual_err=$MH_TEST_DIR/$$.actual_err
@@ -20,5 +28,5 @@ EOF
 cat /dev/null > $expected_out
 
 pick -a > $actual_out 2> $actual_err
-diff -u $expected_err $actual_err
-diff -u $expected_out $actual_out
+diff -u $expected_err $actual_err || exit 1
+diff -u $expected_out $actual_out || exit 1
old mode 100644 (file)
new mode 100755 (executable)
similarity index 85%
rename from test/tests/repl/test-if-str
rename to test/repl/test-if-str
index 7582a7d..6bc0e09
@@ -8,6 +8,14 @@
 #
 ######################################################
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 # create test replgroupcomps
 form=$MH_TEST_DIR/$$.replgroupcomps
 cat > $form <<EOF
@@ -31,6 +39,6 @@ Test1 writes:
 > This is message number 1
 EOF
 
-repl -editor true -format -form $form -group -nocc me -nowhatnowproc 1
+repl -editor true -format -form $form -group -nocc me -nowhatnowproc 1 || exit 1
 
 diff -u $expected $actual
diff --git a/test/runalltests b/test/runalltests
deleted file mode 100755 (executable)
index 48ba7f1..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# Get full pathnames that we'll need.
-cd `dirname $0`
-testdir=`pwd`
-
-# Always run setup-test in case the code or configuration has changed.
-./setup-test
-
-status=0
-
-# Note that we ignore *~ files as these are probably editor backups.
-for i in `find . -name 'test-*[!~]' -type f`
-do
-    $testdir/runtest $i || status=$?
-done
-
-exit $status
diff --git a/test/runtest b/test/runtest
deleted file mode 100755 (executable)
index f23608b..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/sh
-
-status=1
-
-[ $# -eq 1 ]  ||  echo "usage: $0 "'<testname>'
-
-# Get full pathnames that we'll need.
-cd `dirname $0`
-
-export MH_TEST_DIR=`pwd`/testinstall
-export MH=$MH_TEST_DIR/Mail/.mh_profile
-export PATH=$MH_TEST_DIR/bin:$PATH
-export MH_TEST_COMMON=$PWD/common.sh
-
-[ -d $MH_TEST_DIR ] || ./setup-test
-
-# clean old test data
-trap "rm -rf $MH_TEST_DIR/Mail; exit \$status" 0
-# setup test data
-rm -rf $MH_TEST_DIR/Mail
-mkdir $MH_TEST_DIR/Mail
-echo "Path: $MH_TEST_DIR/Mail" > $MH
-folder -create +inbox > /dev/null
-# create 10 basic messages
-for i in 1 2 3 4 5 6 7 8 9 10;
-do
-    cat > $MH_TEST_DIR/Mail/inbox/$i <<EOF
-From: Test$i <test$i@example.com>
-To: Some User <user@example.com>
-Date: Fri, 29 Sep 2006 00:00:00
-Subject: Testing message $i
-
-This is message number $i
-EOF
-done
-
-# now run the test
-set +e
-/bin/sh $1
-return_value=$?
-set -e
-
-if [ $return_value -eq 0 ]; then
-    echo Test $1 PASS
-    status=0
-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
old mode 100644 (file)
new mode 100755 (executable)
similarity index 85%
rename from test/tests/scan/test-scan
rename to test/scan/test-scan
index 780a69d..1b688e0
@@ -5,6 +5,14 @@
 #
 ######################################################
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 expected=$MH_TEST_DIR/$$.expected
 actual=$MH_TEST_DIR/$$.actual
 
@@ -21,6 +29,6 @@ cat > $expected <<EOF
   10  09/29 Test10             Testing message 10<<This is message number 10 >>
 EOF
 
-scan -width 80 +inbox > $actual
+scan -width 80 +inbox > $actual || exit 1
 
 diff -u $expected $actual
diff --git a/test/setup-test b/test/setup-test
deleted file mode 100755 (executable)
index bf405f3..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-#
-# Copy our sources and configuration, but change the installation
-# prefix so that we can test with a completely independent
-# installation.
-
-# Get full pathnames that we'll need.  Assumes that this script is
-# located in the nmh test subdirectory.
-cd `dirname $0`
-testdir=`pwd`
-srcdir=`dirname $testdir`
-builddir=$testdir/testbuild
-installdir=$testdir/testinstall
-
-#### Set up builddir.
-[ -d $builddir ]  ||  mkdir -p $builddir
-cd $builddir
-
-#### Expedient way to copy the sources and configuration.
-if rsync -h >/dev/null 2>&1; then
-  rsync -a $srcdir/ --exclude .git --exclude test --exclude .deps \
-                    --exclude '*.gz' --exclude '*.*o' .
-else
-  (cd $srcdir && tar cf - \
-    `find . -name .git -prune -o -name test -prune -o -name .deps -prune -o \
-       \( ! -type d ! -name '*.gz' ! -name '*.*o' -print \)`) | \
-  tar xpf -
-fi
-
-#### Set up new configuration.
-#### Put it in a file so we don't have to mess with shell quoting.  It
-#### would get tricky with configure options that can contain embedded
-#### spaces, such as --enable-masquerade and --with-smtpservers.
-reconfig=reconfig-for-test
-echo 'set '/bin/sh' './configure' \' > $reconfig
-#### Configure allows multiple --prefix but ignores all but the last.
-#### So add the one we want to use.  This is easier than trying to change
-#### an existing --prefix, esp. if it has quoted characters.
-echo $(./config.status --config) \'--prefix="$installdir"\' >> $reconfig
-echo 'exec "$@"' >> $reconfig
-
-echo configuring the test installation in "$installdir" . . .
-/bin/sh $reconfig > /dev/null
-
-echo building the test installation . . .
-make install > /dev/null
diff --git a/test/teardown-test b/test/teardown-test
deleted file mode 100755 (executable)
index 5dec4ab..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-# Get full pathnames that we'll need.
-testdir=`dirname $0`
-builddir=$testdir/testbuild
-testinstalldir=$testdir/testinstall
-
-rm -rf $builddir $testinstalldir
old mode 100644 (file)
new mode 100755 (executable)
similarity index 86%
rename from test/tests/whatnow/test-attach-detach
rename to test/whatnow/test-attach-detach
index 1a36d8d..4314553
@@ -6,6 +6,14 @@
 #
 ######################################################
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 set -e
 
 cd "$MH_TEST_DIR"
@@ -34,5 +42,5 @@ echo "detach baz\\'s\\ boz" | whatnow -attach foo -noedit -prompt '' 2>> $actual
 echo "alist" | whatnow -attach foo -noedit -prompt '' 2>> $actualerr >> $actual
 set -e
 
-diff -u $expectederr $actualerr
+diff -u $expectederr $actualerr || exit 1
 diff -u $expected $actual
old mode 100644 (file)
new mode 100755 (executable)
similarity index 81%
rename from test/tests/whatnow/test-cd
rename to test/whatnow/test-cd
index 3e0ddc4..d92f334
@@ -6,6 +6,14 @@
 #
 ######################################################
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 set -e
 SPDIR="$MH_TEST_DIR/foo's bar"
 rm -rf "$SPDIR"
@@ -30,5 +38,5 @@ EOF
 # watch the quoting -- shell and printf and then the shell run inside whatnow
 printf "cd $MH_TEST_DIR/foo\\\\'s\\\\ bar\npwd\n" | whatnow -noedit -prompt '' 2> "$actualerr" > "$actual" || true
 
-diff -u $expectederr $actualerr
+diff -u $expectederr $actualerr || exit 1
 diff -u $expected $actual
old mode 100644 (file)
new mode 100755 (executable)
similarity index 79%
rename from test/tests/whatnow/test-ls
rename to test/whatnow/test-ls
index e0dc969..58ee2f6
@@ -6,6 +6,14 @@
 #
 ######################################################
 
+if [ -z "${MH_TEST_COMMON}" ]; then
+    echo "MH_TEST_COMMON not set; try running via 'make check'"
+fi
+
+. ${MH_TEST_COMMON}
+
+setup_test
+
 set -e
 SPDIR="$MH_TEST_DIR/foo's bar"
 rm -rf "$SPDIR"
@@ -29,5 +37,5 @@ EOF
 # NB use of sort as the order of output of ls is not guaranteed
 echo 'ls' | whatnow -noedit -prompt '' 2> "$actualerr" | sort > "$actual"
 
-diff -u $expectederr $actualerr
+diff -u $expectederr $actualerr || exit 1
 diff -u $expected $actual