Re: [PATCH v1] Fix misuse of DejaGnu in Automake testsuite

2021-07-15 Thread Jim Meyering
On Tue, Jul 13, 2021 at 9:39 PM Jacob Bachmeyer  wrote:
> This is a revised patch that changes the DejaGnu tests in the Automake
> testsuite to properly use a testsuite/ directory.  A previous "v0" of
> this patch was sent to the general Automake list as an illustration of
> the problem, but that version of the patch broke compatibility with all
> older releases of DejaGnu.  This version instead uses recursive make to
> run DejaGnu in the testsuite/ directory in each case.  This works with
> older versions of DejaGnu and this usage of DejaGnu will continue to be
> supported for the foreseeable future.
>
> On a side note, DejaGnu can now be run from its source tree or a Git
> working tree.  While the Automake testsuite does not seem to provide a
> way to set RUNTEST to point to an alternate runtest, "
> PATH=/where/you/put/dejagnu-1.6.3:$PATH make check " will use an
> unpacked version of the 1.6.3 release even if the system has an older
> version installed.  Older versions of DejaGnu did not support this reliably.

I confirmed that all tests pass for me on Fedora 34,
both with dejagnu-1.6.1 and with 1.6.3.
I've pushed that with a ChangeLog and NEWS added by Karl.
Thanks to both of you!



[PATCH v1] Fix misuse of DejaGnu in Automake testsuite

2021-07-13 Thread Jacob Bachmeyer
This is a revised patch that changes the DejaGnu tests in the Automake 
testsuite to properly use a testsuite/ directory.  A previous "v0" of 
this patch was sent to the general Automake list as an illustration of 
the problem, but that version of the patch broke compatibility with all 
older releases of DejaGnu.  This version instead uses recursive make to 
run DejaGnu in the testsuite/ directory in each case.  This works with 
older versions of DejaGnu and this usage of DejaGnu will continue to be 
supported for the foreseeable future.


On a side note, DejaGnu can now be run from its source tree or a Git 
working tree.  While the Automake testsuite does not seem to provide a 
way to set RUNTEST to point to an alternate runtest, " 
PATH=/where/you/put/dejagnu-1.6.3:$PATH make check " will use an 
unpacked version of the 1.6.3 release even if the system has an older 
version installed.  Older versions of DejaGnu did not support this reliably.


8<--
diff -urN -x '*~' automake-1.16.3/t/check12.sh 
automake-1.16.3-patch/t/check12.sh
--- automake-1.16.3/t/check12.sh2020-11-18 19:21:03.0 -0600
+++ automake-1.16.3-patch/t/check12.sh  2021-07-13 21:49:22.900870882 -0500
@@ -22,6 +22,7 @@
. test-init.sh

cat >> configure.ac << 'END'
+AC_CONFIG_FILES([testsuite/Makefile])
AC_OUTPUT
END

@@ -56,12 +57,17 @@
## DejaGnu tests.

cat >> Makefile.am << 'END'
-AUTOMAKE_OPTIONS += dejagnu
+SUBDIRS = testsuite
+EXTRA_DIST += hammer spanner
+END
+
+mkdir testsuite
+
+cat >> testsuite/Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
DEJATOOL = hammer spanner
-AM_RUNTESTFLAGS = HAMMER=$(srcdir)/hammer SPANNER=$(srcdir)/spanner
-EXTRA_DIST += $(DEJATOOL)
-EXTRA_DIST += hammer.test/hammer.exp
-EXTRA_DIST += spanner.test/spanner.exp
+AM_RUNTESTFLAGS = HAMMER=$(top_srcdir)/hammer SPANNER=$(top_srcdir)/spanner
+EXTRA_DIST = hammer.test/hammer.exp spanner.test/spanner.exp
END

cat > hammer << 'END'
@@ -77,9 +83,9 @@
END
chmod +x hammer spanner

-mkdir hammer.test spanner.test
+mkdir testsuite/hammer.test testsuite/spanner.test

-cat > hammer.test/hammer.exp << 'END'
+cat > testsuite/hammer.test/hammer.exp << 'END'
set test test_hammer
spawn $HAMMER
expect {
@@ -88,7 +94,7 @@
}
END

-cat > spanner.test/spanner.exp << 'END'
+cat > testsuite/spanner.test/spanner.exp << 'END'
set test test_spanner
spawn $SPANNER
expect {
@@ -133,10 +139,10 @@
  $srcdir/configure

  $MAKE check
-  test -f hammer.log
-  test -f hammer.sum
-  test -f spanner.log
-  test -f spanner.sum
+  test -f testsuite/hammer.log
+  test -f testsuite/hammer.sum
+  test -f testsuite/spanner.log
+  test -f testsuite/spanner.sum
  if test x"$am_serial_tests" != x"yes"; then
test -f test-suite.log
test -f a.log
@@ -147,10 +153,10 @@
  cp -f config.status config-status.sav

  $MAKE distclean
-  test ! -e hammer.log
-  test ! -e hammer.sum
-  test ! -e spanner.log
-  test ! -e spanner.sum
+  test ! -e testsuite/hammer.log
+  test ! -e testsuite/hammer.sum
+  test ! -e testsuite/spanner.log
+  test ! -e testsuite/spanner.sum
  test ! -e test-suite.log
  test ! -e a.log
  test ! -e b.log
@@ -160,12 +166,12 @@
  ./config.status

  NAIL=screw $MAKE check && exit 1
-  test -f hammer.log
-  test -f hammer.sum
-  test -f spanner.log
-  test -f spanner.sum
-  grep 'FAIL: test_hammer' hammer.sum
-  grep 'FAIL:' spanner.sum && exit 1
+  test -f testsuite/hammer.log
+  test -f testsuite/hammer.sum
+  test -f testsuite/spanner.log
+  test -f testsuite/spanner.sum
+  grep 'FAIL: test_hammer' testsuite/hammer.sum
+  grep 'FAIL:' testsuite/spanner.sum && exit 1

  B_EXIT_STATUS=1 $MAKE check && exit 1
  if test x"$am_serial_tests" != x"yes"; then
@@ -185,12 +191,12 @@

  # Do not trust the exit status of 'make -k'.
  NAIL=screw B_EXIT_STATUS=23 CHECKLOCAL_EXIT_STATUS=1 $MAKE -k check || :
-  test -f hammer.log
-  test -f hammer.sum
-  test -f spanner.log
-  test -f spanner.sum
-  grep 'FAIL: test_hammer' hammer.sum
-  grep 'FAIL:' spanner.sum && exit 1
+  test -f testsuite/hammer.log
+  test -f testsuite/hammer.sum
+  test -f testsuite/spanner.log
+  test -f testsuite/spanner.sum
+  grep 'FAIL: test_hammer' testsuite/hammer.sum
+  grep 'FAIL:' testsuite/spanner.sum && exit 1
  if test x"$am_serial_tests" != x"yes"; then
cat test-suite.log
cat a.log
diff -urN -x '*~' automake-1.16.3/t/dejagnu3.sh 
automake-1.16.3-patch/t/dejagnu3.sh
--- automake-1.16.3/t/dejagnu3.sh   2020-11-18 19:21:03.0 -0600
+++ automake-1.16.3-patch/t/dejagnu3.sh 2021-07-13 22:04:45.653614878 -0500
@@ -27,19 +27,27 @@
chmod +x hammer

cat >> configure.ac << 'END'
+AC_CONFIG_FILES([testsuite/Makefile])
AC_OUTPUT
END

cat > Makefile.am << 'END'
+SUBDIRS = testsuite
+EXTRA_DIST = hammer
+END
+
+mkdir testsuite
+
+cat > testsuite/Makefile.am << 'END'
AUTOMAKE_OPTIONS = dejagnu
DEJATOOL = hammer
-AM_RUNTESTFLAGS = HAMMER=$(srcdir)/hammer
-EXTRA_DIST = hammer hammer.test/hammer.exp
+AM_RUNTESTFLAGS = HAMMER=$(top_srcdir)/hammer
+EXTRA_DIST = hammer.test/hammer.exp
END

-mkdir