diff --git a/source4/samba4-knownfail b/source4/samba4-knownfail index 5e56aa6d97d..227dad323c3 100644 --- a/source4/samba4-knownfail +++ b/source4/samba4-knownfail @@ -1,35 +1,35 @@ -LOCAL-RESOLVE.*/async -LOCAL-ICONV.*/next_codepoint() -BASE-DELAYWRITE/finfo update on close -BASE-DELETE.*/deltest20a -BASE-DELETE.*/deltest20b -RAW-OPLOCK.*/OPLOCK +LOCAL-RESOLVE.*.async +LOCAL-ICONV.*.next_codepoint() +BASE-DELAYWRITE.finfo update on close +BASE-DELETE.*.deltest20a +BASE-DELETE.*.deltest20b +RAW-OPLOCK.*.OPLOCK RPC-WINREG -LOCAL-REGISTRY.*/security # Not implemented yet +LOCAL-REGISTRY.*.security # Not implemented yet RPC-WKSSVC -RPC-HANDLES.*/lsarpc-shared -RPC-HANDLES.*/mixed-shared -RPC-EPMAPPER.*/Insert -RPC-EPMAPPER.*/InqObject +RPC-HANDLES.*.lsarpc-shared +RPC-HANDLES.*.mixed-shared +RPC-EPMAPPER.*.Insert +RPC-EPMAPPER.*.InqObject RPC-DFS.* RPC-DRSUAPI.* RPC-LSALOOKUP RPC-CRACKNAMES -RPC-NETLOGON.*/LogonUasLogon -RPC-NETLOGON.*/LogonUasLogoff -RPC-NETLOGON.*/DatabaseSync -RPC-NETLOGON.*/DatabaseSync2 -RPC-NETLOGON.*/GetDcName -RPC-NETLOGON.*/LogonControl -RPC-NETLOGON.*/LogonControl2 -RPC-NETLOGON.*/GetAnyDCName -RPC-NETLOGON.*/DsrEnumerateDomainTrusts -RPC-NETLOGON.*/NetrEnumerateTrustedDomains -RPC-NETLOGON.*/NetrEnumerateTrustedDomainsEx -RPC-NETLOGON.*/DsrGetDcSiteCoverageW -RPC-NETLOGON.*/DsRAddressToSitenamesW -RPC-NETLOGON.*/DsRAddressToSitenamesExW -RPC-NETLOGON.*/GetPassword -RPC-NETLOGON.*/GetTrustPasswords -BASE-CHARSET.*/Testing partial surrogate +RPC-NETLOGON.*.LogonUasLogon +RPC-NETLOGON.*.LogonUasLogoff +RPC-NETLOGON.*.DatabaseSync +RPC-NETLOGON.*.DatabaseSync2 +RPC-NETLOGON.*.GetDcName +RPC-NETLOGON.*.LogonControl +RPC-NETLOGON.*.LogonControl2 +RPC-NETLOGON.*.GetAnyDCName +RPC-NETLOGON.*.DsrEnumerateDomainTrusts +RPC-NETLOGON.*.NetrEnumerateTrustedDomains +RPC-NETLOGON.*.NetrEnumerateTrustedDomainsEx +RPC-NETLOGON.*.DsrGetDcSiteCoverageW +RPC-NETLOGON.*.DsRAddressToSitenamesW +RPC-NETLOGON.*.DsRAddressToSitenamesExW +RPC-NETLOGON.*.GetPassword +RPC-NETLOGON.*.GetTrustPasswords +BASE-CHARSET.*.Testing partial surrogate .*NET-API-DELSHARE.* # DelShare isn't implemented yet diff --git a/source4/selftest/Subunit.pm b/source4/selftest/Subunit.pm index ea08ef8f384..e5c61ca9ba7 100644 --- a/source4/selftest/Subunit.pm +++ b/source4/selftest/Subunit.pm @@ -6,9 +6,9 @@ require Exporter; use strict; -sub parse_results($$$$$$) +sub parse_results($$$$$) { - my ($msg_ops, $msg_state, $statistics, $fh, $expecting_failure, $open_tests) = @_; + my ($msg_ops, $statistics, $fh, $expecting_failure, $open_tests) = @_; my $unexpected_ok = 0; my $expected_fail = 0; my $unexpected_fail = 0; @@ -17,59 +17,59 @@ sub parse_results($$$$$$) while(<$fh>) { if (/^test: (.+)\n/) { - $msg_ops->control_msg($msg_state, $_); - $msg_ops->start_test($msg_state, $open_tests, $1); + $msg_ops->control_msg($_); + $msg_ops->start_test($open_tests, $1); push (@$open_tests, $1); } elsif (/^(success|successful|failure|skip|error): (.*?)( \[)?([ \t]*)\n/) { - $msg_ops->control_msg($msg_state, $_); + $msg_ops->control_msg($_); my $reason = undef; if ($3) { $reason = ""; # reason may be specified in next lines while(<$fh>) { - $msg_ops->control_msg($msg_state, $_); + $msg_ops->control_msg($_); if ($_ eq "]\n") { last; } else { $reason .= $_; } } } my $result = $1; if ($1 eq "success" or $1 eq "successful") { pop(@$open_tests); #FIXME: Check that popped value == $2 - if ($expecting_failure->("$msg_state->{NAME}/$2")) { + if ($expecting_failure->(join(".", @$open_tests) . ".$2")) { $statistics->{TESTS_UNEXPECTED_OK}++; - $msg_ops->end_test($msg_state, $open_tests, $2, $1, 1, $reason); + $msg_ops->end_test($open_tests, $2, $1, 1, $reason); $unexpected_ok++; } else { $statistics->{TESTS_EXPECTED_OK}++; - $msg_ops->end_test($msg_state, $open_tests, $2, $1, 0, $reason); + $msg_ops->end_test($open_tests, $2, $1, 0, $reason); } } elsif ($1 eq "failure") { pop(@$open_tests); #FIXME: Check that popped value == $2 - if ($expecting_failure->("$msg_state->{NAME}/$2")) { + if ($expecting_failure->(join(".", @$open_tests) . ".$2")) { $statistics->{TESTS_EXPECTED_FAIL}++; - $msg_ops->end_test($msg_state, $open_tests, $2, $1, 0, $reason); + $msg_ops->end_test($open_tests, $2, $1, 0, $reason); $expected_fail++; } else { $statistics->{TESTS_UNEXPECTED_FAIL}++; - $msg_ops->end_test($msg_state, $open_tests, $2, $1, 1, $reason); + $msg_ops->end_test($open_tests, $2, $1, 1, $reason); $unexpected_fail++; } } elsif ($1 eq "skip") { $statistics->{TESTS_SKIP}++; pop(@$open_tests); #FIXME: Check that popped value == $2 - $msg_ops->end_test($msg_state, $open_tests, $2, $1, 0, $reason); + $msg_ops->end_test($open_tests, $2, $1, 0, $reason); } elsif ($1 eq "error") { $statistics->{TESTS_ERROR}++; pop(@$open_tests); #FIXME: Check that popped value == $2 - $msg_ops->end_test($msg_state, $open_tests, $2, $1, 1, $reason); + $msg_ops->end_test($open_tests, $2, $1, 1, $reason); $unexpected_err++; } } else { - $msg_ops->output_msg($msg_state, $_); + $msg_ops->output_msg($_); } } while ($#$open_tests > $orig_open_len) { - $msg_ops->end_test($msg_state, $open_tests, pop(@$open_tests), "error", 1, + $msg_ops->end_test($open_tests, pop(@$open_tests), "error", 1, "was started but never finished!"); $statistics->{TESTS_ERROR}++; $unexpected_err++; diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index af61376446a..cee6c1e63a8 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -5,6 +5,11 @@ package output::buildfarm; use Exporter; @ISA = qw(Exporter); +use FindBin qw($RealBin); +use lib "$RealBin/.."; + +use Subunit qw(parse_results); + use strict; sub new($$$) { @@ -16,15 +21,15 @@ sub new($$$) { bless($self, $class); } -sub start_testsuite($$$) +sub start_testsuite($$) { - my ($self, $name, $state) = @_; + my ($self, $name) = @_; my $out = ""; - $state->{NAME} = $name; - $state->{START_TIME} = time(); + $self->{NAME} = $name; + $self->{START_TIME} = time(); - my $duration = $state->{START_TIME} - $self->{start_time}; + my $duration = $self->{START_TIME} - $self->{start_time}; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; $out .= "Running test $name (level 0 stdout)\n"; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; @@ -37,26 +42,26 @@ sub start_testsuite($$$) print $out; } -sub output_msg($$$) +sub output_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; - $self->{test_output}->{$state->{NAME}} .= $output; + $self->{test_output}->{$self->{NAME}} .= $output; } -sub control_msg($$$) +sub control_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; - $self->{test_output}->{$state->{NAME}} .= $output; + $self->{test_output}->{$self->{NAME}} .= $output; } -sub end_testsuite($$$$$$$) +sub end_testsuite($$$$$$) { - my ($self, $name, $state, $result, $unexpected, $reason) = @_; + my ($self, $name, $result, $unexpected, $reason) = @_; my $out = ""; - $out .= "TEST RUNTIME: " . (time() - $state->{START_TIME}) . "s\n"; + $out .= "TEST RUNTIME: " . (time() - $self->{START_TIME}) . "s\n"; if (not $unexpected) { $out .= "ALL OK\n"; @@ -65,8 +70,6 @@ sub end_testsuite($$$$$$$) $out .= $self->{test_output}->{$name}; } - $out .= "PCAP FILE: $state->{PCAP_FILE}\n" if defined($state->{PCAP_FILE}); - $out .= "==========================================\n"; if (not $unexpected) { $out .= "TEST PASSED: $name\n"; @@ -78,25 +81,25 @@ sub end_testsuite($$$$$$$) print $out; } -sub start_test($$$$) +sub start_test($$$) { - my ($self, $state, $parents, $testname) = @_; + my ($self, $parents, $testname) = @_; if ($#$parents == -1) { - $self->start_testsuite($testname, $state); + $self->start_testsuite($testname); } } -sub end_test($$$$$$) +sub end_test($$$$$) { - my ($self, $state, $parents, $testname, $result, $unexpected, $reason) = @_; + my ($self, $parents, $testname, $result, $unexpected, $reason) = @_; if ($unexpected) { - $self->{test_output}->{$state->{NAME}} .= "UNEXPECTED($result): $testname\n"; + $self->{test_output}->{$self->{NAME}} .= "UNEXPECTED($result): $testname\n"; } if ($#$parents == -1) { - $self->end_testsuite($testname, $state, $result, $unexpected, $reason); + $self->end_testsuite($testname, $result, $unexpected, $reason); } } diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 1e2dacac6f3..c97926c7a88 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -8,6 +8,9 @@ use strict; use warnings; use FindBin qw($RealBin); +use lib "$RealBin/.."; + +use Subunit qw(parse_results); sub new$($$$) { my ($class, $dirname, $statistics) = @_; @@ -71,11 +74,11 @@ sub print_html_footer($$) print $fh "\n"; } -sub output_msg($$$); +sub output_msg($$); -sub start_testsuite($$$) +sub start_testsuite($$) { - my ($self, $name, $state) = @_; + my ($self, $name) = @_; $self->{local_statistics} = { success => 0, @@ -84,11 +87,11 @@ sub start_testsuite($$$) failure => 0 }; - $state->{NAME} = $name; - $state->{HTMLFILE} = "$name.html"; - $state->{HTMLFILE} =~ s/[:\t\n \/]/_/g; + $self->{NAME} = $name; + $self->{HTMLFILE} = "$name.html"; + $self->{HTMLFILE} =~ s/[:\t\n \/]/_/g; - open(TEST, ">$self->{dirname}/$state->{HTMLFILE}") or die("Unable to open $state->{HTMLFILE} for writing"); + open(TEST, ">$self->{dirname}/$self->{HTMLFILE}") or die("Unable to open $self->{HTMLFILE} for writing"); $self->print_html_header("Test Results for $name", *TEST); @@ -97,16 +100,16 @@ sub start_testsuite($$$) print TEST " \n"; } -sub control_msg($$$) +sub control_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; $self->{msg} .= "$output
\n"; } -sub output_msg($$$) +sub output_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; unless (defined($self->{active_test})) { print TEST "$output
"; @@ -115,20 +118,20 @@ sub output_msg($$$) } } -sub end_testsuite($$$$$) +sub end_testsuite($$$$) { - my ($self, $name, $state, $result, $unexpected, $reason) = @_; + my ($self, $name, $result, $unexpected, $reason) = @_; print TEST "
\n"; - print TEST "
Duration: " . (time() - $state->{START_TIME}) . "s
\n"; + print TEST "
Duration: " . (time() - $self->{START_TIME}) . "s
\n"; $self->print_html_footer(*TEST); close(TEST); print INDEX "\n"; - print INDEX " {HTMLFILE}\">$name\n"; + print INDEX " {HTMLFILE}\">$name\n"; my $st = $self->{local_statistics}; if (not $unexpected) { @@ -175,13 +178,13 @@ sub end_testsuite($$$$$) print INDEX "\n"; } -sub start_test($$$) +sub start_test($$) { - my ($self, $state, $parents, $testname) = @_; + my ($self, $parents, $testname) = @_; if ($#$parents == -1) { - $state->{START_TIME} = time(); - $self->start_testsuite($testname, $state); + $self->{START_TIME} = time(); + $self->start_testsuite($testname); return; } @@ -189,12 +192,12 @@ sub start_test($$$) $self->{msg} = ""; } -sub end_test($$$$$$$) +sub end_test($$$$$$) { - my ($self, $state, $parents, $testname, $result, $unexpected, $reason) = @_; + my ($self, $parents, $testname, $result, $unexpected, $reason) = @_; if ($#$parents == -1) { - $self->end_testsuite($testname, $state, $result, $unexpected, $reason); + $self->end_testsuite($testname, $result, $unexpected, $reason); return; } @@ -224,7 +227,7 @@ sub end_test($$$$$$$) } push(@{$self->{error_summary}->{$track_class}}, , - [$state->{HTMLFILE}, $testname, $state->{NAME}, + [$self->{HTMLFILE}, $testname, $self->{NAME}, $reason]); print TEST "

$testname

\n"; diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 086bd2b0e5d..1e6dead3266 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -4,6 +4,11 @@ package output::plain; use Exporter; @ISA = qw(Exporter); +use FindBin qw($RealBin); +use lib "$RealBin/.."; + +use Subunit qw(parse_results); + use strict; sub new($$$$$$$) { @@ -24,17 +29,17 @@ sub new($$$$$$$) { bless($self, $class); } -sub output_msg($$$); +sub output_msg($$); -sub start_testsuite($$$) +sub start_testsuite($$) { - my ($self, $name, $state) = @_; + my ($self, $name) = @_; $self->{index}++; - $state->{NAME} = $name; - $state->{START_TIME} = time(); + $self->{NAME} = $name; + $self->{START_TIME} = time(); - my $duration = $state->{START_TIME} - $self->{start_time}; + my $duration = $self->{START_TIME} - $self->{start_time}; $self->{test_output}->{$name} = "" unless($self->{verbose}); @@ -45,31 +50,31 @@ sub start_testsuite($$$) print "$out"; } -sub output_msg($$$) +sub output_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; if ($self->{verbose}) { print $output; } else { - $self->{test_output}->{$state->{NAME}} .= $output; + $self->{test_output}->{$self->{NAME}} .= $output; } } -sub control_msg($$$) +sub control_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; - $self->output_msg($state, $output); + $self->output_msg($output); } -sub end_testsuite($$$$$$) +sub end_testsuite($$$$$) { - my ($self, $name, $state, $result, $unexpected, $reason) = @_; + my ($self, $name, $result, $unexpected, $reason) = @_; my $out = ""; if ($unexpected) { - $self->output_msg($state, "ERROR: $reason\n"); + $self->output_msg("ERROR: $reason\n"); push (@{$self->{suitesfailed}}, $name); } else { $self->{suites_ok}++; @@ -83,38 +88,38 @@ sub end_testsuite($$$$$$) print $out; } -sub start_test($$$$) +sub start_test($$$) { - my ($self, $state, $parents, $testname) = @_; + my ($self, $parents, $testname) = @_; if ($#$parents == -1) { - $self->start_testsuite($testname, $state); + $self->start_testsuite($testname); } } -sub end_test($$$$$$) +sub end_test($$$$$) { - my ($self, $state, $parents, $testname, $result, $unexpected, $reason) = @_; + my ($self, $parents, $testname, $result, $unexpected, $reason) = @_; if ($#$parents == -1) { - $self->end_testsuite($testname, $state, $result, $unexpected, $reason); + $self->end_testsuite($testname, $result, $unexpected, $reason); return; } my $append = ""; unless ($unexpected) { - $self->{test_output}->{$state->{NAME}} = ""; + $self->{test_output}->{$self->{NAME}} = ""; return; } $append = "UNEXPECTED($result): $testname\n"; - $self->{test_output}->{$state->{NAME}} .= $append; + $self->{test_output}->{$self->{NAME}} .= $append; if ($self->{immediate} and not $self->{verbose}) { - print $self->{test_output}->{$state->{NAME}}; - $self->{test_output}->{$state->{NAME}} = ""; + print $self->{test_output}->{$self->{NAME}}; + $self->{test_output}->{$self->{NAME}} = ""; } } diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 0e9b0174fdc..8fccb8d4a08 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -204,7 +204,7 @@ sub skip($) sub getlog_env($); -sub setup_pcap($$) +sub setup_pcap($) { my ($state, $name) = @_; @@ -214,59 +214,56 @@ sub setup_pcap($$) my $fname = $name; $fname =~ s%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\-]%_%g; - $state->{PCAP_FILE} = "$ENV{SOCKET_WRAPPER_PCAP_DIR}/$fname.pcap"; + my $pcap_file = "$ENV{SOCKET_WRAPPER_PCAP_DIR}/$fname.pcap"; - SocketWrapper::setup_pcap($state->{PCAP_FILE}); + SocketWrapper::setup_pcap($pcap_file); + + return $pcap_file; } sub cleanup_pcap($$$) { - my ($state, $expected_ret, $ret) = @_; + my ($pcap_file, $expected_ret, $ret) = @_; return unless ($opt_socket_wrapper_pcap); return if ($opt_socket_wrapper_keep_pcap); return unless ($expected_ret == $ret); - return unless defined($state->{PCAP_FILE}); + return unless defined($pcap_file); - unlink($state->{PCAP_FILE}); - $state->{PCAP_FILE} = undef; + unlink($pcap_file); } sub run_testsuite($$$$$$) { my ($envname, $name, $cmd, $i, $totalsuites, $msg_ops) = @_; - my $msg_state = { - }; + my $pcap_file = setup_pcap($name); - setup_pcap($msg_state, $name); - - $msg_ops->start_test($msg_state, [], $name); + $msg_ops->start_test([], $name); open(RESULT, "$cmd 2>&1|"); my $expected_ret = parse_results( - $msg_ops, $msg_state, $statistics, *RESULT, \&expecting_failure, [$name]); + $msg_ops, $statistics, *RESULT, \&expecting_failure, [$name]); my $envlog = getlog_env($envname); - $msg_ops->output_msg($msg_state, "ENVLOG: $envlog\n") if ($envlog ne ""); + $msg_ops->output_msg("ENVLOG: $envlog\n") if ($envlog ne ""); - $msg_ops->output_msg($msg_state, "CMD: $cmd\n"); + $msg_ops->output_msg("CMD: $cmd\n"); my $ret = close(RESULT); $ret = 0 unless $ret == 1; if ($ret == 1) { - $msg_ops->end_test($msg_state, [], $name, "success", $expected_ret != $ret, undef); + $msg_ops->end_test([], $name, "success", $expected_ret != $ret, undef); } else { - $msg_ops->end_test($msg_state, [], $name, "failure", $expected_ret != $ret, + $msg_ops->end_test([], $name, "failure", $expected_ret != $ret, "Returned $ret"); } - cleanup_pcap($msg_state, $expected_ret, $ret); + cleanup_pcap($pcap_file, $expected_ret, $ret); if (not $opt_socket_wrapper_keep_pcap and - defined($msg_state->{PCAP_FILE})) { - $msg_ops->output_msg($msg_state, - "PCAP FILE: $msg_state->{PCAP_FILE}\n"); + defined($pcap_file)) { + $msg_ops->output_msg("PCAP FILE: $pcap_file\n"); } if ($ret != $expected_ret) {