summaryrefslogtreecommitdiff
path: root/selftest/Subunit.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-06-04 13:49:11 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-06-11 19:59:58 +0200
commit16a69f358a38c60577e25bc0811a220f8e71d2cd (patch)
tree8986f5b24d4a29701d88d5ef1932c9b025cf8954 /selftest/Subunit.pm
parent9bdf76c9c214d6f12c379f8feefe120fdae84377 (diff)
downloadsamba-16a69f358a38c60577e25bc0811a220f8e71d2cd.tar.gz
samba-16a69f358a38c60577e25bc0811a220f8e71d2cd.tar.bz2
samba-16a69f358a38c60577e25bc0811a220f8e71d2cd.zip
selftest: Use external processes for filtering known failures and pretty
formatting.
Diffstat (limited to 'selftest/Subunit.pm')
-rw-r--r--selftest/Subunit.pm42
1 files changed, 24 insertions, 18 deletions
diff --git a/selftest/Subunit.pm b/selftest/Subunit.pm
index 0eafc44146..7feb5de9a4 100644
--- a/selftest/Subunit.pm
+++ b/selftest/Subunit.pm
@@ -41,6 +41,8 @@ sub parse_results($$$$)
$msg_ops->report_time(mktime($6, $5, $4, $3, $2, $1));
} elsif (/^(success|successful|failure|fail|skip|knownfail|error|xfail): (.*?)( \[)?([ \t]*)\n/) {
$msg_ops->control_msg($_);
+ my $result = $1;
+ my $testname = $2;
my $reason = undef;
if ($3) {
$reason = "";
@@ -53,33 +55,35 @@ sub parse_results($$$$)
unless ($terminated) {
$statistics->{TESTS_ERROR}++;
- $msg_ops->end_test($open_tests, $2, $1, 1, "reason interrupted");
+ $msg_ops->end_test($open_tests, $testname, $result, 1, "reason interrupted");
return 1;
}
}
- my $result = $1;
- if ($1 eq "success" or $1 eq "successful") {
- pop(@$open_tests); #FIXME: Check that popped value == $2
+ if ($result eq "success" or $result eq "successful") {
+ pop(@$open_tests); #FIXME: Check that popped value == $testname
$statistics->{TESTS_EXPECTED_OK}++;
- $msg_ops->end_test($open_tests, $2, $1, 0, $reason);
- } elsif ($1 eq "xfail" or $1 eq "knownfail") {
- pop(@$open_tests); #FIXME: Check that popped value == $2
+ $msg_ops->end_test($open_tests, $testname, $result, 0, $reason);
+ } elsif ($result eq "xfail" or $result eq "knownfail") {
+ pop(@$open_tests); #FIXME: Check that popped value == $testname
$statistics->{TESTS_EXPECTED_FAIL}++;
- $msg_ops->end_test($open_tests, $2, $1, 0, $reason);
+ $msg_ops->end_test($open_tests, $testname, $result, 0, $reason);
$expected_fail++;
- } elsif ($1 eq "failure" or $1 eq "fail") {
- pop(@$open_tests); #FIXME: Check that popped value == $2
+ } elsif ($result eq "failure" or $result eq "fail") {
+ pop(@$open_tests); #FIXME: Check that popped value == $testname
$statistics->{TESTS_UNEXPECTED_FAIL}++;
- $msg_ops->end_test($open_tests, $2, $1, 1, $reason);
+ $msg_ops->end_test($open_tests, $testname, $result, 1, $reason);
$unexpected_fail++;
- } elsif ($1 eq "skip") {
+ } elsif ($result eq "skip") {
$statistics->{TESTS_SKIP}++;
- pop(@$open_tests); #FIXME: Check that popped value == $2
- $msg_ops->end_test($open_tests, $2, $1, 0, $reason);
- } elsif ($1 eq "error") {
+ my $last = pop(@$open_tests);
+ if (defined($last) and $last ne $testname) {
+ push (@$open_tests, $testname);
+ }
+ $msg_ops->end_test($open_tests, $testname, $result, 0, $reason);
+ } elsif ($result eq "error") {
$statistics->{TESTS_ERROR}++;
- pop(@$open_tests); #FIXME: Check that popped value == $2
- $msg_ops->end_test($open_tests, $2, $1, 1, $reason);
+ pop(@$open_tests); #FIXME: Check that popped value == $testname
+ $msg_ops->end_test($open_tests, $testname, $result, 1, $reason);
$unexpected_err++;
}
} else {
@@ -114,7 +118,9 @@ sub end_test($$;$)
my $result = shift;
my $reason = shift;
if ($reason) {
- print "$result: $name [ $reason ]\n";
+ print "$result: $name [";
+ print "$reason";
+ print "]\n";
} else {
print "$result: $name\n";
}