summaryrefslogtreecommitdiff
path: root/selftest
diff options
context:
space:
mode:
Diffstat (limited to 'selftest')
-rw-r--r--selftest/README35
-rwxr-xr-xselftest/filter-subunit.pl (renamed from selftest/filter-xfail.pl)27
-rwxr-xr-xselftest/selftest.pl2
3 files changed, 51 insertions, 13 deletions
diff --git a/selftest/README b/selftest/README
index 83a3e6fd49..a8c5101a61 100644
--- a/selftest/README
+++ b/selftest/README
@@ -77,12 +77,37 @@ time: YYYY-MM-DD HH:mm:ssZ
Announce the current time. This may be used to calculate the duration of
various tests.
-prefix
-~~~~~~
-prefix: Prefix
+The following are Samba extensions to Subunit:
-Change the global prefix for test names. To unset the prefix, specify an empty
-string.
+testsuite-count
+~~~~~~~~~~~~~~~
+testsuite-count: number
+
+Announce the number of tests that is going to be run.
+
+start-testsuite
+~~~~~~~~~
+start-testsuite: name
+
+The testsuite name is used as prefix for all containing tests.
+
+skip-testsuite
+~~~~~~~~~~~~~~
+skip-testsuite: name
+
+Mark the testsuite with the specified name as skipped.
+
+testsuite-success
+~~~~~~~~~~~~~~~~~
+testsuite-success: name
+
+Indicate that the testsuite has succeeded successfully.
+
+testsuite-fail
+~~~~~~~~~~~~~~
+testsuite-fail: name
+
+Indicate that a testsuite has failed.
Environments
============
diff --git a/selftest/filter-xfail.pl b/selftest/filter-subunit.pl
index f41bb77f44..9a2c6f556c 100755
--- a/selftest/filter-xfail.pl
+++ b/selftest/filter-subunit.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# Fix fail -> xfail in subunit streams based on a list of regular expressions
+# Filter a subunit stream
# Copyright (C) Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU GPL, v3 or later
@@ -7,13 +7,13 @@
=head1 NAME
-filter-xfail - Filter known failures in a subunit stream
+filter-subunit - Filter a subunit stream
=head1 SYNOPSIS
-filter-xfail --help
+filter-subunit --help
-filter-xfail --known-failures=FILE < in-stream > out-stream
+filter-subunit --prefix=PREFIX --known-failures=FILE < in-stream > out-stream
=head1 DESCRIPTION
@@ -24,6 +24,10 @@ based on a list of regular expressions.
=over 4
+=item I<--prefix>
+
+Add the specified prefix to all test names.
+
=item I<--expected-failures>
Specify a file containing a list of tests that are expected to fail. Failures
@@ -57,16 +61,18 @@ use Subunit qw(parse_results);
my $opt_expected_failures = undef;
my $opt_help = 0;
+my $opt_prefix = undef;
my @expected_failures = ();
my $result = GetOptions(
'expected-failures=s' => \$opt_expected_failures,
+ 'prefix=s' => \$opt_prefix,
'help' => \$opt_help,
);
exit(1) if (not $result);
if ($opt_help) {
- print "Usage: filter-xfail [--expected-failures=FILE]... < instream > outstream\n";
+ print "Usage: filter-subunit [--prefix=PREFIX] [--expected-failures=FILE]... < instream > outstream\n";
exit(0);
}
@@ -145,6 +151,10 @@ sub start_test($$$)
{
my ($self, $parents, $testname) = @_;
+ if (defined($opt_prefix)) {
+ $testname = $opt_prefix.$testname;
+ }
+
Subunit::start_test($testname);
}
@@ -152,9 +162,12 @@ sub end_test($$$$$)
{
my ($self, $parents, $testname, $result, $unexpected, $reason) = @_;
+ if (defined($opt_prefix)) {
+ $testname = $opt_prefix.$testname;
+ }
+
if (($result eq "fail" or $result eq "failure") and not $unexpected) { $result = "xfail"; }
- my $fullname = join(".", @$parents) . ".$testname";
- if (expecting_failure($fullname) and ($result eq "fail" or $result eq "failure")) {
+ if (expecting_failure($testname) and ($result eq "fail" or $result eq "failure")) {
$result = "xfail";
}
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 38ea0df39b..2387904b7a 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -220,7 +220,7 @@ sub run_testsuite($$$$$)
Subunit::prefix($name);
Subunit::start_test($name);
- my $ret = system("$cmd 2>&1");
+ my $ret = system("$cmd | $RealBin/filter-subunit.pl --prefix \"$name.\" 2>&1");
if ($ret == -1) {
Subunit::end_test($name, "error", "Unable to run $cmd: $!");
return 0;