From de7bee7a82a0fffe9bfe91717ce9e75beae30f02 Mon Sep 17 00:00:00 2001
From: Akim Demaille <akim@epita.fr>
Date: Wed, 28 Feb 2001 09:33:30 +0000
Subject: [PATCH] * tests/atgeneral.m4 (AT_INIT): Warn when at-check-line is
 missing. * tests/tools.at (Syntax of the scripts): Use AT_CHECK to test
 /bin/sh -n.  Exit 77 on failure. Reported by Harlan Stenn.

---
 ChangeLog               |  8 ++++++++
 lib/autotest/general.m4 |  8 ++++++++
 tests/atgeneral.m4      |  8 ++++++++
 tests/tools.at          | 26 ++++++++++++++------------
 4 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 16bf6471..b592042b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-02-28  Akim Demaille  <akim@epita.fr>
+
+	* tests/atgeneral.m4 (AT_INIT): Warn when at-check-line is
+	missing.
+	* tests/tools.at (Syntax of the scripts): Use AT_CHECK to test
+	/bin/sh -n.  Exit 77 on failure.
+	Reported by Harlan Stenn.
+
 2001-02-28  Akim Demaille  <akim@epita.fr>
 
 	* acgeneral.m4 (_AC_INIT_PREPARE_FS_SEPARATORS): Use `.;.' instead
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index 2de4d118..1fbd174d 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -225,6 +225,14 @@ m4_divert([TAIL])[]dnl
     continue
     ;;
   esac
+  if test ! -f at-check-line; then
+    echo "$am_me: warning: no at-check-line which means a failure happened"
+    echo "$am_me: warning: in a [AT_SETUP/AT_CLEANUP] pair before any"
+    echo "$am_me: warning: AT_CHECK could be run.  This test suite is"
+    echo "$am_me: warning: improperly designed, please report to"
+    echo "$am_me: warning: <$at_bugreport>."
+    cp at-setup-line at-check-line
+  fi
   case $at_test in
     banner-*) ;;
     *)
diff --git a/tests/atgeneral.m4 b/tests/atgeneral.m4
index 2de4d118..1fbd174d 100644
--- a/tests/atgeneral.m4
+++ b/tests/atgeneral.m4
@@ -225,6 +225,14 @@ m4_divert([TAIL])[]dnl
     continue
     ;;
   esac
+  if test ! -f at-check-line; then
+    echo "$am_me: warning: no at-check-line which means a failure happened"
+    echo "$am_me: warning: in a [AT_SETUP/AT_CLEANUP] pair before any"
+    echo "$am_me: warning: AT_CHECK could be run.  This test suite is"
+    echo "$am_me: warning: improperly designed, please report to"
+    echo "$am_me: warning: <$at_bugreport>."
+    cp at-setup-line at-check-line
+  fi
   case $at_test in
     banner-*) ;;
     *)
diff --git a/tests/tools.at b/tests/tools.at
index 721b8230..dcb98114 100644
--- a/tests/tools.at
+++ b/tests/tools.at
@@ -45,22 +45,24 @@ sleep 2
 if kill $! >/dev/null 2>&1; then
   # We managed to kill the child, which means that we probably
   # can't trust `/bin/sh -n', hence the test failed.
-  exit 1
+  exit 77
 fi
 ]])
 
-if /bin/sh ./syntax.sh; then
-  # Specify the path to the tool, some shells don't honor PATH
-  # when running `sh PROG'.
-  AT_CHECK([/bin/sh -n ../autoconf],   0)
-  AT_CHECK([/bin/sh -n ../autoreconf], 0)
-  AT_CHECK([/bin/sh -n ../ifnames],    0)
+# If we can't trust sh, just skip.
+AT_CHECK([/bin/sh ./syntax.sh])
 
-  # These are not built, they are in the src tree.
-  AT_CHECK([/bin/sh -n $top_srcdir/install-sh], 0)
-  AT_CHECK([/bin/sh -n $top_srcdir/mkinstalldirs], 0)
-  AT_CHECK([/bin/sh -n $top_srcdir/missing], 0)
-fi
+# Specify the path to the tool, some shells don't honor PATH when
+# running `sh PROG'.
+
+AT_CHECK([/bin/sh -n ../autoconf],   0)
+AT_CHECK([/bin/sh -n ../autoreconf], 0)
+AT_CHECK([/bin/sh -n ../ifnames],    0)
+
+# These are not built, they are in the src tree.
+AT_CHECK([/bin/sh -n $top_srcdir/install-sh], 0)
+AT_CHECK([/bin/sh -n $top_srcdir/mkinstalldirs], 0)
+AT_CHECK([/bin/sh -n $top_srcdir/missing], 0)
 
 AT_CLEANUP