bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] init.sh: make it easier for a test script to write to the tty, .


From: Jim Meyering
Subject: [PATCH] init.sh: make it easier for a test script to write to the tty, ...
Date: Mon, 05 Apr 2010 10:01:52 +0200

FYI,

>From b8b72c1b316e0db012f9d2e2dc6b7028bd5e96c2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 5 Apr 2010 10:01:07 +0200
Subject: [PATCH] init.sh: make it easier for a test script to write to the tty, 
...

when using automake's parallel-tests mode.
* tests/init.sh (stderr_fileno_): Define overridable variable.
(warn_): New function, to use it.
(fail_, skip_, framework_failure_): Use warn_.
---
 ChangeLog     |    8 ++++++++
 tests/init.sh |   14 ++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0136995..b0dfa6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-04-05  Jim Meyering  <address@hidden>
+
+       init.sh: make it easier for a test script to write to the tty, ...
+       when using automake's parallel-tests mode.
+       * tests/init.sh (stderr_fileno_): Define overridable variable.
+       (warn_): New function, to use it.
+       (fail_, skip_, framework_failure_): Use warn_.
+
 2010-04-04  Bruno Haible  <address@hidden>

        btowc: Avoid warning.
diff --git a/tests/init.sh b/tests/init.sh
index 3154f59..23ab131 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -96,8 +96,18 @@ test -n "$EXEEXT" && shopt -s expand_aliases
 # sh inside this function.
 Exit () { set +e; (exit $1); exit $1; }

-fail_() { echo "$ME_: failed test: $@" 1>&2; Exit 1; }
-skip_() { echo "$ME_: skipped test: $@" 1>&2; Exit 77; }
+# Print warnings (e.g., about skipped and failed tests) to this file number.
+# Override by defining to say, 9, in init.cfg, and putting say,
+# "export ...ENVVAR_SETTINGS...; exec 9>&2; $(SHELL)" in the definition
+# of TESTS_ENVIRONMENT in your tests/Makefile.am file.
+# This is useful when using automake's parallel tests mode, to print
+# the reason for skip/failure to console, rather than to the .log files.
+${stderr_fileno_=2}
+
+warn_() { echo "$@" 1>&$stderr_fileno_; }
+fail_() { warn_ "$ME_: failed test: $@"; Exit 1; }
+skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; }
+framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 1; }

 # This is a stub function that is run upon trap (upon regular exit and
 # interrupt).  Override it with a per-test function, e.g., to unmount
--
1.7.0.4.529.g78fb




reply via email to

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