summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2013-06-19 16:09:47 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2013-06-19 16:18:58 +0200
commitf387e513e36f2b7858befc4de6b41d7838d94482 (patch)
tree320404d47d42a3df8d0dd8dfe6a2dedc814fc3be
parent3f1d7622a9a4c818d5d0b20d8a52c09754806d99 (diff)
downloadautomake-f387e513e36f2b7858befc4de6b41d7838d94482.tar.gz
tests: simplify checks for some expected variables values in Makefiles
Do so by using our custom 'is' auxiliary script rather than grepping the output from make. This is more natural, more robust, and often shorter to write. Unfortunately, we can't do that in all cases: sometimes we really need to match the content of a variable against a regular expressions, and we can't know nor are interested in its exact value. This is basically a follow-up on commit v1.11-1830-g96401cb of 2012-02-08 (tests: better way to compare lists in Makefile rules). * t/subst-no-trailing-empty-line.sh: Adjust. * t/pluseq10.sh: Likewise. * t/check5.sh: Likewise, and enhance a little while at it. * t/check7.sh: Likewise. * t/exeext.sh: Likewise. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
-rw-r--r--t/check5.sh9
-rw-r--r--t/check7.sh9
-rw-r--r--t/exeext.sh35
-rw-r--r--t/pluseq10.sh8
-rw-r--r--t/subst-no-trailing-empty-line.sh24
5 files changed, 37 insertions, 48 deletions
diff --git a/t/check5.sh b/t/check5.sh
index 738b3a130..5351ff8ee 100644
--- a/t/check5.sh
+++ b/t/check5.sh
@@ -32,9 +32,8 @@ check-local:
test -f one$(EXEEXT)
test -f two$(EXEEXT)
touch ok
-.PHONY: print-tests
-print-tests:
- echo BEG: $(TESTS) :END
+expect-tests:
+ is $(TESTS) == one$(EXEEXT) two$(EXEEXT)
END
$ACLOCAL
@@ -52,8 +51,8 @@ cp one.c two.c
./configure
$MAKE check
test -f ok
-run_make -O EXEEXT=.bin print-tests
-$FGREP 'BEG: one.bin two.bin :END' stdout
+run_make expect-tests
+run_make expect-tests EXEEXT=.bin
# No am__EXEEXT_* variable is needed.
grep '_EXEEXT_[1-9]' Makefile.in && exit 1
$FGREP 'TESTS = $(check_PROGRAMS)' Makefile.in
diff --git a/t/check7.sh b/t/check7.sh
index 1dd918bb1..5d3cd5847 100644
--- a/t/check7.sh
+++ b/t/check7.sh
@@ -32,9 +32,8 @@ check_PROGRAMS = a c d
check_SCRIPTS = b
EXTRA_DIST = $(check_SCRIPTS)
-.PHONY: print-xfail-tests
-print-xfail-tests:
- @echo BEG: $(XFAIL_TESTS) :END
+expect-xfail-tests:
+ is $(XFAIL_TESTS) == a$(EXEEXT) b c$(EXEEXT) d$(EXEEXT)
END
cat > b <<'END'
@@ -60,8 +59,8 @@ $AUTOMAKE -a
./configure
$MAKE check
-run_make -O EXEEXT=.bin print-xfail-tests
-$FGREP 'BEG: a.bin b c.bin d.bin :END' stdout
+run_make expect-xfail-tests
+run_make expect-xfail-tests EXEEXT=.bin
$MAKE distcheck
diff --git a/t/exeext.sh b/t/exeext.sh
index 72902333e..414108d24 100644
--- a/t/exeext.sh
+++ b/t/exeext.sh
@@ -32,7 +32,6 @@ AC_OUTPUT
END
cat > Makefile.am << 'END'
-## Use a different dir for each to make grep easy.
bin_PROGRAMS = maude
sbin_PROGRAMS = maude.static
## We don't define this one for now. Probably it is an error.
@@ -46,11 +45,17 @@ if WANT_RMT
libexec_PROGRAMS = rmt
endif
-print:
- @echo 1BEG: $(bin_PROGRAMS) :END1
- @echo 2BEG: $(sbin_PROGRAMS) :END2
- @echo 3BEG: $(check_PROGRAMS) :END3
- @echo 4BEG: $(libexec_PROGRAMS) :END4
+test-default:
+ is $(bin_PROGRAMS) == maude$(EXEEXT) mt$(EXEEXT)
+ is $(sbin_PROGRAMS) == maude.static$(EXEEXT)
+ is $(check_PROGRAMS) == maude3$(EXEEXT)
+ is $(libexec_PROGRAMS) == rmt$(EXEEXT)
+
+test-revert:
+ is $(bin_PROGRAMS) == maude$(EXEEXT)
+ is $(sbin_PROGRAMS) == maude.static$(EXEEXT)
+ is $(check_PROGRAMS) == maude3$(EXEEXT)
+ is $(libexec_PROGRAMS) ==
END
$ACLOCAL
@@ -68,21 +73,11 @@ test $(grep -c '^bin_PROGRAMS =' Makefile.in) -eq 1
grep 'maude3__EXEEXT__OBJECTS' Makefile.in && exit 1
./configure
-
-run_make -O EXEEXT=.foo print
-
-grep '1BEG: maude.foo mt.foo :END1' stdout
-grep '2BEG: maude.static.foo :END2' stdout
-grep '3BEG: maude3.foo :END3' stdout
-grep '4BEG: rmt.foo :END4' stdout
+run_make test-default
+run_make test-default EXEEXT=.foo
./configure revert=yes
-
-run_make -O EXEEXT=.foo print
-
-grep '1BEG: maude.foo :END1' stdout
-grep '2BEG: maude.static.foo :END2' stdout
-grep '3BEG: maude3.foo :END3' stdout
-grep '4BEG: :END4' stdout
+run_make test-revert
+run_make test-revert EXEEXT=.foo
:
diff --git a/t/pluseq10.sh b/t/pluseq10.sh
index c80d23a38..deed6e3ef 100644
--- a/t/pluseq10.sh
+++ b/t/pluseq10.sh
@@ -38,9 +38,8 @@ foo += b0.h \
b1.h
endif
-.PHONY: print
-print:
- @echo BEG: $(foo) :END
+test:
+ is $(foo) == 0.h a0.h a1.h a2.h a3.h
END
$ACLOCAL
@@ -48,7 +47,6 @@ $AUTOCONF
$AUTOMAKE
./configure
-run_make -O print
-$FGREP 'BEG: 0.h a0.h a1.h a2.h a3.h :END' stdout
+$MAKE test
:
diff --git a/t/subst-no-trailing-empty-line.sh b/t/subst-no-trailing-empty-line.sh
index 5097f5fa4..b057d9510 100644
--- a/t/subst-no-trailing-empty-line.sh
+++ b/t/subst-no-trailing-empty-line.sh
@@ -58,10 +58,15 @@ check_PROGRAMS = zardoz \$(noinst_PROGRAMS)
## PROGRAMS primary, otherwise automake will complain.
EXTRA_PROGRAMS =
-print-programs:
- @echo BEG1: \$(noinst_PROGRAMS) :END1
- @echo BEG2: \$(bin_PROGRAMS) :END2
- @echo BEG3: \$(check_PROGRAMS) :END3
+test-real-empty:
+ is \$(noinst_PROGRAMS) == x
+ is \$(bin_PROGRAMS) ==
+ is \$(check_PROGRAMS) == zardoz x
+
+test-fake-empty:
+ is \$(noinst_PROGRAMS) == x X
+ is \$(bin_PROGRAMS) == X
+ is \$(check_PROGRAMS) == zardoz x X
END
$ACLOCAL
@@ -82,14 +87,7 @@ test $($EGREP -c "^[ $tab]*@$v2@ @$v3@[ $tab]*$bs?$" Makefile.in) -eq 3
cat t-programs
grep '^ *$' t-programs && exit 1
-run_make -O print-programs
-grep '^BEG1: x :END1$' stdout
-grep '^BEG2: :END2$' stdout
-grep '^BEG3: zardoz x :END3$' stdout
-
-run_make -O am__empty=X print-programs
-grep '^BEG1: x X :END1$' stdout
-grep '^BEG2: X :END2$' stdout
-grep '^BEG3: zardoz x X :END3$' stdout
+run_make test-real-empty
+run_make test-fake-empty am__empty=X
: