diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-20 15:54:05 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 06:28:48 +0100 |
commit | 70c9374305fdb39ca92b3490bfdbc23043960637 (patch) | |
tree | fc1505fd56e2e55c67a2759770cf5c3bf9a6ffbc /source4/selftest | |
parent | 254f1c6fee18dd14d2f9f97d65e6fe9ef04c26f2 (diff) | |
download | samba-70c9374305fdb39ca92b3490bfdbc23043960637.tar.gz samba-70c9374305fdb39ca92b3490bfdbc23043960637.tar.bz2 samba-70c9374305fdb39ca92b3490bfdbc23043960637.zip |
r26548: Remove remaining variables from state hash.
(This used to be commit 84f5b3e257241f699f3e51d8f282fa00cfd1000a)
Diffstat (limited to 'source4/selftest')
-rw-r--r-- | source4/selftest/output/buildfarm.pm | 4 | ||||
-rw-r--r-- | source4/selftest/output/html.pm | 23 | ||||
-rw-r--r-- | source4/selftest/output/plain.pm | 16 | ||||
-rwxr-xr-x | source4/selftest/selftest.pl | 54 |
4 files changed, 44 insertions, 53 deletions
diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index 958124259e..81ffd5012c 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -21,6 +21,9 @@ sub start_testsuite($$$) my ($self, $name, $state) = @_; my $out = ""; + $state->{NAME} = $name; + $state->{START_TIME} = time(); + my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME}; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; $out .= "Running test $name (level 0 stdout)\n"; @@ -28,7 +31,6 @@ sub start_testsuite($$$) $out .= scalar(localtime())."\n"; $out .= "SELFTEST RUNTIME: " . $duration . "s\n"; $out .= "NAME: $name\n"; - $out .= "CMD: $state->{CMD}\n"; $self->{test_output}->{$name} = ""; diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 7f3cfac8cd..13d2f10938 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -84,6 +84,7 @@ sub start_testsuite($$$) failure => 0 }; + $state->{NAME} = $name; $state->{HTMLFILE} = "$name.html"; $state->{HTMLFILE} =~ s/[:\t\n \/]/_/g; @@ -91,26 +92,6 @@ sub start_testsuite($$$) $self->print_html_header("Test Results for $name", *TEST); - if ($state->{ENVNAME} ne "none") { - print TEST "<h2>Environment settings</h2>\n"; - - print TEST " <table>\n"; - print TEST " <tr><td><b>Variable name</b></td><td><b>Variable value</b></td></tr>\n"; - foreach (keys %{$state->{ENVVARS}}) { - print TEST " <tr><td>$_</td><td>"; - my $val = $state->{ENVVARS}->{$_}; - if ($val =~ /^\.\// and -r $val) { - print TEST "<a href=\"../$val\">$val</a>"; - } elsif (-r $val) { - print TEST "<a href=\"$val\">$val</a>"; - } else { - print TEST $val; - } - print TEST "</td></tr>\n"; - } - print TEST " </table>\n"; - } - print TEST "<h2>Tests</h2>\n"; print TEST " <table>\n"; @@ -140,7 +121,6 @@ sub end_testsuite($$$$$) print TEST "</table>\n"; - print TEST "<div class=\"command\">$state->{CMD}</div>\n"; print TEST "<div class=\"duration\">Duration: " . (time() - $state->{START_TIME}) . "s</div>\n"; $self->print_html_footer(*TEST); @@ -200,6 +180,7 @@ sub start_test($$$) my ($self, $state, $parents, $testname) = @_; if ($#$parents == -1) { + $state->{START_TIME} = time(); $self->start_testsuite($testname, $state); return; } diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index a11ada871a..af353c3cff 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -6,8 +6,8 @@ use Exporter; use strict; -sub new($$$$$) { - my ($class, $summaryfile, $verbose, $immediate, $statistics) = @_; +sub new($$$$$$) { + my ($class, $summaryfile, $verbose, $immediate, $statistics, $totaltests) = @_; my $self = { verbose => $verbose, immediate => $immediate, @@ -16,6 +16,8 @@ sub new($$$$$) { suitesfailed => [], skips => {}, summaryfile => $summaryfile, + index => 0, + totalsuites => $totaltests, }; bless($self, $class); } @@ -26,14 +28,16 @@ sub start_testsuite($$$) { my ($self, $name, $state) = @_; + $self->{index}++; + $state->{NAME} = $name; + $state->{START_TIME} = time(); + my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME}; $self->{test_output}->{$name} = "" unless($self->{verbose}); - $self->output_msg($state, "CMD: $state->{CMD}\n"); - my $out = ""; - $out .= "[$state->{INDEX}/$state->{TOTAL} in ".$duration."s"; + $out .= "[$self->{index}/$self->{totalsuites} in ".$duration."s"; $out .= sprintf(", %d errors", $self->{statistics}->{SUITES_FAIL}) if ($self->{statistics}->{SUITES_FAIL} > 0); $out .= "] $name\n", print "$out"; @@ -162,6 +166,8 @@ sub skip_testsuite($$) my ($self, $name, $reason) = @_; push (@{$self->{skips}->{$reason}}, $name); + + $self->{totalsuites}--; } 1; diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 4dbdb2da62..14f4ce3a06 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -208,14 +208,14 @@ sub skip($) sub getlog_env($); -sub setup_pcap($) +sub setup_pcap($$) { - my ($state) = @_; + my ($state, $name) = @_; return unless ($opt_socket_wrapper_pcap); return unless defined($ENV{SOCKET_WRAPPER_PCAP_DIR}); - my $fname = sprintf("t%03u_%s", $state->{INDEX}, $state->{NAME}); + my $fname = $name; $fname =~ s%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\-]%_%g; $state->{PCAP_FILE} = "$ENV{SOCKET_WRAPPER_PCAP_DIR}/$fname.pcap"; @@ -236,20 +236,13 @@ sub cleanup_pcap($$$) $state->{PCAP_FILE} = undef; } -sub run_testsuite($$$$$$$) +sub run_testsuite($$$$$$) { - my ($envname, $envvars, $name, $cmd, $i, $totalsuites, $msg_ops) = @_; + my ($envname, $name, $cmd, $i, $totalsuites, $msg_ops) = @_; my $msg_state = { - ENVNAME => $envname, - ENVVARS => $envvars, - NAME => $name, - CMD => $cmd, - INDEX => $i, - TOTAL => $totalsuites, - START_TIME => time() }; - setup_pcap($msg_state); + setup_pcap($msg_state, $name); $msg_ops->start_test($msg_state, [], $name); @@ -260,6 +253,8 @@ sub run_testsuite($$$$$$$) my $envlog = getlog_env($envname); $msg_ops->output_msg($msg_state, "ENVLOG: $envlog\n") if ($envlog ne ""); + $msg_ops->output_msg($msg_state, "CMD: $cmd\n"); + my $ret = close(RESULT); $ret = 0 unless $ret == 1; @@ -606,13 +601,22 @@ if ($#testlists == -1) { die("No testlists specified"); } +my @available = (); +foreach my $fn (@testlists) { + foreach (read_testlist($fn)) { + my $name = $$_[0]; + next if (@includes and not find_in_list(\@includes, $name)); + push (@available, $_); + } +} + my $msg_ops; if ($opt_format eq "buildfarm") { require output::buildfarm; $msg_ops = new output::buildfarm($statistics); } elsif ($opt_format eq "plain") { require output::plain; - $msg_ops = new output::plain("$prefix/summary", $opt_verbose, $opt_immediate, $statistics); + $msg_ops = new output::plain("$prefix/summary", $opt_verbose, $opt_immediate, $statistics, $#available+1); } elsif ($opt_format eq "html") { require output::html; mkdir("test-results", 0777); @@ -621,17 +625,15 @@ if ($opt_format eq "buildfarm") { die("Invalid output format '$opt_format'"); } -foreach my $fn (@testlists) { - foreach (read_testlist($fn)) { - my $name = $$_[0]; - next if (@includes and not find_in_list(\@includes, $name)); - my $skipreason = skip($name); - if ($skipreason) { - $msg_ops->skip_testsuite($name, $skipreason); - $statistics->{SUITES_SKIPPED}++; - } else { - push(@todo, $_); - } + +foreach (@available) { + my $name = $$_[0]; + my $skipreason = skip($name); + if ($skipreason) { + $msg_ops->skip_testsuite($name, $skipreason); + $statistics->{SUITES_SKIPPED}++; + } else { + push(@todo, $_); } } @@ -794,7 +796,7 @@ $envvarstr next; } - run_testsuite($envname, $envvars, $name, $cmd, $i, $suitestotal, + run_testsuite($envname, $name, $cmd, $i, $suitestotal, $msg_ops); if (defined($opt_analyse_cmd)) { |