From 28b54109d754b910c9e0e89a0cdeaf72c2493aa4 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Wed, 12 May 2010 20:49:41 +0000 Subject: tests: Removed abbreviated defines, added HTML report generator git-svn-id: http://pugixml.googlecode.com/svn/trunk@417 99668b35-9821-0410-8761-19e4c4f06640 --- tests/autotest-report.pl | 115 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 tests/autotest-report.pl (limited to 'tests/autotest-report.pl') diff --git a/tests/autotest-report.pl b/tests/autotest-report.pl new file mode 100644 index 0000000..9379c28 --- /dev/null +++ b/tests/autotest-report.pl @@ -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 <pugixml autotest report +

pugixml autotest report

+ +END + +# print configuration header (release/debug) +print ""; +print "" foreach (@configurationarray); +print "\n"; + +# print defines header (one row for each define) +foreach $define (sort {$a cmp $b} keys %defines) +{ + print ""; + + foreach (@configurationarray) + { + my $present = ($_ =~ /\b$define\b/); + my $color = $present ? "#cccccc" : "#ffffff"; + print ""; + } + print "\n"; +} + +# print data (one row for each toolset) +foreach $tool (@toolsetarray) +{ + print ""; + + 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 ""; + } + elsif ($$info{result} == 0) + { + my ($coverage_pugixml, $coverage_pugixpath) = ($$info{coverage_pugixml}, $$info{coverage_pugixpath}); + + print ""; + } + else + { + print "" + } + } + + print "\n"; +} + +# print footer +$date = localtime; + +print <
+Generated on $date + +END -- cgit v1.2.3
configuration".(split /\s+/)[0]."
$define" . ($present ? "+" : " ") . "
$tool pass"; + + if ($coverage_pugixml > 0 || $coverage_pugixpath > 0) + { + print "
" . ($coverage_pugixml + 0) . "%
" . ($coverage_pugixpath + 0) . "%
"; + } + + print "
fail