Skip to content

Commit

Permalink
Testsuite: Custom platform names display in test results (#8622)
Browse files Browse the repository at this point in the history
## Summary of Changes

Update Perl scripts to support custom platform display names through
CGAL_SUMMARY_NAME variable.
This PR is the companion of
[PR166](CGAL/cgal-testsuite-dockerfiles#166)
(cgal-testsuite-dockerfiles) that introduces this variable.
  • Loading branch information
lrineau authored Dec 13, 2024
2 parents 0780533 + 81932f1 commit 5050ba0
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 88 deletions.
149 changes: 63 additions & 86 deletions Maintenance/test_handling/create_testresult_page
Original file line number Diff line number Diff line change
Expand Up @@ -299,57 +299,28 @@ EOF
}
}

sub sort_pf
{
# MSVS first
if($a =~ m/^MS/) {
if($b =~ m/^MS/) {
return $a cmp $b;
}
else
{
return -1;
}
}
if($b =~ m/^MS/) { return 1; }

# g++/gcc second
if($a =~ m/^g[c+][c+]/) {
if($b =~ m/^g[c+][c+]/) {
return $a cmp $b;
}
else
{
return -1;
}
}
if($b =~ m/^g[c+][c+]/) { return 1; }

# Intel third
if($a =~ m/^[iI]/) {
if($b =~ m/^[iI]/) {
return $a cmp $b;
}
else
{
return -1;
sub sort_pf {
my $platform_a = $a;
my $platform_b = $b;
my $platform = $platform_a;
foreach (@available_platforms) {
if (short_pfname($_) eq $a) {
$platform = $_;
last;
}
}
if($b =~ m/^[iI]/) { return 1; }

# SunPro last
if($a =~ m/^[Ss][uU[Nn]/) {
if($b =~ m/^[Ss][uU[Nn]/) {
return $a cmp $b;
}
else
{
return 1;
$platform_a = $platform;
$platform_b = $b;
foreach (@available_platforms) {
if (short_pfname($_) eq $b) {
$platform = $_;
last;
}
}
if($b =~ m/^[Ss][uU[Nn]/) { return -1; }

return $a cmp $b;
$platform_b = $platform;
my $os_a = $platforms_info{$platform_a}->{operating_system} // '';
my $os_b = $platforms_info{$platform_b}->{operating_system} // '';
return $os_a cmp $os_b;
}

sub parse_platform($)
Expand Down Expand Up @@ -399,7 +370,6 @@ 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) {
Expand Down Expand Up @@ -437,37 +407,8 @@ sub choose_platforms()
}
}

sub print_platform_descriptions()
{
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">Platform Name</th>
<th>Compiler</th>
<th>Operating System</th>
<th>Tester</th>
<th class="ok">y</th>
<th class="third_party_warning">t</th>
<th class="warning">w</th>
<th class="timeout">o</th>
<th class="error">n</th>
<th class="requirements">r</th>
<th>DEBUG?</th>
<th>CMake</th>
<th>BOOST</th>
<th>MPFR</th>
<th>GMP</th>
<th>QT</th>
<th>LEDA</th>
<th>CXXFLAGS</th>
<th>LDFLAGS</th>
</tr>
EOF
my ($platform_num, $pf)=(0);
foreach $pf (@platforms_to_do) {
sub read_platform_info {
foreach my $pf (@available_platforms) {
my $platform_info;
if (open (PLATFORM_JSON, "<results_${pf}.json")) { ## read the json file of the platform
local $/;
Expand All @@ -479,6 +420,7 @@ EOF
}
elsif (open (PLATFORM_INFO, "<results_${pf}.info")) { ## if the json file does not exist, read the old .info file
$_ = <PLATFORM_INFO>; # CGAL_VERSION
chomp(my $platform_name = <PLATFORM_INFO>);
chomp(my $compiler = <PLATFORM_INFO>);
chomp(my $operating_system = <PLATFORM_INFO>);
chomp(my $tester_name = <PLATFORM_INFO>);
Expand All @@ -491,7 +433,7 @@ EOF
chomp($versions_and_flags[$index] = <PLATFORM_INFO>);
}
$platform_info = {
name => $pf,
platform_name => $platform_name,
compiler => $compiler,
operating_system => $operating_system,
tester_name => $tester_name,
Expand Down Expand Up @@ -531,11 +473,44 @@ EOF
$platform_info->{third_party_libs} = \@tpl_list;
$platforms_info{$pf} = $platform_info;
}
$platform_is_64bits{$pf} = ! ($pf =~ m/32/);
$platform_is_optimized{$pf} = ($platform_info->{CXXFLAGS} =~ m|([-/]x?O[1-9])|);
}
}

sub print_platform_descriptions()
{
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">Platform Name</th>
<th>Compiler</th>
<th>Operating System</th>
<th>Tester</th>
<th class="ok">y</th>
<th class="third_party_warning">t</th>
<th class="warning">w</th>
<th class="timeout">o</th>
<th class="error">n</th>
<th class="requirements">r</th>
<th>DEBUG?</th>
<th>CMake</th>
<th>BOOST</th>
<th>MPFR</th>
<th>GMP</th>
<th>QT</th>
<th>LEDA</th>
<th>CXXFLAGS</th>
<th>LDFLAGS</th>
</tr>
EOF
my $platform_num = 0;
foreach my $pf (@platforms_to_do) {
my $platform_info = $platforms_info{$pf};
my $pf_num_plus_one = $platform_num + 1;
# my $pf_short = join('_',parse_platform_2($pf));
(my $pf_short) = ($pf =~ m/_(.*)/);
($platform_is_64bits{$pf}) = ! ($pf =~ m/32/);
($platform_is_optimized{$pf}) = ($platform_info->{CXXFLAGS} =~ m|([-/]x?O[1-9])|);
my $county = $testresults[$platform_num]->{"y"};
my $countt = $testresults[$platform_num]->{"t"};
my $countw = $testresults[$platform_num]->{"w"};
Expand All @@ -546,7 +521,7 @@ EOF
print OUTPUT <<~EOF;
<tr>
<td><a name="platform$pf_num_plus_one">$pf_num_plus_one</a></td>
<td><a href="$release_name/Installation/TestReport_$pf.gz">$pf_short</a></td>
<td><a href="$release_name/Installation/TestReport_$pf.gz">$platform_info->{platform_name}</a></td>
<td>$platform_info->{compiler}</td>
<td>$platform_info->{operating_system}</td>
<td><a href="mailto:$platform_info->{tester_address}">$platform_info->{tester_name}</a></td>
Expand Down Expand Up @@ -680,6 +655,8 @@ sub main()
# init_known_platforms();
chdir $testresult_dir or die;
chdir $release_name or die;
@available_platforms = list_platforms();
read_platform_info();
choose_platforms();
chdir "..";

Expand Down Expand Up @@ -761,7 +738,7 @@ sub get_warnings_and_errors {
}

sub create_summary_page {
my $platform_options = join("\n", map { "<option value=\"$_\">$_</option>" } @platforms_to_do);
my $platform_options = join("\n", map { "<option value=\"$_\">$platforms_info{$_}->{platform_name}</option>" } @platforms_to_do);
my $test_directory;
my @letters = ('r', 'n', 'w', 'o');
my $letters_options = join("\n", map { "<option value=\"$_\">$_</option>" } @letters);
Expand Down
3 changes: 2 additions & 1 deletion Maintenance/test_handling/testresult.css
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,12 @@ TABLE.result TD > a.package_name {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
overflow-y: auto;
}

.modal-content {
background-color: white;
margin: 10% auto;
margin: 3% auto;
padding: 20px;
border: 1px solid #888;
width: 60%;
Expand Down
13 changes: 12 additions & 1 deletion Maintenance/test_handling/to_zipped_format
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ sub reformat_results($)
open (PLATFORM_INFO,">${platform}.info") or return;
open (PLATFORM_NEW_RESULTS,">${platform}.new_results") or return;
my $CGAL_VERSION = "-";
my $PLATFORM_NAME = "-";
my $LEDA_VERSION = "-";
my $COMPILER = "-";
my $OS = "-";
Expand Down Expand Up @@ -89,6 +90,7 @@ sub reformat_results($)
}
if (/-- Operating system: (.*)/) {
$OS = $1;
$OS =~ s/"//g;
}
if (/^TESTER_NAME\s+(.*)$/) {
$TESTER_NAME = $1;
Expand Down Expand Up @@ -154,6 +156,12 @@ sub reformat_results($)
$TPL = "$TPL $1 $2,";
push @third_party_libs, { name => $1, version => $2 };
}
if (/^CGAL_TEST_PLATFORM\s+(.*)$/) {
$PLATFORM_NAME = "$1" if ($PLATFORM_NAME eq "-");
}
if (/^CGAL_SUMMARY_NAME\s+(.*)$/) {
$PLATFORM_NAME = "$1";
}
NEXT: if(! ($_= <PLATFORM_RESULTS>)) {
# should never happen!!
last;
Expand All @@ -163,8 +171,9 @@ NEXT: if(! ($_= <PLATFORM_RESULTS>)) {
print PLATFORM_NEW_RESULTS $_;
}
rename("${platform}.new_results","${platform}.txt") or die "cannot rename!";
my $platform_info = {
my $platform_info = {
"cgal_version" => $CGAL_VERSION,
"platform_name" => $PLATFORM_NAME,
"compiler" => $COMPILER,
"operating_system" => $OS,
"tester_name" => $TESTER_NAME,
Expand All @@ -184,6 +193,7 @@ NEXT: if(! ($_= <PLATFORM_RESULTS>)) {
close PLATFORM_JSON;
print PLATFORM_INFO <<"EOF";
$CGAL_VERSION
$PLATFORM_NAME
$COMPILER
$OS
$TESTER_NAME
Expand All @@ -197,6 +207,7 @@ $LEDA_VERSION
$CXXFLAGS
$LDFLAGS
$TPL
$PLATFORM_NAME
EOF
close(PLATFORM_INFO);
close(PLATFORM_RESULTS);
Expand Down
3 changes: 3 additions & 0 deletions Scripts/developer_scripts/run_testsuite_with_ctest
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ run_test_on_platform()
echo "CGAL_VERSION ${CGAL_GIT_VERSION}">> "$RESULT_FILE"
fi
sed -n '/The CXX compiler/s/-- The CXX compiler identification is/COMPILER_VERSION =/p' < "${CGAL_BINARY_DIR}/installation.log" |sed -E "s/ = (.*)/\ = '\1\'/">> "$RESULT_FILE"
if [ -n "${CGAL_SUMMARY_NAME}" ]; then
echo "CGAL_SUMMARY_NAME ${CGAL_SUMMARY_NAME}" >> "$RESULT_FILE"
fi
echo "TESTER ${CGAL_TESTER}" >> "$RESULT_FILE"
echo "TESTER_NAME ${CGAL_TESTER}" >> "$RESULT_FILE"
echo "TESTER_ADDRESS ${TESTER_ADDRESS}" >> "$RESULT_FILE"
Expand Down

0 comments on commit 5050ba0

Please sign in to comment.