summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2011-08-19 10:21:01 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2011-08-19 10:21:01 +0200
commit82796c70d0a67f9af403fd010add959861c0ba40 (patch)
tree7d29fcd8ded34be2462998d3746c3e2cb2648021 /lib
parentfa03ed7900f304fca5eb5e277a4f70b01dbd73b7 (diff)
parent271343d8ef023b9891d9b06bce5e62268f8b50e5 (diff)
downloadautomake-82796c70d0a67f9af403fd010add959861c0ba40.tar.gz
Merge branch 'test-protocols' into testsuite-work
* test-protocols: testsuite: fix some redundant autotools calls in tests on TAP * THANKS (Daniel Richard G.): Update e-mail address. java: avoid compilation errors when CLASSPATH is empty parallel-tests: no more spurious successes for FreeBSD make tap: improve granularity for tests on problematic TAP messages tap: correctly handle string "0" in TAP messages tap: a minor simplification in the perl TAP driver parallel-tests: fix help screen for test driver scripts tap: add a dummy TAP driver script implemented in shell + awk testsuite: refactor tests on TAP support in view of future changes fix: regenerate tests/Makefile.in hacking: we now require autoconf 2.68
Diffstat (limited to 'lib')
-rw-r--r--lib/Automake/tests/Makefile.in2
-rw-r--r--lib/Makefile.am25
-rw-r--r--lib/Makefile.in25
-rw-r--r--lib/am/check.am9
-rw-r--r--lib/am/java.am2
-rwxr-xr-xlib/tap-driver.pl (renamed from lib/tap-driver)39
-rwxr-xr-xlib/tap-driver.sh123
-rwxr-xr-xlib/test-driver4
8 files changed, 198 insertions, 31 deletions
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index 558f80790..89ec5b2fb 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -479,7 +479,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
fi; \
echo "$$col$$br$$std"; \
fi; \
- $$success
+ $$success || exit 1
# Run all the tests.
check-TESTS:
diff --git a/lib/Makefile.am b/lib/Makefile.am
index a9467f1f1..bc234ee81 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -2,8 +2,8 @@
## Makefile for Automake lib.
-# Copyright (C) 2001, 2003, 2004, 2009, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2003, 2004, 2009, 2010, 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
@@ -27,9 +27,24 @@ dist_pkgvdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \
## _SCRIPTS, then the program transform will be applied, which is not
## what we want. So we make them executable by hand.
scriptdir = $(pkgvdatadir)
-dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \
- mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile \
- symlink-tree ar-lib test-driver tap-driver
+dist_script_DATA = \
+ config.guess \
+ config.sub \
+ install-sh \
+ mdate-sh \
+ missing \
+ mkinstalldirs \
+ elisp-comp \
+ ylwrap \
+ acinstall \
+ depcomp \
+ compile \
+ py-compile \
+ symlink-tree \
+ ar-lib \
+ test-driver \
+ tap-driver.sh \
+ tap-driver.pl
EXTRA_DIST = gnupload
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 5bf597e6b..769446f69 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -15,8 +15,8 @@
@SET_MAKE@
-# Copyright (C) 2001, 2003, 2004, 2009, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2003, 2004, 2009, 2010, 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
@@ -245,9 +245,24 @@ dist_pkgvdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \
config-ml.in
scriptdir = $(pkgvdatadir)
-dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \
- mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile \
- symlink-tree ar-lib test-driver tap-driver
+dist_script_DATA = \
+ config.guess \
+ config.sub \
+ install-sh \
+ mdate-sh \
+ missing \
+ mkinstalldirs \
+ elisp-comp \
+ ylwrap \
+ acinstall \
+ depcomp \
+ compile \
+ py-compile \
+ symlink-tree \
+ ar-lib \
+ test-driver \
+ tap-driver.sh \
+ tap-driver.pl
EXTRA_DIST = gnupload
all: all-recursive
diff --git a/lib/am/check.am b/lib/am/check.am
index 27388df02..0628c8661 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -295,8 +295,13 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
fi; \
echo "$$col$$br$$std"; \
fi; \
-## Be sure to exit with the proper exit status.
- $$success
+## Be sure to exit with the proper exit status. The use of "exit 1" below
+## is required to work around a FreeBSD make bug (present only when running
+## in concurrent mode). See automake bug#9245:
+## <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9245>
+## and FreeBSD PR bin/159730:
+## <http://www.freebsd.org/cgi/query-pr.cgi?pr=159730>.
+ $$success || exit 1
RECHECK_LOGS = $(TEST_LOGS)
diff --git a/lib/am/java.am b/lib/am/java.am
index d6eb45585..604df2229 100644
--- a/lib/am/java.am
+++ b/lib/am/java.am
@@ -21,7 +21,7 @@
## ---------- ##
JAVAC = javac
-CLASSPATH_ENV = CLASSPATH=$(JAVAROOT):$(srcdir)/$(JAVAROOT):$$CLASSPATH
+CLASSPATH_ENV = CLASSPATH=$(JAVAROOT):$(srcdir)/$(JAVAROOT)$${CLASSPATH:+":$$CLASSPATH"}
JAVAROOT = $(top_builddir)
class%DIR%.stamp: $(%DIR%_JAVA)
diff --git a/lib/tap-driver b/lib/tap-driver.pl
index 95fb78ce7..7043815f3 100755
--- a/lib/tap-driver
+++ b/lib/tap-driver.pl
@@ -11,7 +11,7 @@ use strict;
use Getopt::Long ();
use TAP::Parser;
-my $ME = "tap-driver";
+my $ME = "tap-driver.pl";
my $USAGE = <<'END';
Usage:
@@ -20,7 +20,7 @@ Usage:
[--enable-hard-errors={yes|no}] [--ignore-exit]
[--diagnostic-string=STRING] [--merge|--no-merge]
[--comments|--no-comments] [--] TEST-COMMAND
-The `--test-name' and `--log-file' options are mandatory.
+The `--test-name', `--log-file' and `--trs-file' options are mandatory.
END
my $HELP = "$ME: TAP-aware test driver for Automake testsuite harness." .
@@ -63,7 +63,6 @@ my $plan_seen = NO_PLAN;
my %cfg = (
"color-tests" => 0,
"expect-failure" => 0,
- "enable-hard-errors" => 1,
"merge" => 0,
"comments" => 0,
"ignore-exit" => 0,
@@ -82,7 +81,7 @@ Getopt::Long::GetOptions (
'trs-file=s' => \$trs_file,
'color-tests=s' => \&bool_opt,
'expect-failure=s' => \&bool_opt,
- 'enable-hard-errors=s' => \&bool_opt,
+ 'enable-hard-errors=s' => sub {}, # No-op.
'diagnostic-string=s' => \$diag_string,
'comments' => sub { $cfg{"comments"} = 1; },
'no-comments' => sub { $cfg{"comments"} = 0; },
@@ -107,6 +106,7 @@ sub get_test_results ();
sub handle_tap_bailout ($);
sub handle_tap_plan ($);
sub handle_tap_test ($);
+sub is_null_string ($);
sub main (@);
sub must_recheck ();
sub report ($;$);
@@ -137,6 +137,16 @@ sub bool_opt ($$)
}
}
+# If the given string is undefined or empty, return true, otherwise
+# return false. This function is useful to avoid pitfalls like:
+# if ($message) { print "$message\n"; }
+# which wouldn't print anything if $message is the literal "0".
+sub is_null_string ($)
+{
+ my $str = shift;
+ return ! (defined $str and length $str);
+}
+
# Convert a boolean to a "yes"/"no" string.
sub yn ($)
{
@@ -330,10 +340,9 @@ sub handle_tap_test ($)
my $test_result = stringify_test_result $test;
my $string = $test->number;
- if (my $description = $test->description)
- {
- $string .= " $description";
- }
+ my $description = $test->description;
+ $string .= " $description"
+ unless is_null_string $description;
if ($plan_seen == LATE_PLAN)
{
@@ -350,10 +359,9 @@ sub handle_tap_test ($)
elsif (my $directive = $test->directive)
{
$string .= " # $directive";
- if (my $explanation = $test->explanation)
- {
- $string .= " $explanation";
- }
+ my $explanation = $test->explanation;
+ $string .= " $explanation"
+ unless is_null_string $explanation;
}
report $test_result, $string;
@@ -382,8 +390,8 @@ sub handle_tap_plan ($)
# of SKIP result.
if ($plan->directive && $testno == 0)
{
- my $explanation = $plan->explanation ?
- "- " . $plan->explanation : undef;
+ my $explanation = is_null_string ($plan->explanation) ?
+ undef : "- " . $plan->explanation;
report "SKIP", $explanation;
}
}
@@ -392,7 +400,8 @@ sub handle_tap_bailout ($)
{
my ($bailout, $msg) = ($_[0], "Bail out!");
$bailed_out = 1;
- $msg .= " " . $bailout->explanation if $bailout->explanation;
+ $msg .= " " . $bailout->explanation
+ unless is_null_string $bailout->explanation;
testsuite_error $msg;
}
diff --git a/lib/tap-driver.sh b/lib/tap-driver.sh
new file mode 100755
index 000000000..322e3c4f3
--- /dev/null
+++ b/lib/tap-driver.sh
@@ -0,0 +1,123 @@
+#! /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/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+scriptversion=2011-08-17.14; # UTC
+
+# Make unconditional expansion of undefined variables an error. This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+fatal ()
+{
+ echo "$0: fatal: $*" >&2
+ exit 1
+}
+
+usage_error ()
+{
+ echo "$0: $*" >&2
+ print_usage >&2
+ exit 2
+}
+
+print_usage ()
+{
+ cat <<END
+Usage:
+ tap-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+ [--expect-failure={yes|no}] [--color-tests={yes|no}]
+ [--enable-hard-errors={yes|no}] [--ignore-exit]
+ [--diagnostic-string=STRING] [--merge|--no-merge]
+ [--comments|--no-comments] [--] TEST-COMMAND
+The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory.
+END
+}
+
+# TODO: better error handling in option parsing (in particular, ensure
+# TODO: $log_file, $trs_file and $test_name are defined).
+test_name= # Used for reporting.
+log_file= # Where to save the result and output of the test script.
+trs_file= # Where to save the metadata of the test run.
+expect_failure=no
+color_tests=no
+merge=no
+ignore_exit=no
+comments=no
+diag_string='#'
+while test $# -gt 0; do
+ case $1 in
+ --help) print_usage; exit $?;;
+ --version) echo "tap-driver $scriptversion"; exit $?;;
+ --test-name) test_name=$2; shift;;
+ --log-file) log_file=$2; shift;;
+ --trs-file) trs_file=$2; shift;;
+ --color-tests) color_tests=$2; shift;;
+ --expect-failure) expect_failure=$2; shift;;
+ --enable-hard-errors) shift;; # No-op.
+ --merge) merge=yes;;
+ --no-merge) merge=no;;
+ --ignore-exit) ignore_exit=yes;;
+ --comments) comments=yes;;
+ --no-comments) comments=no;;
+ --diag-string) diag_string=$2; shift;;
+ --) shift; break;;
+ -*) usage_error "invalid option: '$1'";;
+ esac
+ shift
+done
+
+test $# -gt 0 || usage_error "missing test command"
+
+case $expect_failure in
+ yes) expect_failure=1;;
+ *) expect_failure=0;;
+esac
+
+if test $color_tests = yes; then
+ red='' # Red.
+ grn='' # Green.
+ lgn='' # Light green.
+ blu='' # Blue.
+ mgn='' # Magenta.
+ std='' # No color.
+else
+ red= grn= lgn= blu= mgn= std=
+fi
+
+# TODO: test script is run here.
+# "$@" | [our magic awk script]
+
+echo "$0: still to be implemented, sorry" >&2
+exit 255
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/lib/test-driver b/lib/test-driver
index 8522a49d9..b89107c05 100755
--- a/lib/test-driver
+++ b/lib/test-driver
@@ -1,7 +1,7 @@
#! /bin/sh
# test-driver - basic driver script for the `parallel-tests' mode.
-scriptversion=2011-08-04.22; # UTC
+scriptversion=2011-08-17.14; # UTC
# Copyright (C) 2011 Free Software Foundation, Inc.
#
@@ -45,7 +45,7 @@ Usage:
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--enable-hard-errors={yes|no}] [--] TEST-SCRIPT
-The \`--test-name' and \`--log-file' options are mandatory.
+The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory.
END
}