summaryrefslogtreecommitdiffstats
path: root/selftest
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-06-03 18:03:45 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-06-11 19:59:57 +0200
commit9e108009d0d4ec97a4b9cf989e3cb2cbc74f4ded (patch)
tree75e06bc842a46cac149c4751f288f63a25e926a2 /selftest
parent0a1dbf353dc9cf1e0202e013fa112f177cbf51cf (diff)
downloadsamba-9e108009d0d4ec97a4b9cf989e3cb2cbc74f4ded.tar.gz
samba-9e108009d0d4ec97a4b9cf989e3cb2cbc74f4ded.tar.xz
samba-9e108009d0d4ec97a4b9cf989e3cb2cbc74f4ded.zip
subunit: Move more Subunit printing logic to Subunit.pm.
Diffstat (limited to 'selftest')
-rw-r--r--selftest/Subunit.pm25
-rw-r--r--selftest/output/subunit.pm22
2 files changed, 32 insertions, 15 deletions
diff --git a/selftest/Subunit.pm b/selftest/Subunit.pm
index fc1a3d1d97d..0bbb795c8c2 100644
--- a/selftest/Subunit.pm
+++ b/selftest/Subunit.pm
@@ -113,4 +113,29 @@ sub parse_results($$$$$)
return 1;
}
+sub start_test($)
+{
+ my ($testname) = @_;
+ print "test: $testname\n";
+}
+
+sub end_test($$;$)
+{
+ my $name = shift;
+ my $result = shift;
+ my $reason = shift;
+ if ($reason) {
+ print "$result: $name [ $reason ]\n";
+ } else {
+ print "$result: $name\n";
+ }
+}
+
+sub report_time($)
+{
+ my ($time) = @_;
+ my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($time);
+ printf "time: %04d-%02d-%02d %02d:%02d:%02dZ\n", $year+1900, $mon, $mday, $hour, $min, $sec;
+}
+
1;
diff --git a/selftest/output/subunit.pm b/selftest/output/subunit.pm
index e99b76c1b9d..a7ca5d943d1 100644
--- a/selftest/output/subunit.pm
+++ b/selftest/output/subunit.pm
@@ -36,8 +36,7 @@ sub new($) {
sub report_time($$)
{
my ($self, $time) = @_;
- my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($time);
- printf "time: %04d-%02d-%02d %02d:%02d:%02dZ\n", $year+1900, $mon, $mday, $hour, $min, $sec;
+ Subunit::report_time($time);
}
sub start_testsuite($$)
@@ -46,7 +45,7 @@ sub start_testsuite($$)
$self->{NAME} = $name;
- print "test: $self->{NAME}\n";
+ Subunit::start_test($self->{NAME});
}
sub output_msg($$)
@@ -67,18 +66,14 @@ sub end_testsuite($$$$$$)
if ($result eq "failure" and not $unexpected) { $result = "xfail"; }
- if ($reason) {
- print "$result: $name [ $reason ]\n";
- } else {
- print "$result: $name\n";
- }
+ Subunit::end_test($name, $result, $reason);
}
sub start_test($$$)
{
my ($self, $parents, $testname) = @_;
- print "test: $testname\n";
+ Subunit::start_test($testname);
}
sub end_test($$$$$)
@@ -87,11 +82,7 @@ sub end_test($$$$$)
if ($result eq "fail" and not $unexpected) { $result = "xfail"; }
- if ($reason) {
- print "$result: $testname [ $reason ]\n";
- } else {
- print "$result: $testname\n";
- }
+ Subunit::end_test($testname, $result, $reason);
}
sub summary($)
@@ -103,7 +94,8 @@ sub skip_testsuite($$$$)
{
my ($self, $name, $reason) = @_;
- print "skip: $name\n";
+ Subunit::start_test($name);
+ Subunit::end_test($name, "skip");
}
1;