1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

selftest/subunit: Remove prefix command.

This commit is contained in:
Jelmer Vernooij 2009-06-05 14:06:32 +02:00
parent 4308e69084
commit 8a76e4ab29
6 changed files with 19 additions and 61 deletions

View File

@ -29,7 +29,6 @@ sub parse_results($$$$)
my $unexpected_ok = 0;
my $expected_fail = 0;
my $unexpected_fail = 0;
my $prefix = "";
my $unexpected_err = 0;
my $orig_open_len = $#$open_tests;
@ -40,8 +39,6 @@ sub parse_results($$$$)
push (@$open_tests, $1);
} elsif (/^time: (\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)Z\n/) {
$msg_ops->report_time(mktime($6, $5, $4, $3, $2, $1));
} elsif (/^prefix: (.*)\n/) {
$prefix = $1;
} elsif (/^(success|successful|failure|fail|skip|knownfail|error|xfail): (.*?)( \[)?([ \t]*)\n/) {
$msg_ops->control_msg($_);
my $result = $1;
@ -58,23 +55,23 @@ sub parse_results($$$$)
unless ($terminated) {
$statistics->{TESTS_ERROR}++;
$msg_ops->end_test($open_tests, $testname, $result, 1, "reason interrupted");
$msg_ops->end_test($testname, $result, 1, "reason interrupted");
return 1;
}
}
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, $testname, $result, 0, $reason);
$msg_ops->end_test($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, $testname, $result, 0, $reason);
$msg_ops->end_test($testname, $result, 0, $reason);
$expected_fail++;
} 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, $testname, $result, 1, $reason);
$msg_ops->end_test($testname, $result, 1, $reason);
$unexpected_fail++;
} elsif ($result eq "skip") {
$statistics->{TESTS_SKIP}++;
@ -82,11 +79,11 @@ sub parse_results($$$$)
if (defined($last) and $last ne $testname) {
push (@$open_tests, $testname);
}
$msg_ops->end_test($open_tests, $testname, $result, 0, $reason);
$msg_ops->end_test($testname, $result, 0, $reason);
} elsif ($result eq "error") {
$statistics->{TESTS_ERROR}++;
pop(@$open_tests); #FIXME: Check that popped value == $testname
$msg_ops->end_test($open_tests, $testname, $result, 1, $reason);
$msg_ops->end_test($testname, $result, 1, $reason);
$unexpected_err++;
}
} else {
@ -136,10 +133,4 @@ sub report_time($)
printf "time: %04d-%02d-%02d %02d:%02d:%02dZ\n", $year+1900, $mon, $mday, $hour, $min, $sec;
}
sub prefix($)
{
my ($prefix) = @_;
print "prefix: $prefix\n";
}
1;

View File

@ -87,24 +87,16 @@ sub end_testsuite($$$$$$)
sub start_test($$$)
{
my ($self, $parents, $testname) = @_;
if ($#$parents == -1) {
$self->start_testsuite($testname);
}
my ($self, $testname) = @_;
}
sub end_test($$$$$)
{
my ($self, $parents, $testname, $result, $unexpected, $reason) = @_;
my ($self, $testname, $result, $unexpected, $reason) = @_;
if ($unexpected) {
$self->{test_output}->{$self->{NAME}} .= "UNEXPECTED($result): $testname\n";
}
if ($#$parents == -1) {
$self->end_testsuite($testname, $result, $unexpected, $reason);
}
}
sub summary($)

View File

@ -94,6 +94,8 @@ sub start_testsuite($$)
{
my ($self, $name) = @_;
$self->{START_TIME} = $self->{last_time};
$self->{local_statistics} = {
success => 0,
skip => 0,
@ -200,26 +202,15 @@ sub report_time($$)
sub start_test($$)
{
my ($self, $parents, $testname) = @_;
if ($#$parents == -1) {
$self->{START_TIME} = $self->{last_time};
$self->start_testsuite($testname);
return;
}
my ($self, $testname) = @_;
$self->{active_test} = $testname;
$self->{msg} = "";
}
sub end_test($$$$$$)
sub end_test($$$$)
{
my ($self, $parents, $testname, $result, $unexpected, $reason) = @_;
if ($#$parents == -1) {
$self->end_testsuite($testname, $result, $unexpected, $reason);
return;
}
my ($self, $testname, $result, $unexpected, $reason) = @_;
print TEST "<tr>";

View File

@ -133,26 +133,13 @@ sub end_testsuite($$$$$)
sub start_test($$$)
{
my ($self, $parents, $testname) = @_;
if ($#$parents == -1) {
$self->start_testsuite($testname);
}
my ($self, $testname) = @_;
}
sub end_test($$$$$)
{
my ($self, $parents, $testname, $result, $unexpected, $reason) = @_;
my ($self, $testname, $result, $unexpected, $reason) = @_;
if ($#$parents == -1) {
if ($result eq "skip") {
$self->skip_testsuite($testname, $reason);
} else {
$self->end_testsuite($testname, $result, $unexpected, $reason);
}
return;
}
my $append = "";
unless ($unexpected) {
@ -167,9 +154,7 @@ sub end_test($$$$$)
return;
}
my $fullname = join(".", @$parents).".$testname";
$append = "UNEXPECTED($result): $testname ($fullname)\n";
$append = "UNEXPECTED($result): $testname\n";
$self->{test_output}->{$self->{NAME}} .= $append;

View File

@ -69,16 +69,16 @@ sub end_testsuite($$$$$$)
Subunit::end_test($name, $result, $reason);
}
sub start_test($$$)
sub start_test($$)
{
my ($self, $parents, $testname) = @_;
my ($self, $testname) = @_;
Subunit::start_test($testname);
}
sub end_test($$$$$)
{
my ($self, $parents, $testname, $result, $unexpected, $reason) = @_;
my ($self, $testname, $result, $unexpected, $reason) = @_;
if ($result eq "fail" and not $unexpected) { $result = "xfail"; }

View File

@ -217,7 +217,6 @@ sub run_testsuite($$$$$)
my $pcap_file = setup_pcap($name);
Subunit::report_time(time());
Subunit::prefix($name);
Subunit::start_test($name);
my $ret = system("$cmd | $RealBin/filter-subunit.pl --prefix \"$name.\" 2>&1");