[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] {master} tests: better way to compare lists in Makefile rules
From: |
Stefano Lattarini |
Subject: |
[PATCH] {master} tests: better way to compare lists in Makefile rules |
Date: |
Mon, 6 Feb 2012 19:29:13 +0100 |
With this commit, we introduce a new helper shell script for use
in the testsuite, which is meant to allow the test cases to easily
check whether two whitespace-separated lists are equal; this ability
is particularly useful to check for equality of the contents of make
variables that are expected to contain multiple whitespace-separated
words, and are defined through line continuations (or are rewritten
by automake in this way), or contain expansion of potentially empty
variables.
Before this change, a test checking that an usage like this one:
VAR = valA
if COND1
VAR += val1 # com1
endif COND1
VAR += valC
worked as expected, couldn't use rules like:
## Don't work because $(VAR) expands to multiple words
verify:
test $(VAR) = "valA val1 valC"
nor like:
## Don't work because the final expansion of $(VAR) contains
## repeated contiguous whitespace characters (it actually
## equals "valA val1 valC", not "valA val1 valC"), and this
## is an internal details which might change and which we
## don't want to explicitly rely on.
verify:
test "$(VAR)" = "valA val1 valC"
Instead, we had to rely on cumbersome workaround such as:
# Works, but is ugly.
verify:
test "`echo $(VAR)`" = "valA val1 valC"
or:
# Works, but is even uglier.
verify:
echo BEG: $(VAR) :END | grep "BEG: valA val1 valC :END"
Now, with the help of the new 'is' script, we can perform such a
check in a clearer and more straightforward way, as in:
## Works, and reads clearly.
verify:
is $(VAR) == valA val1 valC
* tests/is: New helper shell script, telling whther two whitespace
separated lists are equal.
* Makefile.am (EXTRA_DIST): Add it.
* tests/colneq2.test: Use the new helper script, and accordingly
get rid of older, more cumbersome idioms.
* tests/cond11.test: Likewise.
* tests/cond16.test: Likewise.
* tests/cond18.test: Likewise.
* tests/cond22.test: Likewise.
* tests/cond31.test: Likewise.
* tests/cond38.test: Likewise.
* tests/test-logs-repeated.test: Likewise.
* tests/objext-pr10128.test: Likewise.
* tests/programs-primary-rewritten.test: Likewise.
* tests/substre2.test: Likewise. Also ...
(configure.in, Makefile.am): Add a couple of hack to avoid having
to require (and run) a C compiler; accordingly ...
($required): ... remove this.
* tests/exeext4.test: Likewise.
* tests/substref.test: Likewise. Also ...
(hello.c): Use ": >" rather than "cat <<EOF" to generate it,
since it's meant to be empty anyway.
* tests/cond4.test: Use the new helper script, and accordingly
get rid of older, more cumbersome idioms. Avoid some unnecessary
uses of "make -e" since we are at it.
* tests/cond19.test: Likewise.
* tests/cond32.test: Likewise.
* tests/cond6.test: Use the new helper script, and accordingly
move some checks in the Makefile.am.
Avoid unnecessary execution of automake remake rules by manually
"touching" aclocal.m4
---
Another (IMHO worthy) testsuite-improving patch, like old times :-)
I will push this in 48 hours or so if there is no objection.
Regards,
Stefano
tests/Makefile.am | 2 +-
tests/colneq2.test | 6 ++--
tests/comment8.test | 5 ++-
tests/cond11.test | 7 ++--
tests/cond16.test | 4 +-
tests/cond18.test | 6 ++--
tests/cond19.test | 14 ++++-----
tests/cond22.test | 4 +-
tests/cond31.test | 6 ++--
tests/cond32.test | 11 +++----
tests/cond38.test | 4 +-
tests/cond4.test | 16 ++++-----
tests/cond6.test | 15 ++++-----
tests/exeext4.test | 50 ++++++++++++------------------
tests/is | 54 +++++++++++++++++++++++++++++++++
tests/objext-pr10128.test | 4 +-
tests/programs-primary-rewritten.test | 8 ++--
tests/substre2.test | 15 ++++-----
tests/substref.test | 19 ++++-------
tests/test-logs-repeated.test | 4 +-
20 files changed, 144 insertions(+), 110 deletions(-)
create mode 100755 tests/is
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dc16ad5..873c08e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -30,7 +30,7 @@ TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL)
$(top_srcdir)/lib/tap-driver.sh
AM_TAP_LOG_DRIVER_FLAGS = --merge
-EXTRA_DIST = ChangeLog-old
+EXTRA_DIST = is ChangeLog-old
TESTS = ## Will be updated later.
diff --git a/tests/colneq2.test b/tests/colneq2.test
index 8f408eb..fe117c9 100755
--- a/tests/colneq2.test
+++ b/tests/colneq2.test
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 2001, 2002, 2010, 2011, 2012 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
@@ -28,7 +28,7 @@ t = a b c
EXTRA_DIST = $(t:=.test)
.PHONY: test
test:
- test x'$(EXTRA_DIST)' = x'a.test b.test c.test'
+ is $(EXTRA_DIST) == a.test b.test c.test
END
$ACLOCAL
diff --git a/tests/comment8.test b/tests/comment8.test
index a9d6eaa..b2b12fe 100755
--- a/tests/comment8.test
+++ b/tests/comment8.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2004, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2011, 2012 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
@@ -36,8 +36,9 @@ if COND2
VAR += val2 # com2
endif COND2
+.PHONY: test
test:
- test "`echo $(VAR)`" = 'valA valB val1 valC val2'
+ is $(VAR) == valA valB val1 valC val2
EOF
$ACLOCAL
diff --git a/tests/cond11.test b/tests/cond11.test
index 89ab482..90cbde3 100755
--- a/tests/cond11.test
+++ b/tests/cond11.test
@@ -1,5 +1,6 @@
#! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2011, 2012 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
@@ -40,9 +41,9 @@ LDADD = $(SUBSTVAR) $(foolibs)
.PHONY: test1 test2
test1:
- test faz.la = $(foo_DEPENDENCIES)
+ is faz.la == $(foo_DEPENDENCIES)
test2:
- test -z "`echo $(foo_DEPENDENCIES)`"
+ is "" == $(foo_DEPENDENCIES)
END
: > config.guess
diff --git a/tests/cond16.test b/tests/cond16.test
index 4efcbbd..7c4a264 100755
--- a/tests/cond16.test
+++ b/tests/cond16.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2001, 2002, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2011, 2012 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
@@ -43,7 +43,7 @@ hell_SOURCES = $(var:=)
.PHONY: test
test:
- test "`echo $(hell_SOURCES) $(hell_OBJECTS)`" = "foo.c foo.o"
+ is $(hell_SOURCES) $(hell_OBJECTS) == foo.c foo.o
END
$ACLOCAL
diff --git a/tests/cond18.test b/tests/cond18.test
index 366dfd0..fa04d56 100755
--- a/tests/cond18.test
+++ b/tests/cond18.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2001, 2002, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2011, 2012 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
@@ -48,8 +48,8 @@ helldl_SOURCES = $(var3)
.PHONY: test
test:
- test x"`echo $(helldl_SOURCES) $(helldl_OBJECTS)`" = \
- x"dlmain.c foo.c dlmain.obj foo.obj"
+ is $(helldl_SOURCES) $(helldl_OBJECTS) == \
+ dlmain.c foo.c dlmain.obj foo.obj
bin_PROGRAMS = helldl
END
diff --git a/tests/cond19.test b/tests/cond19.test
index d1ba08a..17ead91 100755
--- a/tests/cond19.test
+++ b/tests/cond19.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2001, 2002, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2011, 2012 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
@@ -48,11 +48,9 @@ endif
helldl_SOURCES = $(var3:.c=1.c) $(var4:.c=2.c)
-got = `echo $(helldl_SOURCES) $(helldl_OBJECTS)`
-
.PHONY: test
test:
- test x"$(exp)" = x"$(got)"
+ is $(exp) == $(helldl_SOURCES) $(helldl_OBJECTS)
END
$ACLOCAL
@@ -60,12 +58,12 @@ $AUTOCONF
$AUTOMAKE -a -i
CONDITION1=true CONDITION2=true ./configure
-exp='dlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o' $MAKE -e test
+$MAKE test exp='dlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o'
CONDITION1=true CONDITION2=false ./configure
-exp='dlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o' $MAKE -e test
+$MAKE test exp='dlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o'
CONDITION1=false CONDITION2=true ./configure
-exp='dlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o' $MAKE -e test
+$MAKE test exp='dlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o'
CONDITION1=false CONDITION2=false ./configure
-exp='dlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o' $MAKE -e test
+$MAKE test exp='dlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o'
:
diff --git a/tests/cond22.test b/tests/cond22.test
index 72120eb..cc46745 100755
--- a/tests/cond22.test
+++ b/tests/cond22.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2002, 2003, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2011, 2012 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
@@ -57,7 +57,7 @@ targ_SOURCES = $(SONE) $(STWO) $(STHREE) $(STHREE2)
.PHONY: test
test:
- test "`echo $(targ_OBJECTS)`" = "one.oo two.oo three.oo three2.oo"
+ is $(targ_OBJECTS) == one.oo two.oo three.oo three2.oo
END
$ACLOCAL
diff --git a/tests/cond31.test b/tests/cond31.test
index b94820e..69b8fc1 100755
--- a/tests/cond31.test
+++ b/tests/cond31.test
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2003, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2011, 2012 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
@@ -38,9 +38,9 @@ endif
.PHONY: test1 test2
test1:
- test "`echo $(a_DEPENDENCIES)`" = "c0.o c1.o"
+ is $(a_DEPENDENCIES) == c0.o c1.o
test2:
- test "`echo $(a_DEPENDENCIES)`" = "c0.o c2.o c3.la"
+ is $(a_DEPENDENCIES) == c0.o c2.o c3.la
EOF
$ACLOCAL
diff --git a/tests/cond32.test b/tests/cond32.test
index 45ecf70..738903a 100755
--- a/tests/cond32.test
+++ b/tests/cond32.test
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2003, 2006, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2011, 2012 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
@@ -50,9 +50,8 @@ endif
a_LDADD = $(BAR)
endif
-got = `echo $(a_DEPENDENCIES)`
test:
- test "$(exp)" = "$(got)"
+ is $(exp) == $(a_DEPENDENCIES)
.PHONY: test
EOF
@@ -61,12 +60,12 @@ $AUTOCONF
$AUTOMAKE
./configure
-exp='foo.o nonsense.a' $MAKE -e test
+$MAKE test exp='foo.o nonsense.a'
./configure two=yes three=
-exp='bar.o' $MAKE -e test
+$MAKE test exp='bar.o'
./configure two=yes three=yes
-exp='baz.o' $MAKE -e test
+$MAKE test exp='baz.o'
:
diff --git a/tests/cond38.test b/tests/cond38.test
index 8638dae..bc313b8 100755
--- a/tests/cond38.test
+++ b/tests/cond38.test
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2005, 2011, 2012 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
@@ -49,7 +49,7 @@ endif
.PHONY: test
test:
- test "`echo $(SUBDIRS)`" = 'a b c d e f g h iXYZ jZYX'
+ is $(SUBDIRS) == a b c d e f g h iXYZ jZYX
EOF
mkdir a b c d e f g h iXYZ jZYX
diff --git a/tests/cond4.test b/tests/cond4.test
index 3071577..40dfa2f 100755
--- a/tests/cond4.test
+++ b/tests/cond4.test
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 2001, 2002, 2010, 2011, 2012 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
@@ -40,11 +40,9 @@ endif
targ_SOURCES = main.c $(OPT1) $(OPT2)
-got = `echo $(targ_OBJECTS)`
-
.PHONY: test
test:
- test x"$(exp)" = x"$(got)"
+ is $(exp) == $(targ_OBJECTS)
END
$ACLOCAL
@@ -57,12 +55,12 @@ grep 'address@hidden@' Makefile.in && Exit 1
$AUTOCONF
CONDITION1=true CONDITION2=true ./configure
-exp='main.o one.o two.o' $MAKE -e test
+$MAKE test exp='main.o one.o two.o'
CONDITION1=true CONDITION2=false ./configure
-exp='main.o one.o' $MAKE -e test
+$MAKE test exp='main.o one.o'
CONDITION1=false CONDITION2=true ./configure
-exp='main.o two.o' $MAKE -e test
+$MAKE test exp='main.o two.o'
CONDITION1=false CONDITION2=false ./configure
-exp='main.o' $MAKE -e test
+$MAKE test exp='main.o'
:
diff --git a/tests/cond6.test b/tests/cond6.test
index 60436ab..50fb0d6 100755
--- a/tests/cond6.test
+++ b/tests/cond6.test
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 2001, 2002, 2010, 2011, 2012 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
@@ -39,9 +39,9 @@ endif
a b c d e f g h:
touch $@
-.PHONY: print-data
-print-data:
- echo BEG: $(help_DATA) :END
+.PHONY: test
+test:
+ is $(help_DATA) == a b c d e f g h
END
@@ -54,14 +54,13 @@ $AUTOMAKE
rm -rf autom4te*.cache
echo AC_OUTPUT >> configure.in
+touch aclocal.m4 # Avoid unnecessary firing the remake rules.
$AUTOCONF
$AUTOMAKE Makefile
./configure --prefix="`pwd`/_inst"
-$MAKE print-data >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^BEG: a b c d e f g h :END$' stdout
+$MAKE test
$MAKE install
for x in a b c d e f g h; do
diff --git a/tests/exeext4.test b/tests/exeext4.test
index 1ee8016..9ce25fe 100755
--- a/tests/exeext4.test
+++ b/tests/exeext4.test
@@ -1,5 +1,6 @@
#! /bin/sh
-# Copyright (C) 2003, 2006, 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2010, 2011, 2012 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
@@ -17,18 +18,18 @@
# Make sure $(EXEEXT) is appended to programs and to tests that are
# programs, but not to @address@hidden
-required=cc
. ./defs || Exit 1
cat >> configure.in << 'END'
AM_CONDITIONAL([COND], [test -n "$cond"])
AC_SUBST([programs], ['prg1$(EXEEXT) prg2$(EXEEXT)'])
-AC_PROG_CC
+AC_SUBST([CC], [whocares])
AC_OUTPUT
END
cat > Makefile.am << 'END'
-EXEEXT = .bin
+AUTOMAKE_OPTIONS = no-dependencies
+EXEEXT = .x
if COND
BAR = bar
DEP = bar
@@ -39,42 +40,31 @@ bin_PROGRAMS = $(programs) @programs@ prg3 $(BAR) $(BAZE)
EXTRA_PROGRAMS = prg1 prg2 prg3
TESTS = prg1 prg3 prg4 $(BAZ)
-print-bin:
- @echo BEG: $(bin_PROGRAMS) :END
-print-extra:
- @echo BEG: $(EXTRA_PROGRAMS) :END
-print-tests:
- @echo BEG: $(TESTS) :END
-print-barbaz:
- @echo BEG: $(BAR) $(BAZ) :END
+.PHONY: test-cond test-nocond
+test-nocond:
+ is $(bin_PROGRAMS) == prg1.x prg2.x prg1.x prg2.x prg3.x
+ is $(EXTRA_PROGRAMS) == prg1.x prg2.x prg3.x
+ is $(TESTS) == prg1.x prg3.x prg4
+test-cond:
+ is $(bin_PROGRAMS) == prg1.x prg2.x prg1.x prg2.x prg3.x bar.x baz.x
+ is $(EXTRA_PROGRAMS) == prg1.x prg2.x prg3.x
+ is $(TESTS) == prg1.x prg3.x prg4 baz.x bar.x
+ is $(BAR) $(BAZ) == bar baz bar
END
$ACLOCAL
$AUTOCONF
$AUTOMAKE --add-missing --copy
+
./configure
-$MAKE print-bin > output
-cat output
-$FGREP 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin' output
-$MAKE print-extra > output
-cat output
-$FGREP 'prg1.bin prg2.bin prg3.bin' output
-$MAKE print-tests > output
-cat output
-$FGREP 'prg1.bin prg3.bin prg4' output
+$MAKE test-nocond
./configure cond=yes
-$MAKE print-bin > output
-cat output
-$FGREP 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin bar.bin baz.bin' output
-$MAKE print-tests > output
-cat output
-$FGREP 'prg1.bin prg3.bin prg4 baz.bin bar.bin' output
-$MAKE print-barbaz > output
-cat output
-$FGREP 'bar baz bar' output
+$MAKE test-cond
# Only two am__EXEEXT_* variables are needed here: one for BAR, and one
# BAZ. The latter must use the former.
test 2 = `grep '__EXEEXT_. =' Makefile.in | wc -l`
grep 'am__EXEEXT_2 = .*am__EXEEXT_1' Makefile.in
+
+:
diff --git a/tests/is b/tests/is
new file mode 100755
index 0000000..1e1c0ce
--- /dev/null
+++ b/tests/is
@@ -0,0 +1,54 @@
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Test that two whitespace-separated lists are equal.
+# Assumes the two lists are passed on the command line separated by
+# a '==' string.
+# This script is useful to test equality of lists in makefile rules,
+# in the face of variables defined through line-continuations,
+# automake rewrites and expansions of empty variables.
+
+set -e
+set -u
+
+# Initialize before unsetting, for shells (like older bash or Solaris
+# ksh) that fail to unset variables that are already unset.
+exp= got=; unset exp got
+seen_eqeq=no
+while test $# -gt 0; do
+ if test x"$1" = x"=="; then
+ if test $seen_eqeq = no; then
+ seen_eqeq=yes
+ else
+ echo "$0: more than one '==' argument seen on command line" >&2
+ exit 2
+ fi
+ else
+ if test $seen_eqeq = no; then
+ got=${got+"$got "}$1
+ else
+ exp=${exp+"$exp "}$1
+ fi
+ fi
+ shift
+done
+
+if test $seen_eqeq = no; then
+ echo "$0: no '==' argument seen on command line" >&2
+ exit 2
+fi
+
+test x"${exp-}" = x"${got-}"
diff --git a/tests/objext-pr10128.test b/tests/objext-pr10128.test
index 120986c..e105635 100755
--- a/tests/objext-pr10128.test
+++ b/tests/objext-pr10128.test
@@ -38,8 +38,8 @@ zardoz_SOURCES = mu1.lisp mu2.lisp
.PHONY: test
test:
- test '$(foo_OBJECTS)' = 'foo.fasl'
- test '$(zardoz_OBJECTS)' = 'mu1.fasl mu2.fasl'
+ is $(foo_OBJECTS) == foo.fasl
+ is $(zardoz_OBJECTS) == mu1.fasl mu2.fasl
END
$ACLOCAL
diff --git a/tests/programs-primary-rewritten.test
b/tests/programs-primary-rewritten.test
index e52bd56..2328bb6 100755
--- a/tests/programs-primary-rewritten.test
+++ b/tests/programs-primary-rewritten.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2003, 2006, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2011, 2012 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
@@ -40,9 +40,9 @@ baz = mau
.PHONY: test
test:
- test '$(check_PROGRAMS)' = a.bin
- test '$(bin_PROGRAMS)' = 'b.bin c'
- test '$(noinst_PROGRAMS)' = 'zardoz.bin maude.bin'
+ is $(check_PROGRAMS) == a.bin
+ is $(bin_PROGRAMS) == b.bin c
+ is $(noinst_PROGRAMS) == zardoz.bin maude.bin
END
$ACLOCAL
diff --git a/tests/substre2.test b/tests/substre2.test
index ec92062..1935622 100755
--- a/tests/substre2.test
+++ b/tests/substre2.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2003, 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2010, 2011, 2012 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
@@ -17,15 +17,15 @@
# Test for bug in variable substitution references, where
# undefined variables break later substitutions.
-required=cc
. ./defs || Exit 1
cat >> configure.in << 'END'
-AC_PROG_CC
+AC_SUBST([CC], [whocares])
AC_OUTPUT
END
cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
foo = foo.a foo.b $(doesnt_exist)
bar = bar.a bar.b
@@ -36,16 +36,15 @@ bin_PROGRAMS = foo
foo_SOURCES = $(var2)
OBJEXT = obj
-echorule:
- @echo BEG: $(foo_OBJECTS) :END
+.PHONY: test
+test:
+ is $(foo_OBJECTS) == foo1.obj foo4.obj bar3.obj bar4.obj
END
$ACLOCAL
$AUTOCONF
$AUTOMAKE -a
./configure
-$MAKE echorule >output || { cat output; Exit 1; }
-cat output
-$FGREP 'BEG: foo1.obj foo4.obj bar3.obj bar4.obj :END' output
+$MAKE test
:
diff --git a/tests/substref.test b/tests/substref.test
index 7b30423..a3088b0 100755
--- a/tests/substref.test
+++ b/tests/substref.test
@@ -18,24 +18,24 @@
# pattern is null.
# Report from Richard Boulton.
-required=cc
. ./defs || Exit 1
cat >> configure.in << 'END'
-AC_PROG_CC
+AC_SUBST([CC], [whocares])
AC_OUTPUT
END
-cat > hello.c << 'END'
-END
+: > hello.c
cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
var1 = dlmain
var2 = $(var1:=.)
helldl_SOURCES = $(var2:=c)
bin_PROGRAMS = helldl
-got:
- @echo $(helldl_SOURCES) $(helldl_OBJECTS) >got
+.PHONY: test
+test:
+ is $(helldl_SOURCES) $(helldl_OBJECTS) == dlmain.c dlmain.$(OBJEXT)
END
$ACLOCAL
@@ -43,12 +43,7 @@ $AUTOCONF
$AUTOMAKE -a
./configure
-
-objext=`sed -n -e 's/^OBJEXT = //p' < Makefile`
-echo dlmain.c dlmain.$objext >exp
-$MAKE got
-cat got
-diff exp got
+$MAKE test
# This is unrelated to the rest of this test. But while we are
# at it, make sure we don't use am__helldl_SOURCES_DIST here, since
diff --git a/tests/test-logs-repeated.test b/tests/test-logs-repeated.test
index 5ab3461..0bec579 100755
--- a/tests/test-logs-repeated.test
+++ b/tests/test-logs-repeated.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# Copyright (C) 2011, 2012 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
@@ -32,7 +32,7 @@ TEST_EXTENSIONS = .sh .test .bar
TESTS = foo.sh mu.test foo.test foo.bar
.PHONY: verify
verify:
- test "`echo $(TEST_LOGS)`" = 'foo.log mu.log foo.log foo.log'
+ is $(TEST_LOGS) == foo.log mu.log foo.log foo.log
END
$ACLOCAL
--
1.7.7.3
- [PATCH] {master} tests: better way to compare lists in Makefile rules,
Stefano Lattarini <=