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
============
#!/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
=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
=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
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);
}
{
my ($self, $parents, $testname) = @_;
+ if (defined($opt_prefix)) {
+ $testname = $opt_prefix.$testname;
+ }
+
Subunit::start_test($testname);
}
{
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";
}
SELFTEST_NOSLOW_OPTS = --exclude=$(srcdir)/selftest/slow
SELFTEST_QUICK_OPTS = $(SELFTEST_NOSLOW_OPTS) --quick --include=$(srcdir)/selftest/quick
-FILTER_XFAIL = $(PERL) $(selftestdir)/filter-xfail.pl --expected-failures=$(srcdir)/selftest/knownfail
+FILTER_XFAIL = $(PERL) $(selftestdir)/filter-subunit.pl --expected-failures=$(srcdir)/selftest/knownfail
FORMAT_TEST_OUTPUT = $(FILTER_XFAIL) | $(PERL) $(selftestdir)/format-subunit.pl --format=$(TEST_FORMAT)
subunittest:: everything