\n";
}
sub print_html_footer($$)
{
my ($self, $fh) = @_;
print $fh "
\n";
print $fh "
\n";
print $fh "\n";
print $fh "\n";
}
sub output_msg($$$);
sub start_testsuite($$$)
{
my ($self, $name, $state) = @_;
$self->{local_statistics} = {
success => 0,
skip => 0,
error => 0,
failure => 0
};
$state->{HTMLFILE} = "$name.html";
$state->{HTMLFILE} =~ s/[:\t\n \/]/_/g;
open(TEST, ">$self->{dirname}/$state->{HTMLFILE}") or die("Unable to open $state->{HTMLFILE} for writing");
$self->print_html_header("Test Results for $name", *TEST);
if ($state->{ENVNAME} ne "none") {
print TEST "
Environment settings
\n";
print TEST "
\n";
print TEST "
Variable name
Variable value
\n";
foreach (keys %{$state->{ENVVARS}}) {
print TEST "
$_
";
my $val = $state->{ENVVARS}->{$_};
if ($val =~ /^\.\// and -r $val) {
print TEST "$val";
} elsif (-r $val) {
print TEST "$val";
} else {
print TEST $val;
}
print TEST "
\n";
}
print TEST "
\n";
}
print TEST "
Tests
\n";
print TEST "
\n";
}
sub control_msg($$$)
{
my ($self, $state, $output) = @_;
$self->{msg} .= "$output \n";
}
sub output_msg($$$)
{
my ($self, $state, $output) = @_;
unless (defined($self->{active_test})) {
print TEST "$output ";
} else {
$self->{msg} .= "$output ";
}
}
sub end_testsuite($$$$$)
{
my ($self, $name, $state, $expected_ret, $ret, $envlog) = @_;
print TEST "
\n";
my $st = $self->{local_statistics};
if ($ret == $expected_ret) {
if ($ret == 0) {
print INDEX "
";
} else {
print INDEX "
";
}
} else {
print INDEX "
";
}
my $l = 0;
if ($st->{success} > 0) {
print INDEX "$st->{success} ok";
$l++;
}
if ($st->{skip} > 0) {
print INDEX ", " if ($l);
print INDEX "$st->{skip} skipped";
$l++;
}
if ($st->{failure} > 0) {
print INDEX ", " if ($l);
print INDEX "$st->{failure} failures";
$l++;
}
if ($st->{error} > 0) {
print INDEX ", " if ($l);
print INDEX "$st->{error} errors";
$l++;
}
if ($l == 0) {
if ($ret == $expected_ret) {
print INDEX "OK";
} else {
print INDEX "FAIL";
}
}
print INDEX "
";
print INDEX "
\n";
}
sub start_test($$$)
{
my ($self, $state, $testname) = @_;
$self->{active_test} = $testname;
$self->{msg} = "";
}
sub end_test($$$$$$)
{
my ($self, $state, $testname, $result, $unexpected, $reason) = @_;
print TEST "
";
$self->{local_statistics}->{$result}++;
my $track_class;
if ($result eq "skip") {
print TEST "