Add test for `AM_WITH_DMALLOC' macro.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 21 Sep 2010 10:54:25 +0000 (12:54 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 4 Oct 2010 16:56:47 +0000 (18:56 +0200)
* tests/dmalloc.test: New test.
* tests/Makefile.am (TESTS): Update.

ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/dmalloc.test [new file with mode: 0755]

index 03187aa..858f06f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-10-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       Add test for `AM_WITH_DMALLOC' macro.
+       * tests/dmalloc.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
        Fix nits and bugs in tests `help*.test'.
        * tests/help4.test: Fix broken sed commands used to strip `-W...'
        flags away from "$AUTOMAKE" and "$ACLOCAL".
index 6c6f24f..acc7640 100644 (file)
@@ -284,6 +284,7 @@ distdir.test \
 distlinks.test \
 distlinksbrk.test \
 distname.test \
+dmalloc.test \
 dollar.test \
 dollarvar.test \
 dollarvar2.test \
index a9b1cbb..117f2ba 100644 (file)
@@ -551,6 +551,7 @@ distdir.test \
 distlinks.test \
 distlinksbrk.test \
 distname.test \
+dmalloc.test \
 dollar.test \
 dollarvar.test \
 dollarvar2.test \
diff --git a/tests/dmalloc.test b/tests/dmalloc.test
new file mode 100755 (executable)
index 0000000..629c949
--- /dev/null
@@ -0,0 +1,61 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Simple checks on the `AM_WITH_DMALLOC' macro.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_HEADERS([config.h])
+AM_WITH_DMALLOC
+AC_SUBST([LDFLAGS])
+AC_OUTPUT
+END
+
+cat > config.h.in <<'END'
+#undef WITH_DMALLOC
+END
+
+cat > Makefile.am <<'END'
+check-with-dmalloc:
+## The AM_WITH_DMALLOC assumes that the user is a developer, so that
+## he is expected to install and make available the `dmalloc' library
+## by his own.  So we just check that proper linker and libs flags get
+## added.
+       echo ' ' $(LDFLAGS) ' ' | grep ' -g '
+       echo ' ' $(LIBS) ' ' | grep ' -ldmalloc '
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+cat config.h # debug info
+grep '^ */\* *# *undef  *WITH_DMALLOC *\*/ *$' config.h
+
+./configure --without-dmalloc
+cat config.h # debug info
+grep '^ */\* *# *undef  *WITH_DMALLOC *\*/ *$' config.h
+
+./configure --with-dmalloc
+cat config.h # debug info
+grep '^# *define  *WITH_DMALLOC  *1 *$' config.h
+$MAKE check-with-dmalloc
+
+: