selftest: Add option to strip output of succeeded tests, and use it on
authorJelmer Vernooij <jelmer@samba.org>
Fri, 12 Jun 2009 12:34:24 +0000 (14:34 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Fri, 12 Jun 2009 12:34:24 +0000 (14:34 +0200)
the buildfarm.

The matches the behaviour we had earlier in the previous output format.

selftest/Subunit/Filter.pm
selftest/filter-subunit.pl
source4/selftest/config.mk

index 443baeb7ddb8d70944e16318c2e5177274331977..93b690df8ee7c5db4b1263480c3f8bb56a5e2918 100644 (file)
@@ -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);
index 1c25db6f59517dc92a747c023935f43075f1f64c..5a2e5e38ef0af4f7bdb01bc1eecbb45d7927b0fc 100755 (executable)
@@ -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);
 
index e6b338b9e78c86645018eb5bf6e473632249040e..27ea35d92cb9ba0acbf5ec2e6bbed24c24b4f15c 100644 (file)
@@ -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