tests: Removed abbreviated defines, added HTML report generator

git-svn-id: http://pugixml.googlecode.com/svn/trunk@417 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
arseny.kapoulkine 2010-05-12 20:49:41 +00:00
parent fa5f573d0d
commit 28b54109d7
2 changed files with 119 additions and 15 deletions

View file

@ -19,12 +19,10 @@ $fast = (shift eq 'fast');
@toolsets = ($^O =~ /win/i) ? (bcc, cw, dmc, ic8, mingw34, mingw44, mingw45, msvc6, msvc7, msvc71, msvc8, msvc8_x64, msvc9, msvc9_x64, msvc10, msvc10_x64) : (gcc);
@configurations = (debug, release);
@defines = (PUGIXML_NO_XPATH, PUGIXML_NO_EXCEPTIONS, PUGIXML_NO_STL, PUGIXML_WCHAR_MODE);
@definesabbr = (noxpath, noexcept, nostl, wchar);
if ($fast)
{
@defines = (PUGIXML_WCHAR_MODE);
@definesabbr = (wchar);
}
@definesets = permute(@defines);
@ -39,19 +37,10 @@ foreach $toolset (@toolsets)
{
foreach $defineset (@definesets)
{
# construct define abbreviation
$defineabbr = $defineset;
$defineabbr =~ s/,/ /g;
if ($defineset !~ /NO_XPATH/ && $defineset =~ /NO_EXCEPTIONS/) { next; }
if ($defineset !~ /NO_XPATH/ && $defineset =~ /NO_STL/) { next; }
for ($i = 0; $i < $#definesabbr + 1; ++$i)
{
$defineabbr =~ s/$defines[$i]/$definesabbr[$i]/;
}
if ($defineabbr !~ /noxpath/ && $defineabbr =~ /noexcept/) { next; }
if ($defineabbr !~ /noxpath/ && $defineabbr =~ /nostl/) { next; }
print STDERR "*** testing $toolset/$configuration ($defineabbr) ... ***\n";
print STDERR "*** testing $toolset/$configuration ($defineset) ... ***\n";
# launch command
my $cmdline = "jam toolset=$toolset configuration=$configuration defines=$defineset";
@ -69,7 +58,7 @@ foreach $toolset (@toolsets)
my $coverage_pugixpath = $1 if ($coverage =~ /pugixpath\.cpp' executed:([^%]+)%/);
# print build report
print "### autotest $Config{archname} $toolset $configuration [$defineabbr] result $result $coverage_pugixml $coverage_pugixpath\n";
print "### autotest $Config{archname} $toolset $configuration [$defineset] result $result $coverage_pugixml $coverage_pugixpath\n";
}
last if ($fast);

115
tests/autotest-report.pl Normal file
View file

@ -0,0 +1,115 @@
#!/usr/bin/perl
# parse build log
%results = ();
%toolsets = ();
%defines = ();
%configurations = ();
sub insertindex
{
my ($hash, $key) = @_;
$$hash{$key} = scalar(keys %$hash) unless defined $$hash{$key};
}
while (<>)
{
### autotest i386-freebsd-64int gcc release [wchar] result 0 97.78 98.85
if (/^### autotest (\S+) (\S+) (\S+) \[(.*?)\] result (\S+) (\S*) (\S*)/)
{
my ($platform, $toolset, $configuration, $defineset, $result, $coverage_pugixml, $coverage_pugixpath) = ($1, $2, $3, $4, $5, $6, $7);
die "Detected duplicate build information $_\n" if defined $results{"$toolset $platform"}{$configuration}{$defineset};
my $fulltool = "$toolset $platform";
my $fullconf = "$configuration $defineset";
$results{$fulltool}{$fullconf}{result} = $result;
$results{$fulltool}{$fullconf}{coverage_pugixml} = $coverage_pugixml;
$results{$fulltool}{$fullconf}{coverage_pugixpath} = $coverage_pugixpath;
&insertindex(\%toolsets, $fulltool);
$defines{$_} = 1 foreach (split /,/, $defineset);
&insertindex(\%configurations, $fullconf);
}
}
# make arrays of toolsets and configurations
@toolsetarray = ();
@configurationarray = ();
$toolsetarray[$toolsets{$_}] = $_ foreach (keys %toolsets);
$configurationarray[$configurations{$_}] = $_ foreach (keys %configurations);
# print header
print <<END;
<html><head><title>pugixml autotest report</title></head><body>
<h3>pugixml autotest report</h3>
<table border=1 cellspacing=0 cellpadding=4>
END
# print configuration header (release/debug)
print "<tr><td align='right'>configuration</td>";
print "<td>".(split /\s+/)[0]."</td>" foreach (@configurationarray);
print "</tr>\n";
# print defines header (one row for each define)
foreach $define (sort {$a cmp $b} keys %defines)
{
print "<tr><td align='right'><small>$define</small></td>";
foreach (@configurationarray)
{
my $present = ($_ =~ /\b$define\b/);
my $color = $present ? "#cccccc" : "#ffffff";
print "<td bgcolor='$color' align='center'>" . ($present ? "+" : "&nbsp;") . "</td>";
}
print "</tr>\n";
}
# print data (one row for each toolset)
foreach $tool (@toolsetarray)
{
print "<tr><td>$tool</td>";
foreach (@configurationarray)
{
my $cmdline = "jam toolset=" . (split /\s+/, $tool)[0] . " defines=" . (split /\s+/, $_)[1] . " configuration=" . (split /\s+/, $_)[0];
my $info = $results{$tool}{$_};
if (!defined $$info{result})
{
print "<td bgcolor='#cccccc'>&nbsp;</td>";
}
elsif ($$info{result} == 0)
{
my ($coverage_pugixml, $coverage_pugixpath) = ($$info{coverage_pugixml}, $$info{coverage_pugixpath});
print "<td bgcolor='#00ff00' align='center' title='$cmdline'>pass";
if ($coverage_pugixml > 0 || $coverage_pugixpath > 0)
{
print "<br><font size='-2'>" . ($coverage_pugixml + 0) . "%<br>" . ($coverage_pugixpath + 0) . "%</font>";
}
print "</td>";
}
else
{
print "<td bgcolor='#ff0000' align='center' title='$cmdline'>fail</td>"
}
}
print "</tr>\n";
}
# print footer
$date = localtime;
print <<END;
</table><br>
Generated on $date
</body></html>
END