autoconf-patches
[Top][All Lists]
Advanced

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

/floppy/acp/87-fyi-standalone-autotest-2.patch


From: Akim Demaille
Subject: /floppy/acp/87-fyi-standalone-autotest-2.patch
Date: Fri, 07 Sep 2001 09:26:07 +0200

It is still not clear to me how to distinguish an embedded test suite
from a standalone one, since an embedded test suite can be used to
exercise another version of the programs, making it virtually a
stand-alone test suite.  For instance I could use CVS M4's test suite
to check OpenBSD M4, but then, ChangeLog, config.log etc. make no
sense.  And checking against the package version is obviously wrong
too.

So?  --standalone and --embedded?

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * bin/autom4te.in (&handle_m4): `< /dev/null' so that GNU M4 1.5
        doesn't neutralize SIGINT, making autoconf etc. non interruptible.
        Use `xsystem'.
        * lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): Move the package
        related variables into `at_package_*'.
        Use _ACEOF, not ATEOF.
        * lib/autotest/general.m4 (AT_VICTIMS): New.
        (AT_INIT): Adjust for stand-alone/embedded test suites.
        (AS_MESSAGE_LOG_FD): Define and use it.
        * tests/suite.at (AT_VICTIMS): Use it.
        * tests/tools.at (autoupdating AC_PREREQ): Don't depend upon
        at_version.

Index: bin/autom4te.in
--- bin/autom4te.in Wed, 05 Sep 2001 15:50:08 +0200 akim
+++ bin/autom4te.in Thu, 06 Sep 2001 22:45:11 +0200 akim
@@ -572,23 +572,20 @@ sub handle_m4 ($@)
   unlink ($tcache . $req->id);

   # Run m4.
+  #
+  # Neutralize its stdin, so that GNU M4 1.5 doesn't neutralize SIGINT.
+  #
   # Be extremely cautious to reverse the includes when talking to M4:
   # it doesn't speak the same --include as we do.
-  my $command = ("$m4"
-                . join (' --include=', '', reverse @include)
-                . " --define=m4_warnings=$m4_warnings"
-                . ' --debug=aflq'
-                . " --error-output=$tcache" . $req->id
-                . join (' --trace=',   '', sort @macro)
-                . $files
-                . " >$ocache" . $req->id);
-  verbose "running: $command";
-  system $command;
-  if ($?)
-    {
-      verbose "$m4: failed with exit status: " . ($? >> 8) . "\n";
-      exit $? >> 8;
-    }
+  xsystem("$m4"
+         . join (' --include=', '', reverse @include)
+         . " --define=m4_warnings=$m4_warnings"
+         . ' --debug=aflq'
+         . " --error-output=$tcache" . $req->id
+         . join (' --trace=', '', sort @macro)
+         . $files
+         . " </dev/null"
+         . " >$ocache" . $req->id);
 }


Index: lib/autoconf/autotest.m4
--- lib/autoconf/autotest.m4 Fri, 24 Aug 2001 19:05:25 +0200 akim
+++ lib/autoconf/autotest.m4 Thu, 06 Sep 2001 22:28:49 +0200 akim
@@ -60,13 +60,14 @@
 # into all the build dirs of AUTOTEST-PATH, then all the src dirs.
 AC_DEFUN([AC_CONFIG_TESTDIR],
 [AC_CONFIG_COMMANDS([$1/atconfig],
-[cat >$1/atconfig <<ATEOF
+[cat >$1/atconfig <<_ACEOF
 @%:@ Configurable variable values for building test suites.
 @%:@ Generated by $[0]
 @%:@ Copyright 2000, 2001 Free Software Foundation, Inc.

-at_package='$at_package'
-at_version='$at_version'
+at_package_name='$at_package_name'
+at_package_version='$at_package_version'
+at_package_string='$at_package_string'
 at_bugreport='$at_bugreport'

 at_n='$at_n'
@@ -81,11 +82,11 @@ AC_DEFUN([AC_CONFIG_TESTDIR],

 SHELL=\${CONFIG_SHELL-'$at_shell'}
 PATH_SEPARATOR='$at_path_separator'
-
-ATEOF
+_ACEOF
 ],
-[at_package='$PACKAGE_NAME'
-at_version='$PACKAGE_VERSION'
+[at_package_name='$PACKAGE_NAME'
+at_package_version='$PACKAGE_VERSION'
+at_package_string='$PACKAGE_STRING'
 at_bugreport='$PACKAGE_BUGREPORT'

 at_n='$ECHO_N'
Index: lib/autotest/general.m4
--- lib/autotest/general.m4 Thu, 06 Sep 2001 21:37:30 +0200 akim
+++ lib/autotest/general.m4 Thu, 06 Sep 2001 22:59:12 +0200 akim
@@ -90,10 +90,9 @@ m4_define([AT_LINE],
 [m4_patsubst(__file__, [^\(.*/\)*\(.*\)], [[\2]]):__line__])


-# AT_INIT(PROGRAM)
-# ----------------
-# Begin test suite, using PROGRAM to check version.  The search path
-# should be already preset so the proper executable will be selected.
+# AT_INIT([TESTSUITE-NAME], [BUG-REPORT])
+# ---------------------------------------
+# Begin test suite.
 m4_define([AT_INIT],
 [AS_INIT
 m4_pattern_forbid([^_?AT_])
@@ -108,7 +107,10 @@ m4_define([AT_data_files], [stdout expou

 # How were we run?
 at_cli_args=${1+"address@hidden"}
-at_debug_args=
+
+# Who are we?
+at_testsuite_name='$1'
+at_bugreport='$2'

 # Load the config file.
 for at_file in atconfig atlocal
@@ -126,6 +128,8 @@ m4_define([AT_data_files], [stdout expou
 at_times=:
 (times) >/dev/null 2>&1 && at_times=times

+# CLI Arguments to pass to the debugging scripts.
+at_debug_args=
 # -e sets to true
 at_stop_on_error=false
 # Shall we be verbose?
@@ -144,7 +148,15 @@ m4_define([AT_data_files], [stdout expou
 while test address@hidden:@] -gt 0; do
   case $[1] in
     --help | -h) at_help=: ;;
-    --version) echo "$as_me ($at_package) $at_version"; exit 0 ;;
+    --version)
+        if test -n "$at_package_string"; then
+          echo "$as_me ($at_package_string)"
+          echo "Embedded test suite."
+        else
+          echo "$as_me ($at_testsuite_name)"
+          echo "Stand-alone test suite."
+        fi
+        exit 0 ;;
     --clean | -c )
         rm -rf $at_data_files debug-*.sh $as_me.log devnull
        exit 0;;
@@ -230,6 +242,7 @@ Tests:
   egrep -e "$at_tests_pattern" <<_ATEOF
 m4_divert([HELP])dnl Help message inserted here.
 m4_divert([SETUP])dnl
+Report bugs to <$at_bugreport>.
 _ATEOF
   exit 0
 fi
@@ -261,7 +274,7 @@ Tests:
         # Stand-alone test suite.
         at_path=$at_path$PATH_SEPARATOR$at_dir
       else
-        # Embbeded test suite.
+        # Embedded test suite.
         at_path=$at_path$PATH_SEPARATOR$top_builddir/$at_dir
         at_path=$at_path$PATH_SEPARATOR$top_srcdir/$at_dir
       fi
@@ -311,28 +324,37 @@ Tests:
 fi

 # 6 is the log file.  To be preserved if `-d'.
+m4_define([AS_MESSAGE_LOG_FD], [6])
 if $at_debug; then
-  exec 6>/dev/null
+  exec AS_MESSAGE_LOG_FD>/dev/null
 else
-  exec 6>$as_me.log
+  exec AS_MESSAGE_LOG_FD>$as_me.log
 fi

-# Tester and tested.
-if $1 --version | grep "$at_package.*$at_version" >/dev/null; then
-  AS_BOX([Test suite for $at_package $at_version])
-  {
-    AS_BOX([     Test suite log for $at_package $at_version.      ])
-    echo
+# Banners and logs.
+if test -n "$at_package_string"; then
+  AS_BOX([$at_package_string test suite.])
+else
+  AS_BOX([$at_testsuite_name test suite.])
+fi
+{
+  if test -n "$at_package_string"; then
+    AS_BOX([Embedded $at_package_string test suite.])
+  else
+    AS_BOX([$at_testsuite_name test suite.])
+  fi
+  echo

-    echo "$as_me: command line was:"
-    echo "  $ $[0] $at_cli_args"
-    echo
+  echo "$as_me: command line was:"
+  echo "  $ $[0] $at_cli_args"
+  echo

-    # Try to find a few ChangeLogs in case it might help determining the
-    # exact version.  Use the relative dir: if the top dir is a symlink,
-    # find will not follow it (and options to follow the links are not
-    # portable), which would result in no output here.
+  # Try to find a few ChangeLogs in case it might help determining the
+  # exact version.  Use the relative dir: if the top dir is a symlink,
+  # find will not follow it (and options to follow the links are not
+  # portable), which would result in no output here.

+  if test -n "$top_srcdir"; then
     AS_BOX([ChangeLogs.])
     echo
     find "$top_srcdir" -name ChangeLog \
@@ -349,26 +371,44 @@ Tests:
       -exec echo "$as_me: {}:" ';' \
       -exec sed 's/^/| /' {} ';' \
       -exec echo ';'
+  fi

-    # Inform about the contents of the config files.
-    for at_file in atconfig atlocal
-    do
-      test -r $at_file || continue
-      echo "$as_me: $at_file:" >&6
-      sed 's/^/| /' $at_file >&6
-      echo
-    done
+  # Inform about the contents of the config files.
+  for at_file in atconfig atlocal
+  do
+    test -r $at_file || continue
+    echo "$as_me: $at_file:"
+    sed 's/^/| /' $at_file
+    echo
+  done

-    AS_BOX([Silently running the tests])
-  } >&6
-else
-  AS_BOX([ERROR: Version mismatch (need $at_package $at_version); no tests 
performed.])
-  exit 1
-fi
+  AS_BOX([Victims.])
+} >&AS_MESSAGE_LOG_FD
+
+# If we are an embedded test suite, be sure to check we are running
+# the proper version of the programs.  And in either case, report
+# what program is being used.
+for at_program in $at_victims
+do
+  (
+    echo "AT_LINE: $at_program --version"
+    $at_program --version
+    echo
+  ) >&AS_MESSAGE_LOG_FD 2>&1
+  if test -n "$at_package_name" && test -n "$at_package_version"; then
+    ($at_program --version |
+      grep "$at_package_name.*$at_package_version") >/dev/null 2>&1 ||
+      AS_ERROR([version mismatch (need $at_package_name $at_package_version): 
$at_program])
+  fi
+done
+
+{
+  AS_BOX([Silently running the tests.])
+} >&AS_MESSAGE_LOG_FD

 at_start_date=`date`
 at_start_time=`(date +%s) 2>/dev/null`
-echo "$as_me: starting at: $at_start_date" >&6
+echo "$as_me: starting at: $at_start_date" >&AS_MESSAGE_LOG_FD
 at_fail_list=
 at_skip_list=
 at_test_count=0
@@ -416,7 +456,7 @@ Tests:
       at_log_msg="$at_test. $at_setup_line: $at_msg"
       # If the test failed, at-times is not available.
       test -f at-times && at_log_msg="$at_log_msg      (`sed 1d at-times`)"
-      echo "$at_log_msg" >&6
+      echo "$at_log_msg" >&AS_MESSAGE_LOG_FD
       $at_stop_on_error && test -n "$at_fail_list" && break
       ;;
   esac
@@ -424,7 +464,7 @@ Tests:

 at_stop_date=`date`
 at_stop_time=`(date +%s) 2>/dev/null`
-echo "$as_me: ending at: $at_stop_date" >&6
+echo "$as_me: ending at: $at_stop_date" >&AS_MESSAGE_LOG_FD
 at_duration_s=`(expr $at_stop_time - $at_start_time) 2>/dev/null`
 at_duration_m=`(expr $at_duration_s / 60) 2>/dev/null`
 at_duration_h=`(expr $at_duration_m / 60) 2>/dev/null`
@@ -432,7 +472,7 @@ Tests:
 at_duration_m=`(expr $at_duration_m % 60) 2>/dev/null`
 at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s"
 if test "$at_duration" != "h m s"; then
-  echo "$as_me: test suite duration: $at_duration" >&6
+  echo "$as_me: test suite duration: $at_duration" >&AS_MESSAGE_LOG_FD
 fi

 # Cleanup everything unless the user wants the files.
@@ -495,7 +535,7 @@ Tests:

     AS_BOX([Verbosely re-running the failing tests])
     echo
-  } >&6
+  } >&AS_MESSAGE_LOG_FD

   $SHELL $[0] -v -d $at_fail_list 2>&1 | tee -a $as_me.log
   AS_BOX([$as_me.log is created.])
@@ -515,6 +555,19 @@ Tests:
 at_data_files="AT_data_files "])])dnl
 ])# AT_INIT

+
+# AT_VICTIMS(PROGRAMS)
+# --------------------
+# Specify the list of programs exercised by the test suite.  Their
+# versions are logged, and in the case of embedded test suite, they
+# must correspond to the version of the package..  The PATH should be
+# already preset so the proper executable will be selected.
+m4_define([AT_VICTIMS],
+[m4_divert_text([DEFAULT],
+[# List of the tested programs.
+at_victims="$1"
+])
+])# AT_VICTIMS


 # AT_SETUP(DESCRIPTION)
Index: tests/suite.at
--- tests/suite.at Fri, 24 Aug 2001 09:22:50 +0200 akim
+++ tests/suite.at Thu, 06 Sep 2001 22:11:47 +0200 akim
@@ -29,7 +29,10 @@
 # like contributing new tests?  If you do, you may tell your intent to
 # address@hidden', so no two people work at the same thing.

-AT_INIT([autoconf])
+AT_INIT
+
+AT_VICTIMS([autom4te autoconf autoheader autoupdate
+            autoreconf])

 AT_BANNER(
 [Some tests might be skipped if you don't have the software which the
Index: tests/tools.at
--- tests/tools.at Fri, 31 Aug 2001 11:22:31 +0200 akim
+++ tests/tools.at Thu, 06 Sep 2001 22:54:32 +0200 akim
@@ -530,14 +530,15 @@ configure:18: error: possibly undefined
 # ----------------------
 AT_SETUP([autoupdating AC_PREREQ])

-cat >expout <<EOF
-AC_PREREQ($at_version)
-EOF
+# Produce `AC_PREREQ(<AUTOUPDATE VERSION>)'.
+AT_CHECK([autoupdate --version | sed 's/.*) //;q'], 0, [stdout])
+autoupdate_version=`cat stdout`
+echo "AC_PREREQ($autoupdate_version)" >expout

 AT_CHECK([echo "AC_PREREQ(1.0)" | autoupdate -],
          0, [expout], [])

-AT_CHECK([echo "AC_PREREQ($at_version)" | autoupdate -],
+AT_CHECK([echo "AC_PREREQ($autoupdate_version)" | autoupdate -],
          0, [expout], [])

 AT_CHECK([echo "AC_PREREQ(999.99)" | autoupdate -],



reply via email to

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