mirror of
https://github.com/samba-team/samba.git
synced 2025-03-23 06:50:21 +03:00
selftest: Use standard subunit command for progress reporting.
This commit is contained in:
parent
7f1360db51
commit
6c299d28b5
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user