From 718f9be8a2530a11e1cb16b68511b4c910a1c320 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 12 Jun 2009 14:34:24 +0200 Subject: [PATCH] selftest: Add option to strip output of succeeded tests, and use it on the buildfarm. The matches the behaviour we had earlier in the previous output format. --- selftest/Subunit/Filter.pm | 20 ++++++++++++++++++-- selftest/filter-subunit.pl | 5 ++++- source4/selftest/config.mk | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/selftest/Subunit/Filter.pm b/selftest/Subunit/Filter.pm index 443baeb7ddb..93b690df8ee 100644 --- a/selftest/Subunit/Filter.pm +++ b/selftest/Subunit/Filter.pm @@ -54,7 +54,11 @@ sub report_time($$) sub output_msg($$) { my ($self, $msg) = @_; - print $msg; + unless(defined($self->{output})) { + print $msg; + } else { + $self->{output}.=$msg; + } } sub start_test($$) @@ -65,6 +69,10 @@ sub start_test($$) $testname = $self->{prefix}.$testname; } + if ($self->{strip_ok_output}) { + $self->{output} = ""; + } + Subunit::start_test($testname); } @@ -87,6 +95,13 @@ sub end_test($$$$$) $reason .= $xfail_reason; } + if ($self->{strip_ok_output}) { + unless ($result eq "success" or $result eq "xfail" or $result eq "skip") { + print $self->{output} + } + } + $self->{output} = undef; + Subunit::end_test($testname, $result, $reason); } @@ -120,11 +135,12 @@ sub testsuite_count($$) } sub new { - my ($class, $prefix, $expected_failures) = @_; + my ($class, $prefix, $expected_failures, $strip_ok_output) = @_; my $self = { prefix => $prefix, expected_failures => $expected_failures, + strip_ok_output => $strip_ok_output, xfail_added => 0, }; bless($self, $class); diff --git a/selftest/filter-subunit.pl b/selftest/filter-subunit.pl index 1c25db6f595..5a2e5e38ef0 100755 --- a/selftest/filter-subunit.pl +++ b/selftest/filter-subunit.pl @@ -62,10 +62,12 @@ use Subunit::Filter; my $opt_expected_failures = undef; my $opt_help = 0; my $opt_prefix = undef; +my $opt_strip_ok_output = 0; my @expected_failures = (); my $result = GetOptions( 'expected-failures=s' => \$opt_expected_failures, + 'strip-passed-output' => \$opt_strip_ok_output, 'prefix=s' => \$opt_prefix, 'help' => \$opt_help, ); @@ -89,7 +91,8 @@ my $statistics = { TESTS_SKIP => 0, }; -my $msg_ops = new Subunit::Filter($opt_prefix, \@expected_failures); +my $msg_ops = new Subunit::Filter($opt_prefix, \@expected_failures, + $opt_strip_ok_output); parse_results($msg_ops, $statistics, *STDIN); diff --git a/source4/selftest/config.mk b/source4/selftest/config.mk index e6b338b9e78..27ea35d92cb 100644 --- a/source4/selftest/config.mk +++ b/source4/selftest/config.mk @@ -19,7 +19,7 @@ slowtest:: everything ifeq ($(RUN_FROM_BUILD_FARM),yes) test:: everything - $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) $(TESTS) | $(FILTER_XFAIL) + $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) $(TESTS) | $(FILTER_XFAIL) --strip-passed-output else test:: everything $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) $(TESTS) | $(FORMAT_TEST_OUTPUT) --immediate -- 2.34.1