automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FYI] {testsuite-work} tests: minor optimizations/simplifications in som


From: Stefano Lattarini
Subject: [FYI] {testsuite-work} tests: minor optimizations/simplifications in some aclocal tests
Date: Sun, 11 Sep 2011 00:25:06 +0200

* acloca11.test: Instead of running ./configure and then grepping
the file it has produced, directly grep configure.  Add trailing
`:' command.
* acloca12.test: Likewise.
* acloca10.test: Likewise.  Also, remove the autom4te caches
by hand, instead of sleeping to ensure they get outdated and
ignored.
* aclocal9.test: Likewise.
* acloca18.test: Likewise.  Also, do not remove file `foo',
which is not being created anymore.
* acloca20.test: The test makes sense only if the system support
real symlinks, so skip it if this is not the case.  This allows
for various simplifications.
---
 ChangeLog           |   17 ++++++++++++++
 tests/acloca10.test |   46 +++++++++++++++++++--------------------
 tests/acloca11.test |   13 ++++++-----
 tests/acloca12.test |   15 +++++++------
 tests/acloca18.test |   59 ++++++++++++++++++++------------------------------
 tests/acloca20.test |   41 +++++++++++++----------------------
 tests/aclocal9.test |   20 ++++++++--------
 7 files changed, 103 insertions(+), 108 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5c68330..e1e3d89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2011-09-10  Stefano Lattarini  <address@hidden>
 
+       tests: minor optimizations/simplifications in some aclocal tests
+       * acloca11.test: Instead of running ./configure and then grepping
+       the file it has produced, directly grep configure.  Add trailing
+       `:' command.
+       * acloca12.test: Likewise.
+       * acloca10.test: Likewise.  Also, remove the autom4te caches
+       by hand, instead of sleeping to ensure they get outdated and
+       ignored.
+       * aclocal9.test: Likewise.
+       * acloca18.test: Likewise.  Also, do not remove file `foo',
+       which is not being created anymore.
+       * acloca20.test: The test makes sense only if the system support
+       real symlinks, so skip it if this is not the case.  This allows
+       for various simplifications.
+
+2011-09-10  Stefano Lattarini  <address@hidden>
+
        prove: avoid weird signal-related bug
        * tests/defs (trap): In the trap code dealing with SIGPIPE
        signal, ignore further signals of the same kind.
diff --git a/tests/acloca10.test b/tests/acloca10.test
index 0041d57..1121703 100755
--- a/tests/acloca10.test
+++ b/tests/acloca10.test
@@ -28,8 +28,8 @@ am_create_testdir=empty
 
 cat > configure.in << 'END'
 AC_INIT
-MACRO2
 MACRO1
+MACRO2
 MACRO3
 END
 
@@ -39,61 +39,59 @@ mkdir m4_1 m4_2 acdir acdir2
 echo ./acdir2 > acdir/dirlist
 
 cat >m4_1/somedefs.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro11 >> foo])
-AC_DEFUN([MACRO2], [echo macro21 > foo])
+AC_DEFUN([MACRO1], [:macro11:])
+AC_DEFUN([MACRO2], [:macro21:])
 EOF
 
 cat >m4_2/somedefs.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro12 >> foo])
+AC_DEFUN([MACRO1], [:macro12:])
 EOF
 
 cat >acdir2/macro.m4 <<EOF
-AC_DEFUN([MACRO3], [echo macro3 >> foo])
+AC_DEFUN([MACRO3], [:macro33:])
 EOF
 
 $ACLOCAL -I m4_1 -I m4_2
 $AUTOCONF
-./configure
-grep macro11 foo
-grep macro21 foo
-grep macro3 foo
+$FGREP ':macro11:' configure
+$FGREP ':macro21:' configure
+$FGREP ':macro33:' configure
 grep MACRO3 aclocal.m4
 test ! -f m4_1/macro.m4
 test ! -f m4_2/macro.m4
 
-$sleep
+rm -rf autom4te*.cache
 $ACLOCAL -I m4_2 -I m4_1
 $AUTOCONF
-./configure
-grep macro12 foo
-grep macro21 foo
-grep macro3 foo
+$FGREP ':macro12:' configure
+$FGREP ':macro21:' configure
+$FGREP ':macro33:' configure
 grep MACRO3 aclocal.m4
 test ! -f m4_1/macro.m4
 test ! -f m4_2/macro.m4
 
-$sleep
+rm -rf autom4te*.cache
 $ACLOCAL -I m4_1 -I m4_2 --install
 $AUTOCONF
-./configure
-grep macro11 foo
-grep macro21 foo
-grep macro3 foo
+$FGREP ':macro11:' configure
+$FGREP ':macro21:' configure
+$FGREP ':macro33:' configure
 grep MACRO3 aclocal.m4 && Exit 1
 test -f m4_1/macro.m4
 test ! -f m4_2/macro.m4
 cp aclocal.m4 copy.m4
 
-$sleep
+rm -rf autom4te*.cache
 echo '#GREPME' >>acdir2/macro.m4
 $ACLOCAL -I m4_1 -I m4_2 --install
 $AUTOCONF
-./configure
-grep macro11 foo
-grep macro21 foo
-grep macro3 foo
+$FGREP ':macro11:' configure
+$FGREP ':macro21:' configure
+$FGREP ':macro33:' configure
 grep MACRO3 aclocal.m4 && Exit 1
 grep GREPME m4_1/macro.m4 && Exit 1
 test -f m4_1/macro.m4
 test ! -f m4_2/macro.m4
 diff aclocal.m4 copy.m4
+
+:
diff --git a/tests/acloca11.test b/tests/acloca11.test
index ddb9156..7ce0a4d 100755
--- a/tests/acloca11.test
+++ b/tests/acloca11.test
@@ -29,16 +29,17 @@ END
 mkdir m4
 
 cat >m4/version1.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro11 >> foo])
-AC_DEFUN([MACRO2], [echo macro21 > foo])
+AC_DEFUN([MACRO1], [:macro11:])
+AC_DEFUN([MACRO2], [:macro21:])
 EOF
 
 cat >m4/version2.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro12 >> foo])
+AC_DEFUN([MACRO1], [:macro12:])
 EOF
 
 $ACLOCAL -I m4
 $AUTOCONF
-./configure
-grep macro12 foo
-grep macro21 foo
+$FGREP ':macro12:' configure
+$FGREP ':macro21:' configure
+
+:
diff --git a/tests/acloca12.test b/tests/acloca12.test
index d4d1464..4e4f30f 100755
--- a/tests/acloca12.test
+++ b/tests/acloca12.test
@@ -29,17 +29,18 @@ END
 mkdir m4
 
 cat >m4/version1.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro11 >> foo])
-AC_DEFUN([MACRO2], [echo macro21 > foo])
+AC_DEFUN([MACRO1], [:macro11:])
+AC_DEFUN([MACRO2], [:macro21:])
 EOF
 
 cat >m4/version2.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro12 >> foo])
+AC_DEFUN([MACRO1], [:macro12:])
 EOF
 
 $ACLOCAL --verbose -I m4
 $AUTOCONF
-./configure
-grep macro11 foo && Exit 1
-grep macro21 foo && Exit 1
-grep macro12 foo
+$FGREP ':macro11:' configure && Exit 1
+$FGREP ':macro21:' configure && Exit 1
+$FGREP ':macro12:' configure
+
+:
diff --git a/tests/acloca18.test b/tests/acloca18.test
index f68303d..6c4798f 100755
--- a/tests/acloca18.test
+++ b/tests/acloca18.test
@@ -30,96 +30,85 @@ mkdir 1 2 3 4 5 6
 
 cat >1/m1.m4 <<EOF
 #serial 1.8.1230.9
-AC_DEFUN([AM_MACRO1], [echo macro11 >> foo])
-AC_DEFUN([AM_MACRO2], [echo macro21 >> foo])
+AC_DEFUN([AM_MACRO1], [:macro11:])
+AC_DEFUN([AM_MACRO2], [:macro21:])
 EOF
 
 cat >2/m1.m4 <<EOF
 #serial 1.8.1231.9
-AC_DEFUN([AM_MACRO1], [echo macro12 >> foo])
+AC_DEFUN([AM_MACRO1], [:macro12:])
 EOF
 
 cat >3/m2.m4 <<EOF
 #serial 13
-AC_DEFUN([AM_MACRO2], [echo macro23 >> foo])
+AC_DEFUN([AM_MACRO2], [:macro23:])
 EOF
 
 cat >3/m1.m4 <<EOF
 #serial 1.8.1230.1
-AC_DEFUN([AM_MACRO1], [echo macro13 >> foo])
+AC_DEFUN([AM_MACRO1], [:macro13:])
 EOF
 
 cat >4/mumble.m4 <<EOF
 #serial 0
-AC_DEFUN([AM_MACRO1], [echo macro14 >> foo])
+AC_DEFUN([AM_MACRO1], [:macro14:])
 EOF
 
 cat >5/ill-formed.m4 <<EOF
 #serial bla
 #serial .2
 #serial
-AC_DEFUN([AM_MACRO1], [echo macro15 >> foo])
+AC_DEFUN([AM_MACRO1], [:macro15:])
 EOF
 
 cat >6/after-def.m4 <<EOF
-AC_DEFUN([AM_MACRO1], [echo macro16 >> foo])
+AC_DEFUN([AM_MACRO1], [:macro16:])
 #serial 1
 EOF
 
 $ACLOCAL -I 1 -I 2 -I 3 -I 4
 $AUTOCONF
-./configure
-grep macro11 foo
-grep macro21 foo
+$FGREP ':macro11:' configure
+$FGREP ':macro21:' configure
 
-$sleep
-rm -f foo
+rm -rf autom4te*.cache
 $ACLOCAL  -I 1 -I 2 -I 3 -I 4 --install
 $AUTOCONF
-./configure
-grep macro12 foo
-grep macro23 foo
+$FGREP ':macro12:' configure
+$FGREP ':macro23:' configure
 
-$sleep
-rm -f foo
+rm -rf autom4te*.cache
 $ACLOCAL -I 4 -I 1 -I 2 -I 3 --install --dry-run
 $AUTOCONF
-./configure
-grep macro12 foo
-grep macro23 foo
+$FGREP ':macro12:' configure
+$FGREP ':macro23:' configure
 
-$sleep
-rm -f foo
+rm -rf autom4te*.cache
 $ACLOCAL -I 4 -I 1 -I 2 -I 3 --install
 $AUTOCONF
-./configure
-grep macro14 foo
-grep macro23 foo
+$FGREP ':macro14:' configure
+$FGREP ':macro23:' configure
 
-$sleep
-rm -f foo
+rm -rf autom4te*.cache
 $ACLOCAL -I 4 -I 1 -I 2 --install 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep 'macro.*AM_MACRO2.*not found' stderr
 
-$sleep
-rm -f foo
+rm -rf autom4te*.cache
 $ACLOCAL -I 4 -I 1 --install
 $AUTOCONF
-./configure
-grep macro14 foo
-grep macro21 foo
+$FGREP ':macro14:' configure
+$FGREP ':macro21:' configure
 
 mkdir acdir
 ACLOCAL="$ACLOCAL --system-acdir acdir"
 
-$sleep
+rm -rf autom4te*.cache
 cat >acdir/m1.m4 <<EOF
 #serial 456
 AC_DEFUN([AM_MACRO1], [echo macro1d >> foo])
 AC_DEFUN([AM_MACRO2], [echo macro2d >> foo])
 EOF
-rm -f foo
 $ACLOCAL -I 4 -I 1 --diff=diff >stdout 2>stderr || {
   cat stderr >&2
   cat stdout
diff --git a/tests/acloca20.test b/tests/acloca20.test
index 064fcde..4516d69 100755
--- a/tests/acloca20.test
+++ b/tests/acloca20.test
@@ -19,34 +19,23 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
-cat >foo.m4 <<'END'
-m4_define([FOO], [echo wrong foo])
-END
-
-cat >doit.in <<'END'
address@hidden@ foo.m4 aclocal.m4
-END
-
-cat >configure.in <<'END'
-AC_INIT([acloca20], [1.0])
-AC_PROG_LN_S
-dnl FOO
-AC_CONFIG_FILES([doit], [chmod +x doit])
-AC_OUTPUT
-END
+echo 'm4_define([FOO], [wrong foo])' > foo.m4
+echo 'm4_define([FOO], [right foo])' > acinclude.m4
+echo 'AC_INIT FOO' > configure.in
 
-$AUTOCONF
-./configure
-./doit
-grep 'wrong foo' aclocal.m4
+chmod a-w foo.m4
+
+# Setup.
+ln -s foo.m4 aclocal.m4 && test -h aclocal.m4 \
+  || skip_ "cannot create symlinks to files"
 
-cat >acinclude.m4 <<'END'
-m4_define([FOO], [echo right foo])
-END
-sed 's/dnl //' <configure.in >configure.int
-mv -f configure.int configure.in
+# Sanity check.
+grep 'wrong foo' aclocal.m4 \
+  || fatal_ "weird error symlinking aclocal.m4 -> foo.m4"
 
 $ACLOCAL
-$AUTOCONF --force
-./configure | grep 'right foo'
+$AUTOCONF
+grep 'right foo' configure
 grep 'wrong foo' foo.m4
+
+:
diff --git a/tests/aclocal9.test b/tests/aclocal9.test
index 3149341..16cdecd 100755
--- a/tests/aclocal9.test
+++ b/tests/aclocal9.test
@@ -28,24 +28,24 @@ END
 mkdir m4_1 m4_2
 
 cat >m4_1/somedefs.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro11 > foo])
-AC_DEFUN([MACRO2], [echo macro21 >> foo])
+AC_DEFUN([MACRO1], [:macro11:])
+AC_DEFUN([MACRO2], [:macro21:])
 EOF
 
 cat >m4_2/somedefs.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro12 > foo])
+AC_DEFUN([MACRO1], [:macro12:])
 EOF
 
 $ACLOCAL -I m4_1 -I m4_2
 $AUTOCONF
-./configure
-grep macro11 foo
-grep macro21 foo
+$FGREP ':macro11:' configure
+$FGREP ':macro21:' configure
 
-$sleep
+rm -rf autom4te*.cache
 
 $ACLOCAL -I m4_2 -I m4_1
 $AUTOCONF
-./configure
-grep macro12 foo
-grep macro21 foo
+$FGREP ':macro12:' configure
+$FGREP ':macro21:' configure
+
+:
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]