Subject: Re: bug#9546: parallel-tests: auxiliary script `test-driver' is not distributed when TESTS is defined in a subdir Makefile (regression in branch test-protocols)

From: Stefano Lattarini <[email-masked]>
Date: Sun, 18 Sep 2011 20:45:37 +0200

On Sunday 18 September 2011, Stefano Lattarini wrote:
> Severity: serious
> 
> The bug is demonstrated by the attached test script.
> I hope I'll be able to take a look into it soonish.
> 
The test script has a couple of bugs, which I've now fixed.  Attached
is the patch I've pushed to expose the bug.

Note that the following squash-in is enough to cause the test to pass:

  diff --git a/tests/test-driver-is-distributed.test b/tests/test-driver-is-distributed.test
  index 09ea45a..4bb03d7 100755
  --- a/tests/test-driver-is-distributed.test
  +++ b/tests/test-driver-is-distributed.test
  @@ -29,6 +29,7 @@ END
   mkdir tests
 
   cat > Makefile.am << 'END'
  +TESTS=
   SUBDIRS = tests
   test0:
   	echo ' ' $(DIST_COMMON) ' ' | grep '[ /]test-driver '

Regards,
  Stefano
From f15d31661ef94e5d549dbdfb0f60cea1bc17683a Mon Sep 17 00:00:00 2001
Message-Id: <f15d31661[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Sun, 18 Sep 2011 20:42:56 +0200
Subject: [PATCH] parallel-tests: expose automake bug#9546

* tests/test-driver-is-distributed.test: New test.
* tests/Makefile.am (TESTS, XFAIL_TESTS): Add it.
---
 ChangeLog                             |    6 +++
 tests/Makefile.am                     |    2 +
 tests/Makefile.in                     |    4 ++-
 tests/test-driver-is-distributed.test |   59 +++++++++++++++++++++++++++++++++
 4 files changed, 70 insertions(+), 1 deletions(-)
 create mode 100755 tests/test-driver-is-distributed.test

diff --git a/ChangeLog b/ChangeLog
index 8024777..856c92f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-18  Stefano Lattarini  <[email-masked]>
+
+	parallel-tests: expose automake bug#9546
+	* tests/test-driver-is-distributed.test: New test.
+	* tests/Makefile.am (TESTS, XFAIL_TESTS): Add it.
+
 2011-09-16  Stefano Lattarini  <[email-masked]>
 
 	automake: remove special handling of `ANSI2KNR' make variable
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c2b19ca..2e7e17f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -33,6 +33,7 @@ java-nobase.test \
 pr8365-remake-timing.test \
 yacc-dist-nobuild-subdir.test \
 vala-vpath.test \
+test-driver-is-distributed.test \
 txinfo5.test

@@ -773,6 +774,7 @@ test-driver-create-log-dir.test \
 test-driver-strip-vpath.test \
 test-driver-trs-suffix-registered.test \
 test-driver-fail.test \
+test-driver-is-distributed.test \
 test-harness-vpath-rewrite.test \
 test-log.test \
 test-metadata-global-log.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index f118c87..8248330 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -290,7 +290,8 @@ EXTRA_DIST = ChangeLog-old gen-parallel-tests instspc-tests.sh \
 XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \
 	override-conditional-2.test java-nobase.test \
 	pr8365-remake-timing.test yacc-dist-nobuild-subdir.test \
-	vala-vpath.test txinfo5.test $(instspc_xfail_tests)
+	vala-vpath.test test-driver-is-distributed.test txinfo5.test \
+	$(instspc_xfail_tests)
 parallel_tests = check-concurrency-bug9245-p.test \
 	check-exported-srcdir-p.test check-fd-redirect-p.test \
 	check-tests-in-builddir-p.test check-p.test check11-p.test \
@@ -1031,6 +1032,7 @@ test-driver-create-log-dir.test \
 test-driver-strip-vpath.test \
 test-driver-trs-suffix-registered.test \
 test-driver-fail.test \
+test-driver-is-distributed.test \
 test-harness-vpath-rewrite.test \
 test-log.test \
 test-metadata-global-log.test \
diff --git a/tests/test-driver-is-distributed.test b/tests/test-driver-is-distributed.test
new file mode 100755
index 0000000..09ea45a
--- /dev/null
+++ b/tests/test-driver-is-distributed.test
@@ -0,0 +1,59 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check regression of parallel-tests:
+#  - `test-driver' script not correctly distributed when TESTS is
+#    defined in a subdir Makefile
+
+parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([tests/Makefile])
+AC_OUTPUT
+END
+
+mkdir tests
+
+cat > Makefile.am << 'END'
+SUBDIRS = tests
+test0:
+	echo ' ' $(DIST_COMMON) ' ' | grep '[ /]test-driver '
+test1: distdir
+	ls -l $(distdir) $(distdir)/* ;: For debugging.
+	test -f $(distdir)/test-driver
+.PHONY: test0 test1
+END
+
+cat > tests/Makefile.am << 'END'
+TESTS = foo.test
+EXTRA_DIST = $(TESTS)
+END
+
+cat > tests/foo.test << 'END'
+#!/bin/sh
+exit 0
+END
+chmod a+x tests/foo.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+$MAKE test0 test1
+$MAKE distcheck
+
+:
-- 
1.7.2.3