diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-03-30 14:42:23 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-03-31 02:20:08 +0200 |
commit | 6c299d28b56dd237792cc80c15c6169e701b4a97 (patch) | |
tree | 3667bfdb69a8b7d9f9dc513f11335be4767cd5f3 | |
parent | 7f1360db5123b61cd4473f54d4fb55746c5d8245 (diff) | |
download | samba-6c299d28b56dd237792cc80c15c6169e701b4a97.tar.gz samba-6c299d28b56dd237792cc80c15c6169e701b4a97.tar.bz2 samba-6c299d28b56dd237792cc80c15c6169e701b4a97.zip |
selftest: Use standard subunit command for progress reporting.
-rw-r--r-- | selftest/Subunit.pm | 8 | ||||
-rwxr-xr-x | selftest/format-subunit | 15 | ||||
-rwxr-xr-x | selftest/selftest.pl | 9 | ||||
-rw-r--r-- | selftest/subunithelper.py | 8 |
4 files changed, 15 insertions, 25 deletions
diff --git a/selftest/Subunit.pm b/selftest/Subunit.pm index fce8d0854a..42a9ad08aa 100644 --- a/selftest/Subunit.pm +++ b/selftest/Subunit.pm @@ -95,8 +95,6 @@ sub parse_results($$$) } } elsif (/^testsuite: (.*)\n/) { $msg_ops->start_testsuite($1); - } elsif (/^testsuite-count: (\d+)\n/) { - $msg_ops->testsuite_count($1); } else { $msg_ops->output_msg($_); } @@ -229,10 +227,4 @@ sub end_testsuite($$;$) } } -sub testsuite_count($) -{ - my ($count) = @_; - print "testsuite-count: $count\n"; -} - 1; diff --git a/selftest/format-subunit b/selftest/format-subunit index eba8c31682..6d2ceb1047 100755 --- a/selftest/format-subunit +++ b/selftest/format-subunit @@ -9,6 +9,7 @@ import os import signal import sys import subunithelper +import subunit class PlainFormatter(object): @@ -25,13 +26,19 @@ class PlainFormatter(object): self.summaryfile = summaryfile self.index = 0 self.name = None + self._progress_level = 0 self.totalsuites = totaltests - def testsuite_count(self, count): - self.totalsuites = count - def progress(self, offset, whence): - pass + if whence == subunit.PROGRESS_POP: + self._progress_level -= 1 + elif whence == subunit.PROGRESS_PUSH: + self._progress_level += 1 + elif whence == subunit.PROGRESS_SET: + if self._progress_level == 0: + self.totalsuites = offset + elif whence == subunit.PROGRESS_CUR: + raise NotImplementedError def report_time(self, time): if self.start_time is None: diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 462fa752bc..68a2b2d671 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -228,8 +228,8 @@ sub run_testsuite($$$$$) my ($envname, $name, $cmd, $i, $totalsuites) = @_; my $pcap_file = setup_pcap($name); - Subunit::progress_push(); Subunit::start_testsuite($name); + Subunit::progress_push(); Subunit::report_time(time()); open(RESULTS, "$cmd 2>&1|"); @@ -250,8 +250,8 @@ sub run_testsuite($$$$$) unless (close(RESULTS)) { if ($!) { - Subunit::end_testsuite($name, "error", "Unable to run $cmd: $!"); Subunit::progress_pop(); + Subunit::end_testsuite($name, "error", "Unable to run $cmd: $!"); return 0; } else { $ret = $?; @@ -259,8 +259,8 @@ sub run_testsuite($$$$$) } if ($ret & 127) { - Subunit::end_testsuite($name, "error", sprintf("Testsuite died with signal %d, %s coredump", ($ret & 127), ($ret & 128) ? "with": "without")); Subunit::progress_pop(); + Subunit::end_testsuite($name, "error", sprintf("Testsuite died with signal %d, %s coredump", ($ret & 127), ($ret & 128) ? "with": "without")); return 0; } my $envlog = getlog_env($envname); @@ -274,12 +274,12 @@ sub run_testsuite($$$$$) my $exitcode = $ret >> 8; Subunit::report_time(time()); + Subuit::progress_pop(); if ($exitcode == 0) { Subunit::end_testsuite($name, "success"); } else { Subunit::end_testsuite($name, "failure", "Exit code was $exitcode"); } - Subunit::progress_pop(); cleanup_pcap($pcap_file, $exitcode); @@ -688,7 +688,6 @@ foreach my $fn (@testlists) { } } -Subunit::testsuite_count($#available+1); Subunit::progress($#available+1); Subunit::report_time(time()); diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py index 36639d94cf..8659f984d8 100644 --- a/selftest/subunithelper.py +++ b/selftest/subunithelper.py @@ -103,8 +103,6 @@ def parse_results(msg_ops, statistics, fh): msg_ops.end_testsuite(testname, "error", reason) elif l.startswith("testsuite: "): msg_ops.start_testsuite(l.split(":", 1)[1].strip()) - elif l.startswith("testsuite-count: "): - msg_ops.testsuite_count(int(l.split(":", 1)[1].strip())) elif l.startswith("progress: "): arg = l.split(":", 1)[1].strip() if arg == "pop": @@ -190,9 +188,6 @@ class SubunitOps(object): else: print "testsuite-%s: %s" % (result, name) - def testsuite_count(self, count): - print "testsuite-count: %d" % count - def read_test_regexes(name): f = open(name, 'r') @@ -310,9 +305,6 @@ class FilterOps(object): self._ops.end_testsuite(name, result, reason) - def testsuite_count(self, count): - self._ops.testsuite_count(count) - def __init__(self, prefix, expected_failures, strip_ok_output): self._ops = SubunitOps() self.output = None |