mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
selftest: Fix subunit stream to include the right prefixes rather than
extending the subunit protocol.
This commit is contained in:
parent
c278ee50ee
commit
4308e69084
@ -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
|
||||
============
|
||||
|
@ -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";
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -8,7 +8,7 @@ SELFTEST = $(LD_LIBPATH_OVERRIDE) PYTHON=$(PYTHON) \
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user