$AUTOCONF
$AUTOMAKE
./configure
-$MAKE check >stdout
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
cat stdout
-grep 'PASS: subrun.sh' stdout
+grep '^PASS: subrun\.sh *$' stdout
+grep 'PASS.*echo\.sh' stdout && Exit 1
-# check should depend directly on check-am (similar tests are
+# 'check' should depend directly on 'check-am' (similar tests are
# in check.test and check3.test).
-grep 'check: check-recursive' Makefile.in
-grep 'check: check-am' dir/Makefile.in
+$EGREP '^check:.* check-recursive( |$)' Makefile.in
+$EGREP '^check:.* check-am( |$)' dir/Makefile.in
# Make sure subrun.sh is still on its line as above. This means Automake
# hasn't rewritten the TESTS line unnecessarily (we can tell, because all
# Automake variables are reformatted by VAR_PRETTY).
-grep ' subrun.sh' Makefile.in
+grep '^ subrun\.sh$' Makefile.in
+
+: