#!/usr/bin/perl -w # Generate HTML summary page for a collection of GUI reports (with kpi.csv) # (C) 2020 Candela Technologies Inc. # use strict; use warnings; use diagnostics; use Carp; $SIG{ __DIE__ } = sub { Carp::confess( @_ ) }; $SIG{ __WARN__ } = sub { Carp::confess( @_ ) }; # Un-buffer output $| = 1; # use lib prepends to @INC, so put lower priority first # This is before run-time, so cannot condition this with normal 'if' logic. use lib '/home/lanforge/scripts'; use lib "../"; use lib "./"; use Getopt::Long; our $dir = ""; our $title = "Automated test results."; ######################################################################## # Nothing to configure below here, most likely. ######################################################################## our $usage = <<"__EndOfUsage__"; $0 [ --dir directory-to-process ] Example: $0 --dir ~/tmp/results --title "My Title" __EndOfUsage__ my $i = 0; my $show_help = 0; GetOptions ( 'dir|d=s' => \$::dir, 'title|t=s' => \$::title, 'help|h' => \$show_help, ) || die("$::usage"); if ($show_help) { print $usage; exit 0; } chdir($dir); my @files = `ls`; chomp(@files); my $line; # Find some html helpers and copy them to current dir. foreach $line (@files) { if ( -d $line) { if ( -f "$line/canvil.ico") { `cp $line/canvil.ico ./`; `cp $line/*.css ./`; `cp $line/candela_swirl* ./`; `cp $line/CandelaLogo* ./`; last; } } } my $dut_tr = ""; my $kpi_tr = ""; my $tests_tr = ""; foreach my $line (@files) { if ( -d $line) { if ( -d "$line/logs") { $tests_tr .= "