dovecot-2.2: dovecot.m4: External plugins can now more easily ru...

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 10 11:12:57 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/d938a49c2045
changeset: 18239:d938a49c2045
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 10 13:12:42 2015 +0200
description:
dovecot.m4: External plugins can now more easily run their tests via Valgrind.
DC_DOVECOT macro automatically adds RUN_TEST variable to Makefiles, which
can be used to call any test programs. If valgrind exists, the tests are run
through it. This is done by writing run-test.sh to the build directory, so
the original run-test.sh in hg is no longer needed.

diffstat:

 .hgignore    |   1 +
 configure.ac |   8 +-------
 dovecot.m4   |  30 ++++++++++++++++++++++++++++++
 run-test.sh  |  15 ---------------
 4 files changed, 32 insertions(+), 22 deletions(-)

diffs (93 lines):

diff -r 43a61a8bf9c5 -r d938a49c2045 .hgignore
--- a/.hgignore	Tue Feb 10 12:31:12 2015 +0200
+++ b/.hgignore	Tue Feb 10 13:12:42 2015 +0200
@@ -36,6 +36,7 @@
 ChangeLog
 Makefile
 Makefile.in
+run-test.sh
 
 *.o
 *.lo
diff -r 43a61a8bf9c5 -r d938a49c2045 configure.ac
--- a/configure.ac	Tue Feb 10 12:31:12 2015 +0200
+++ b/configure.ac	Tue Feb 10 13:12:42 2015 +0200
@@ -2816,13 +2816,7 @@
 fi
 AC_SUBST(docdir)
 
-AC_CHECK_PROG(VALGRIND, valgrind, yes, no)
-if test $VALGRIND = yes; then
-  RUN_TEST='$(SHELL) $(top_srcdir)/run-test.sh'
-else
-  RUN_TEST=''
-fi
-AC_SUBST(RUN_TEST)
+DC_DOVECOT_TEST_WRAPPER
 AC_SUBST(abs_top_builddir)
 
 AC_CONFIG_HEADERS([config.h])
diff -r 43a61a8bf9c5 -r d938a49c2045 dovecot.m4
--- a/dovecot.m4	Tue Feb 10 12:31:12 2015 +0200
+++ b/dovecot.m4	Tue Feb 10 13:12:42 2015 +0200
@@ -31,6 +31,35 @@
 	unset _plugin_deps
 ])
 
+AC_DEFUN([DC_DOVECOT_TEST_WRAPPER],[
+  AC_CHECK_PROG(VALGRIND, valgrind, yes, no)
+  if test $VALGRIND = yes; then
+    cat > run-test.sh <<EOF
+#!/bin/sh
+top_srcdir=\$[1]
+shift
+
+trap "rm -f test.out.\$\$" 0 1 2 3 15
+supp_path="\$top_srcdir/run-test-valgrind.supp"
+if test -r "\$supp_path"; then
+  valgrind -q --suppressions="\$supp_path" --log-file=test.out.\$\$ \$[*]
+else
+  valgrind -q --log-file=test.out.\$\$ \$[*]
+fi
+ret=\$?
+if test -s test.out.\$\$; then
+  cat test.out.\$\$
+  exit 1
+fi
+exit \$ret
+EOF
+    RUN_TEST='$(SHELL) $(top_builddir)/run-test.sh $(top_srcdir)'
+  else
+    RUN_TEST=''
+  fi
+  AC_SUBST(RUN_TEST)
+])
+
 # Substitute every var in the given comma seperated list
 AC_DEFUN([AX_SUBST_L],[
 	m4_foreach([__var__], [$@], [AC_SUBST(__var__)])
@@ -92,4 +121,5 @@
 	AX_SUBST_L([LIBDOVECOT_INCLUDE], [LIBDOVECOT_LDA_INCLUDE], [LIBDOVECOT_DOVEADM_INCLUDE], [LIBDOVECOT_SERVICE_INCLUDE], [LIBDOVECOT_STORAGE_INCLUDE], [LIBDOVECOT_LOGIN_INCLUDE], [LIBDOVECOT_CONFIG_INCLUDE], [LIBDOVECOT_IMAP_INCLUDE], [LIBDOVECOT_DSYNC_INCLUDE])
 
 	DC_PLUGIN_DEPS
+	DC_DOVECOT_TEST_WRAPPER
 ])
diff -r 43a61a8bf9c5 -r d938a49c2045 run-test.sh
--- a/run-test.sh	Tue Feb 10 12:31:12 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-trap "rm -f test.out.$$" 0 1 2 3 15
-supp_path="`dirname $0`/run-test-valgrind.supp"
-if [ -r "$supp_path" ]; then
-  valgrind -q --suppressions="$supp_path" --log-file=test.out.$$ $*
-else
-  valgrind -q --log-file=test.out.$$ $*
-fi
-ret=$?
-if [ -s test.out.$$ ]; then
-  cat test.out.$$
-  exit 1
-fi
-exit $ret


More information about the dovecot-cvs mailing list