[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated
From: |
David Levine |
Subject: |
[Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated. dc1f54e0b883f7deec844b7acd87d5c9ad9b306d |
Date: |
Tue, 07 Feb 2012 03:21:31 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The nmh Mail Handling System".
The branch, master has been updated
via dc1f54e0b883f7deec844b7acd87d5c9ad9b306d (commit)
from a7ce6ecebce9ee549a8367f048ef5468ef16768c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=dc1f54e0b883f7deec844b7acd87d5c9ad9b306d
commit dc1f54e0b883f7deec844b7acd87d5c9ad9b306d
Author: David Levine <address@hidden>
Date: Mon Feb 6 21:19:57 2012 -0600
Reworked test suite to copy the configuration used in the main
nmh directory. Added test target to Makefile. Not all the tests
pass at this point.
diff --git a/.gitignore b/.gitignore
index 056ea5e..44bc82f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,6 +44,8 @@ a.out.DSYM/
/mts/libmts.a
/sbr/*.a
/sbr/sigmsg.h
+/test/testbuild
+/test/testinstall
/uip/ali
/uip/anno
/uip/ap
diff --git a/Makefile.am b/Makefile.am
index fc2e621..56178f9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,12 +31,27 @@ MHNSEARCHPROG = $(srcdir)/etc/mhn.find.sh
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* \*
+
+##
## Stuff that should be cleaned via "make clean"
##
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
##
## Stuff that should be cleaned via "make maintainer-clean"
@@ -479,6 +494,11 @@ man/man.sed: Makefile
.man.$(manext8):
$(SED) -f man/man.sed $< > $@
+test: all
+ @test -d $(testdir)/testinstall || $(testdir)/setup-test
+ @$(testdir)/runalltests
+.PHONY: test
+
## Don't include commit hashes in ChangeLog.
ChangeLog:
@[ -d .git ] && git --no-pager log --abbrev-commit | \
diff --git a/test/runalltests b/test/runalltests
index 0497c52..340be0a 100755
--- a/test/runalltests
+++ b/test/runalltests
@@ -1,7 +1,17 @@
#!/bin/sh
-# Note that we ignore *~ files as these are probably editor backups
-for i in `find tests -name 'test-*[!~]' -type f`;
+status=0
+
+# Get full pathnames that we'll need.
+cd `dirname $0`
+testdir=`pwd`
+
+test -d testinstall || ./setup-test
+
+# Note that we ignore *~ files as these are probably editor backups.
+for i in `find . -name 'test-*[!~]' -type f`
do
- ./runtest $i
+ $testdir/runtest $i || status=$?
done
+
+exit $status
diff --git a/test/runtest b/test/runtest
index 0b18653..5cfc158 100755
--- a/test/runtest
+++ b/test/runtest
@@ -1,28 +1,23 @@
#!/bin/sh
-set -e
-
-if [ ! -e test-temp-dir ]; then
- echo "test-temp-dir not found: running setup-test"
- ./setup-test
-fi
+status=1
-export MH_TEST_DIR=`cat test-temp-dir`
+[ $# -eq 1 ] || echo "usage: $0 "'<testname>'
-if [ ! -e "$MH_TEST_DIR/bld/Makefile" ]; then
- echo "temporary directory missing or broken: running setup-test"
- ./setup-test
- export MH_TEST_DIR=`cat test-temp-dir`
-fi
+# 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
-rm -rf $MH_TEST_DIR/Mail
+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
@@ -45,8 +40,9 @@ set +e
return_value=$?
set -e
-if [ $return_value -eq 0 ] ; then
+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,
diff --git a/test/setup-test b/test/setup-test
index fab26a0..bf405f3 100755
--- a/test/setup-test
+++ b/test/setup-test
@@ -1,22 +1,46 @@
#!/bin/sh
+#
+# Copy our sources and configuration, but change the installation
+# prefix so that we can test with a completely independent
+# installation.
-set -e
+# 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
-if TEMPDIR=`cat test-temp-dir 2> /dev/null` \
- && [ -e $TEMPDIR/bld/Makefile ]; then
- (cd $TEMPDIR/bld && make all install)
- exit
+#### 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
-TEMPDIR=`mktemp -d /tmp/nmh-test-XXXXXXXX`
-echo $TEMPDIR > test-temp-dir
+#### 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
-cd ..
-if ! [ -e configure ]; then
- ./autogen.sh
-fi
-srcdir=$PWD
-mkdir $TEMPDIR/bld
-cd $TEMPDIR/bld
-$srcdir/configure --prefix=$TEMPDIR --with-locking=fcntl --enable-debug
-make install
+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
index 7e169e4..5dec4ab 100755
--- a/test/teardown-test
+++ b/test/teardown-test
@@ -1,4 +1,8 @@
#!/bin/sh
-rm -rf `cat test-temp-dir`
-rm -f test-temp-dir
+# Get full pathnames that we'll need.
+testdir=`dirname $0`
+builddir=$testdir/testbuild
+testinstalldir=$testdir/testinstall
+
+rm -rf $builddir $testinstalldir
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 2 +
Makefile.am | 20 ++++++++++++++++++
test/runalltests | 16 ++++++++++++--
test/runtest | 26 ++++++++++-------------
test/setup-test | 56 +++++++++++++++++++++++++++++++++++++--------------
test/teardown-test | 8 +++++-
6 files changed, 92 insertions(+), 36 deletions(-)
hooks/post-receive
--
The nmh Mail Handling System
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Nmh-commits] [SCM] The nmh Mail Handling System branch, master, updated. dc1f54e0b883f7deec844b7acd87d5c9ad9b306d,
David Levine <=