[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] {test-protocols} simple tests: support developer-defined fd
From: |
Stefano Lattarini |
Subject: |
Re: [PATCH] {test-protocols} simple tests: support developer-defined fd redirections |
Date: |
Sun, 31 Jul 2011 11:33:05 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
On Sunday 24 July 2011, Stefano Lattarini wrote:
> Motivated by coreutils bug#8846, and related discussions:
> <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8846>
> <http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00002.html>
> In those threads it has been shown how problematic it can be to do
> portable file descriptor redirections in the testsuite when using
> the Automake testsuite harness. This change should remedy to that
> situation.
>
> * lib/am/check2.am (?GENERIC?%EXT%$(EXEEXT).log,
> ?GENERIC?%EXT%.log, ?!GENERIC?%OBJ%): Append redirection defined
> in $(AM_TESTS_FD_REDIRECT) to the command-line invocations of the
> test scripts.
> * lib/am/check.am [!%?PARALLEL_TESTS%] $(check-TESTS): Likewise.
> * NEWS: Update.
> * tests/check-fd-redirect.test: New test.
> * tests/parallel-tests-fd-redirect.test: Likewise.
> * tests/Makefile.am (TESTS): Update.
> ---
> ChangeLog | 20 ++++++
> NEWS | 3 +
> doc/automake.texi | 18 +++++
> lib/am/check.am | 2 +-
> lib/am/check2.am | 4 +-
> tests/Makefile.am | 2 +
> tests/Makefile.in | 18 +++--
> tests/check-fd-redirect.test | 110
> +++++++++++++++++++++++++++++++++
> tests/parallel-tests-fd-redirect.test | 109 ++++++++++++++++++++++++++++++++
> 9 files changed, 276 insertions(+), 10 deletions(-)
> create mode 100755 tests/check-fd-redirect.test
> create mode 100755 tests/parallel-tests-fd-redirect.test
>
> diff --git a/ChangeLog b/ChangeLog
> index 04ccd4a..34fea0b 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,23 @@
> +2011-07-24 Stefano Lattarini <address@hidden>
> +
> + simple tests: support developer-defined fd redirections
> + Motivated by coreutils bug#8846, and related discussions:
> + <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8846>
> + <http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00002.html>
> + In those threads it has been shown how problematic it can be to do
> + portable file descriptor redirections in the testsuite when using
> + the Automake testsuite harness. This change should remedy to that
> + situation.
> + * lib/am/check2.am (?GENERIC?%EXT%$(EXEEXT).log,
> + ?GENERIC?%EXT%.log, ?!GENERIC?%OBJ%): Append redirection defined
> + in $(AM_TESTS_FD_REDIRECT) to the command-line invocations of the
> + test scripts.
> + * lib/am/check.am [!%?PARALLEL_TESTS%] $(check-TESTS): Likewise.
> + * NEWS: Update.
> + * tests/check-fd-redirect.test: New test.
> + * tests/parallel-tests-fd-redirect.test: Likewise.
> + * tests/Makefile.am (TESTS): Update.
> +
> 2011-07-22 Stefano Lattarini <address@hidden>
>
And please consider this squashed in:
diff --git a/ChangeLog b/ChangeLog
index 34fea0b..da135f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
-2011-07-24 Stefano Lattarini <address@hidden>
+2011-07-31 Stefano Lattarini <address@hidden>
simple tests: support developer-defined fd redirections
Motivated by coreutils bug#8846, and related discussions:
@@ -14,8 +14,15 @@
test scripts.
* lib/am/check.am [!%?PARALLEL_TESTS%] $(check-TESTS): Likewise.
* NEWS: Update.
+ * doc/automake.texi (Script-based Testsuites): Document the new
+ feature.
* tests/check-fd-redirect.test: New test.
* tests/parallel-tests-fd-redirect.test: Likewise.
+ * tests/parallel-tests-am_tests_environment.test: Remove checks
+ about the use of redirections in AM_TESTS_ENVIRONMENT: they would
+ check deprecated (if not undefined) behaviour now. Strengthen a
+ couple of still valid checks, to keep the test more in sync with
+ the documentation. Improve debugging information.
* tests/Makefile.am (TESTS): Update.
2011-07-22 Stefano Lattarini <address@hidden>
diff --git a/tests/parallel-tests-am_tests_environment.test
b/tests/parallel-tests-am_tests_environment.test
index 072e614..436b6df 100755
--- a/tests/parallel-tests-am_tests_environment.test
+++ b/tests/parallel-tests-am_tests_environment.test
@@ -31,27 +31,37 @@ cat > Makefile.am << 'END'
TEST_EXTENSIONS = .sh .test
TESTS = foo.test bar.sh
SH_LOG_COMPILER = sh
-AM_TESTS_ENVIRONMENT = $(MKDIR_P) quux.dir; exec 9>&2; fd=9; export fd;
-EXTRA_DIST = $(TESTS)
+AM_TESTS_ENVIRONMENT = \
+ $(MKDIR_P) quux.dir; \
+ if test -f $(srcdir)/test-env.sh; then \
+ . $(srcdir)/test-env.sh; \
+ fi; \
+ FOO=1; export FOO;
+EXTRA_DIST = $(TESTS) test-env.sh
END
cat > foo.test << 'END'
#! /bin/sh
-echo "FOO='$FOO'"
-echo "BAR='$BAR'"
-test x"$FOO" = x"$BAR"
+ls -l && test -d quux.dir
END
chmod a+x foo.test
cat > bar.sh << 'END'
-: ${fd=2}
-eval "echo 'diagnostic message from test bar' >&${fd}"
+echo "FOO='$FOO'"
+echo "BAR='$BAR'"
+test x"$FOO" = x"$BAR"
END
-minicheck ()
+debug_info ()
{
+ cat test-suite.log
cat foo.log
cat bar.log
+}
+
+minicheck ()
+{
+ debug_info
test -d quux.dir
}
@@ -67,31 +77,17 @@ $AUTOMAKE -a
./configure
-FOO=1; export FOO
-
-TESTS_ENVIRONMENT='BAR=1' $MAKE check || { cat test-suite.log; Exit 1; }
-minicheck
-miniclean
-TESTS_ENVIRONMENT='BAR=2' $MAKE check && { cat test-suite.log; Exit 1; }
+TESTS_ENVIRONMENT='BAR=1' $MAKE check || { debug_info; Exit 1; }
minicheck
miniclean
-BAR=$FOO; export BAR
-
-$MAKE check 2>stderr || { cat stderr >&2; Exit1; }
-cat stderr >&2
+TESTS_ENVIRONMENT='BAR=2' $MAKE check && { debug_info; Exit 1; }
minicheck
-grep 'diagnostic message from test bar' stderr
-grep 'diagnostic message from test bar' bar.log && Exit 1
miniclean
-TESTS_ENVIRONMENT='fd=2' $MAKE check 2>stderr || { cat stderr >&2; Exit1; }
-cat stderr >&2
+echo 'BAR=1 && export BAR' > test-env.sh
+$MAKE check || { debug_info; Exit 1; }
minicheck
-grep 'diagnostic message from test bar' stderr && Exit 1
-grep 'diagnostic message from test bar' bar.log
-miniclean
-
$MAKE distcheck
:
Thanks, and sorry for the noise,
Stefano