mirror of https://github.com/CGAL/cgal
524 lines
14 KiB
Perl
Executable File
524 lines
14 KiB
Perl
Executable File
#!/usr/bin/env perl
|
|
#
|
|
# author: Geert-Jan Giezeman
|
|
#
|
|
# This script creates a WWW page with a table of test suite results.
|
|
#
|
|
# Usage:
|
|
# create_testresult_page <directory>
|
|
|
|
# Creates the following files :
|
|
# - results-$version.shtml
|
|
# - versions.inc (contains the version selector)
|
|
# - index.shtml -> results-$version.shtml (symlink)
|
|
|
|
use Cwd;
|
|
use strict;
|
|
|
|
my ($PLATFORMS_BESIDE_RESULTS, $PLATFORMS_REF_BETWEEN_RESULTS)=(1,1);
|
|
|
|
my $TEMPPAGE="tmp$$.html";
|
|
my $TEMPPAGE2="tmp2$$.html";
|
|
my $release_name;
|
|
my @platforms_to_do;
|
|
my @known_platforms;
|
|
my %platform_short_names;
|
|
my @available_platforms;
|
|
my %test_directories = ();
|
|
my @testresults;
|
|
my $testresult_dir=cwd()."/TESTRESULTS";
|
|
|
|
|
|
sub write_select()
|
|
{
|
|
my($filename, @result);
|
|
print OUTPUTV "<table><tr><td>You can browse the test results of a different version :\n";
|
|
print OUTPUTV '<td><select id="sel" onchange="sel=document.getElementById(\'sel\'); top.location.href=sel.options[sel.selectedIndex].value">'."\n";
|
|
|
|
print OUTPUTV '<option value="">', "</option>\n";
|
|
foreach $_ (sort { $a =~ /results-([^I]*)(|-I-(.*))\.shtml/;
|
|
my ($maj_a, $min_a) = ($1, $2 ? $3 : "9999");
|
|
# public releases are given minor 9999.
|
|
$b =~ /results-([^I]*)(|-I-(.*))\.shtml/;
|
|
my ($maj_b, $min_b) = ($1, $2 ? $3 : "9999");
|
|
# We sort major numbers alphabetically,
|
|
# and minors numerically.
|
|
return ($maj_a eq $maj_b) ? ($min_b <=> $min_a)
|
|
: ($maj_b cmp $maj_a);
|
|
} (glob("results-*.shtml"))) {
|
|
print OUTPUTV '<option value="', $_, '">';
|
|
($filename) = m/results-(.*?)\.shtml\s*/;
|
|
print OUTPUTV $filename, "</option>\n";
|
|
}
|
|
print OUTPUTV "</select></td></tr></table>";
|
|
}
|
|
|
|
sub list_platforms()
|
|
{
|
|
my ($filename, @result);
|
|
foreach $_ (glob("results_*.txt")) {
|
|
($filename) = m/results_(.*?)\.txt\s*/;
|
|
push(@result, $filename) if $filename;
|
|
}
|
|
return @result;
|
|
}
|
|
|
|
sub list_packages($)
|
|
#
|
|
# Fill %test_directories with the packages found in the argument platform.
|
|
# Return false if that platform does not have a list of packages.
|
|
{
|
|
my ($platform) = @_;
|
|
my $test_result="results_${platform}.txt";
|
|
open(TESTRESULT, $test_result) or return 0;
|
|
while (<TESTRESULT>) {
|
|
if (/^\s*(.*?)\s+(\w)\s*$/) {
|
|
$test_directories{$1} = '';
|
|
}
|
|
}
|
|
close TESTRESULT or return 0;
|
|
return 1;
|
|
}
|
|
|
|
sub collect_results_of_platform($)
|
|
{
|
|
my ($platform) = @_;
|
|
# Create an anonymous hash that hashes packages to their result.
|
|
my $platform_results = {};
|
|
my $test_result="results_${platform}.txt";
|
|
my ($yeahs, $nays, $warnings) = (0,0,0);
|
|
my $resulttext;
|
|
open(TESTRESULT, $test_result) or return $platform_results;
|
|
while (<TESTRESULT>) {
|
|
if (/^\s*(.*?)\s+(\w)\s*$/) {
|
|
#($package,$succes) = ($1,$2);
|
|
if ($2 eq 'y' or $2 eq 'Y') {
|
|
$resulttext = 'y';
|
|
++$yeahs;
|
|
} elsif ($2 eq 'w' or $2 eq 'W') {
|
|
$resulttext = 'w';
|
|
++$warnings;
|
|
} elsif ($2 eq 'n' or $2 eq 'N') {
|
|
$resulttext = 'n';
|
|
++$nays;
|
|
} else {
|
|
$resulttext = ' ';
|
|
}
|
|
$platform_results->{$1} = $resulttext;
|
|
}
|
|
}
|
|
close TESTRESULT;
|
|
$platform_results->{"y"} = $yeahs;
|
|
$platform_results->{"n"} = $nays;
|
|
$platform_results->{"w"} = $warnings;
|
|
return $platform_results;
|
|
}
|
|
|
|
sub collect_results()
|
|
{
|
|
my $platform;
|
|
foreach $platform (@platforms_to_do) {
|
|
list_packages($platform);
|
|
}
|
|
foreach $platform (@platforms_to_do) {
|
|
push(@testresults, collect_results_of_platform($platform));
|
|
}
|
|
}
|
|
|
|
sub print_result_table()
|
|
{
|
|
my $platform_count = scalar(@platforms_to_do);
|
|
|
|
print OUTPUT <<"EOF";
|
|
<table class="result" border="1" cellspacing="2" cellpadding="5">
|
|
<tr align="CENTER">
|
|
<th rowspan="2">Package</th>
|
|
<!-- <th rowspan="2">Version</th> -->
|
|
<th colspan="$platform_count">Test Platform</th>
|
|
</tr>
|
|
<tr align="center">
|
|
EOF
|
|
|
|
print_platforms_numbers();
|
|
|
|
print OUTPUT "</tr>\n";
|
|
my $test_directory;
|
|
my $test_num = 0;
|
|
foreach $test_directory (sort keys %test_directories) {
|
|
if ($PLATFORMS_REF_BETWEEN_RESULTS) {
|
|
$test_num++;
|
|
if ($test_num == 15) {
|
|
$test_num = 0;
|
|
print OUTPUT "\n<tr> <td align=\"center\">\n";
|
|
print OUTPUT '<a href="#platforms">Platform Description</a>';
|
|
print OUTPUT "\n";
|
|
print_platforms_numbers();
|
|
print OUTPUT "\n</tr>\n";
|
|
}
|
|
}
|
|
# my $version;
|
|
# if ( -r "$test_directory/version" ) {
|
|
# open(VERSION, "$test_directory/version");
|
|
# while(<VERSION>) {
|
|
# ($version) = /^\s*([^\s]*)\s/;
|
|
# last if $version;
|
|
# }
|
|
# close VERSION;
|
|
# }
|
|
print OUTPUT "\n<tr>\n";
|
|
print OUTPUT "<td><a name=\"$test_directory\">$test_directory</a></td>\n";
|
|
# if ( $version ) {
|
|
# print OUTPUT "<TD ALIGN=CENTER>$version</TD>\n";
|
|
# } else {
|
|
# print OUTPUT "<TD ALIGN=CENTER>?.?</TD>\n";
|
|
# }
|
|
my ($platform_num,$platform)=(0,"");
|
|
$platform_num=0;
|
|
foreach $platform (@platforms_to_do) {
|
|
my ($result,$resulttext);
|
|
$resulttext = $testresults[$platform_num]->{$test_directory};
|
|
if (! defined($resulttext)) {
|
|
$resulttext = ' ';
|
|
}
|
|
print OUTPUT '<td align=center';
|
|
if ($resulttext eq 'y') {
|
|
print OUTPUT ' class="ok"';
|
|
} elsif ($resulttext eq 'w') {
|
|
print OUTPUT ' class="warning"';
|
|
} elsif ($resulttext eq 'n') {
|
|
print OUTPUT ' class="error"';
|
|
}
|
|
else {
|
|
print OUTPUT ' class="na"';
|
|
}
|
|
print OUTPUT '> <a href="',
|
|
"$release_name/$test_directory/TestReport_$platform.gz\"";
|
|
print OUTPUT '>', "$resulttext</a></td>\n";
|
|
++$platform_num;
|
|
|
|
}
|
|
print OUTPUT "</tr>\n";
|
|
}
|
|
print OUTPUT "</table>\n";
|
|
}
|
|
|
|
sub print_resultpage()
|
|
{
|
|
my $platform_count = scalar(@platforms_to_do);
|
|
|
|
print OUTPUT '<h2><a name="testresults">Test Results</a></h2>'."\n";
|
|
if ($PLATFORMS_BESIDE_RESULTS) {
|
|
print OUTPUT <<"EOF";
|
|
<table border="0" cellspacing="5" cellpadding="0">
|
|
<tr align="center">
|
|
<td>
|
|
EOF
|
|
}
|
|
|
|
print_result_table();
|
|
|
|
if ($PLATFORMS_BESIDE_RESULTS) {
|
|
print OUTPUT "<td>\n<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">\n";
|
|
if ($platform_count > 0) {
|
|
my $repeat_count = (1 + 1.1/16.5)*scalar(keys %test_directories)/($platform_count+0.25);
|
|
while ($repeat_count >= 1) {
|
|
$repeat_count--;
|
|
print OUTPUT "<tr><td>\n";
|
|
print_platforms();
|
|
print OUTPUT "</tr>\n";
|
|
}
|
|
}
|
|
print OUTPUT "</table>\n</tr>\n</table>\n";
|
|
}
|
|
}
|
|
|
|
sub parse_platform($)
|
|
{
|
|
my ($pf) = @_;
|
|
$pf =~ s/_LEDA$//;
|
|
my @list = split /_/, $pf;
|
|
return @list;
|
|
}
|
|
|
|
sub parse_platform_2($)
|
|
{
|
|
my ($pf) = @_;
|
|
my @list = parse_platform($pf);
|
|
if (@list > 3) {
|
|
splice(@list,0,@list-3);
|
|
}
|
|
while (@list < 3) {
|
|
push(@list,'?');
|
|
}
|
|
return @list;
|
|
}
|
|
|
|
sub short_pfname($)
|
|
{
|
|
my @pflist = parse_platform_2($_[0]);
|
|
my $shortpf = join('_', $pflist[2], $pflist[1]);
|
|
return $shortpf;
|
|
}
|
|
|
|
sub choose_platforms()
|
|
{
|
|
my (%platform_index, $pf);
|
|
# List all platforms for which there are results
|
|
@available_platforms = list_platforms();
|
|
my $index = 0;
|
|
# Put all known platforms in a hash table.
|
|
for ($index=0; $index < @known_platforms; $index += 1) {
|
|
$pf = $known_platforms[$index];
|
|
$platform_index{$pf} = 1;
|
|
}
|
|
# Check if there are platforms listed that are not known. Warn about this
|
|
# and add those platforms at the end of the list of known platforms.
|
|
foreach (@available_platforms) {
|
|
$pf = $_;
|
|
my @pflist = parse_platform_2($pf);
|
|
my $shortpf = join('_', $pflist[2], $pflist[1]);
|
|
$pf =~ s/^[^_]*_//;
|
|
$pf =~ s/_LEDA$//;
|
|
if (!exists $platform_index{$shortpf}) {
|
|
# print STDERR "Warning: Platform $_ is unknown!\n";
|
|
$platform_index{$shortpf} = 1;
|
|
push(@known_platforms,$shortpf); # ???
|
|
$platform_short_names{$shortpf} = $shortpf;
|
|
}
|
|
}
|
|
|
|
# Make a list of all the platforms that are to be treated, in the order they
|
|
# appear in the list of known_platforms.
|
|
@platforms_to_do = ();
|
|
@known_platforms = sort(@known_platforms);
|
|
for ($index=0; $index < @known_platforms; $index += 1) {
|
|
$pf = $known_platforms[$index];
|
|
my $ind2 = 0;
|
|
foreach (@available_platforms) {
|
|
my $apf = short_pfname($_);
|
|
if ($apf eq $pf) {
|
|
push(@platforms_to_do, $_);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
sub print_platform_descriptions()
|
|
{
|
|
my ($i,$pf_no,$pf) = (0,1);
|
|
print OUTPUT <<'EOF';
|
|
<h2><a name="platforms">Platform Description and Summary</a></h2>
|
|
<table border="1" cellspacing="2" cellpadding="5" class="summary">
|
|
<tr align="center">
|
|
<th colspan="2">OS and compiler</th>
|
|
<th>Tester</th>
|
|
<th class=ok>y</th>
|
|
<th class=warning>w</th>
|
|
<th class=error>n</th>
|
|
<th>BOOST</th>
|
|
<th>MPFR</th>
|
|
<th>GMP</th>
|
|
<th>QT</th>
|
|
<th>OPENGL</th>
|
|
<th>BLAS</th>
|
|
<th>LAPACK</th>
|
|
<th>TAUCS</th>
|
|
<th>LEDA</th>
|
|
<th>CUSTOM CXXFLAGS</th>
|
|
<th>CUSTOM LDFLAGS</th>
|
|
</tr>
|
|
EOF
|
|
my ($platform_num)=(0);
|
|
foreach $pf (@platforms_to_do) {
|
|
my $pf_num_plus_one = $platform_num + 1;
|
|
print OUTPUT "<tr>\n<td><a name=\"platform$pf_num_plus_one\">$pf_no</a>\n";
|
|
$pf_no++;
|
|
# my $pf_short = join('_',parse_platform_2($pf));
|
|
my $pf_short = $pf;
|
|
print OUTPUT "<td>$pf_short\n";
|
|
|
|
if (open (PLATFORM_INFO, "results_${pf}.info")) {
|
|
$_ = <PLATFORM_INFO>;
|
|
$_ = <PLATFORM_INFO>;
|
|
$_ = <PLATFORM_INFO>;
|
|
chomp;
|
|
my $tester_name = $_;
|
|
$_ = <PLATFORM_INFO>;
|
|
chomp;
|
|
my $tester_address = $_;
|
|
print OUTPUT "<td><a href=\"mailto:$tester_address\">$tester_name</a>\n";
|
|
|
|
my $count;
|
|
$count = $testresults[$platform_num]->{"y"};
|
|
print OUTPUT "<td>$count\n";
|
|
$count = $testresults[$platform_num]->{"w"};
|
|
print OUTPUT "<td>$count\n";
|
|
$count = $testresults[$platform_num]->{"n"};
|
|
print OUTPUT "<td>$count\n";
|
|
|
|
my $index = 11;
|
|
while ($index) {
|
|
$index--;
|
|
$_ = <PLATFORM_INFO>;
|
|
chomp;
|
|
print OUTPUT "<td align=\"center\">$_\n";
|
|
}
|
|
} else {
|
|
print OUTPUT "<td>?\n";
|
|
print OUTPUT "<td>?\n";
|
|
print OUTPUT "<td>?\n";
|
|
print OUTPUT "<td>?\n";
|
|
}
|
|
++$platform_num;
|
|
}
|
|
print OUTPUT "</table>\n<p>\n";
|
|
}
|
|
|
|
sub print_platforms_numbers()
|
|
{
|
|
my ($platform_num,$platform)=(0,"");
|
|
foreach $platform (@platforms_to_do) {
|
|
++$platform_num;
|
|
my $pf_short = short_pfname($platform);
|
|
print OUTPUT "<td><a href=\"#platform$platform_num\" title=\"$pf_short\"><b>$platform_num</b></a>\n";
|
|
}
|
|
}
|
|
|
|
sub print_platforms()
|
|
{
|
|
my ($pf_no,$pf) = (1,"");
|
|
print OUTPUT '<table border="1" cellspacing="2" cellpadding="5" >',"\n";
|
|
foreach $pf (@platforms_to_do) {
|
|
print OUTPUT "<tr>\n<td>$pf_no\n";
|
|
$pf_no++;
|
|
my $pf_short = short_pfname($pf);
|
|
print OUTPUT "<td>$platform_short_names{$pf_short}\n</tr>\n";
|
|
}
|
|
print OUTPUT "</table>\n";
|
|
}
|
|
|
|
sub result_filename($)
|
|
{
|
|
return "results".substr($_[0],4).".shtml";
|
|
# $name =~ s/-I-/-/;
|
|
}
|
|
|
|
|
|
sub print_little_header(){
|
|
print OUTPUT<<"EOF";
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
"http://www.w3.org/TR/html4/strict.dtd">
|
|
<html lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>${release_name} Test Results</title>
|
|
<link rel="shortcut icon" href="http://www.cgal.org/cgal.ico">
|
|
<link rel="stylesheet" type="text/css" href="testresult.css">
|
|
<!-- This file is generated by a program. Do not edit manually!! -->
|
|
</head>
|
|
<body>
|
|
<h2>Test Results of ${release_name}</h2>
|
|
<!--#include virtual="versions.inc"-->
|
|
<p>The results of the tests are presented in a table
|
|
('y' = success, 'w' = warning, 'n' = failure),
|
|
and the error + compiler output from each test can be retrieved by clicking
|
|
on it.</p>
|
|
<p><b>N.B. The detection of warnings is not exact.
|
|
Look at the output to be sure!</b></p>
|
|
<ol>
|
|
<li><a href="../Releases/">
|
|
Downloading internal releases</a></li>
|
|
<li><a href="http://www.cgal.org/Members/Manual_test/${release_name}/" style="color: red">
|
|
The documentation of this release</a>
|
|
(and the <a href="http://www.cgal.org/Members/Manual_test/LAST/">last one</a>
|
|
directly)</li>
|
|
EOF
|
|
if ( -r "announce.html" ) {
|
|
print OUTPUT<<"EOF";
|
|
<li><a href="$release_name/announce.html">Announcement of this release</a></li>
|
|
EOF
|
|
}
|
|
|
|
print OUTPUT "</ol>\n";
|
|
print OUTPUT '<p>The description of all platforms is <a href="#platforms">at the end of the page</a>. ';
|
|
print OUTPUT 'In the table below, each column is numeroted, and correspond to a platform. ';
|
|
print OUTPUT 'Each column number is a link to the platform description table.</p> ', "\n";
|
|
}
|
|
|
|
|
|
sub main()
|
|
{
|
|
if (scalar(@ARGV) != 1 ) {
|
|
print STDERR "usage: $0 directory\n";
|
|
exit 1;
|
|
}
|
|
|
|
$release_name =shift(@ARGV);
|
|
|
|
$release_name =~ s<(\s+)$><>;
|
|
$release_name =~ s<(/)$><>;
|
|
chdir $testresult_dir or die;
|
|
if ( ! -d $release_name ) {
|
|
print STDERR "$release_name is not a valid directory\n";
|
|
exit 1;
|
|
}
|
|
|
|
# init_known_platforms();
|
|
chdir $testresult_dir or die;
|
|
chdir $release_name or die;
|
|
choose_platforms();
|
|
chdir "..";
|
|
|
|
umask 0022;
|
|
unlink $TEMPPAGE;
|
|
unlink $TEMPPAGE2;
|
|
open(OUTPUT,">$TEMPPAGE") or die;
|
|
open(OUTPUTV,">$TEMPPAGE2") or die;
|
|
chdir $testresult_dir or die;
|
|
chdir $release_name or die;
|
|
collect_results();
|
|
print_little_header();
|
|
print_resultpage();
|
|
print_platform_descriptions();
|
|
|
|
print OUTPUT << 'EOF';
|
|
<p>
|
|
<a href="http://validator.w3.org/check?uri=https://cgal.geometryfactory.com<!--#echo var="DOCUMENT_URI" -->"><img
|
|
src="http://www.w3.org/Icons/valid-html401-blue"
|
|
alt="Valid HTML 4.01 Strict" height="31" width="88"></a>
|
|
</p>
|
|
EOF
|
|
print OUTPUT "</body>\n</html>\n";
|
|
|
|
close OUTPUT;
|
|
chdir "..";
|
|
|
|
my $WWWPAGE = result_filename($release_name);
|
|
rename $TEMPPAGE, $WWWPAGE;
|
|
chmod 0644, $WWWPAGE;
|
|
unlink "index.shtml";
|
|
symlink $WWWPAGE, "index.shtml";
|
|
|
|
# Deal with the versions.inc file.
|
|
write_select();
|
|
my $VERSIONS_WEBPAGE="versions.inc";
|
|
rename $TEMPPAGE2, $VERSIONS_WEBPAGE;
|
|
chmod 0644, $VERSIONS_WEBPAGE;
|
|
}
|
|
|
|
sub init_known_platforms()
|
|
{
|
|
my ($short_name, $full_name);
|
|
open(PLATFORMS,'known_platforms') or die;
|
|
@known_platforms = ();
|
|
while(<PLATFORMS>) {
|
|
($short_name, $full_name) =split;
|
|
$full_name = short_pfname($full_name);
|
|
push(@known_platforms,$full_name);
|
|
$platform_short_names{$full_name} = $full_name;
|
|
}
|
|
close(PLATFORMS);
|
|
}
|
|
|
|
main();
|