mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r26548: Remove remaining variables from state hash.
This commit is contained in:
parent
0bf6bdcd7f
commit
84f5b3e257
@ -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} = "";
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user