Add basic HTML page generation for automated test bed run.

This commit is contained in:
Ben Greear
2020-04-24 16:32:17 -07:00
parent 10c706e4ec
commit f7f47848e6
5 changed files with 186 additions and 4 deletions

View File

@@ -166,12 +166,12 @@ sleep 20
# Tell GUI to load and build the scenario
../lf_gui_cmd.pl --manager $GMANAGER --port $GMPORT --scenario $SCENARIO
# Clean out temp report directory
# Clean out temp report directory on local system and remote
if [ -d $RPT_TMPDIR ]
then
rm -fr $RPT_TMPDIR/*
fi
ssh lanforge\@GMANAGER "test -d $RPT_TMPDIR && rm -fr $RPT_TMPDIR";
# Do dataplane pkt size test
echo "Checking if we should run Dataplane packet size test."
@@ -325,5 +325,7 @@ then
mv $MY_TMPDIR/dut_console_log.txt $RSLTS_DIR/
fi
./lf_gui_report_summary.pl --title "TIP Test Bed Results" --dir $RSLTS_DIR < index_template.html > $RSLTS_DIR/index.html
echo "Done with regression test."
echo "Results-Dir: $RSLTS_DIR"

55
gui/index_template.html Normal file
View File

@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1' />
<title>___TITLE___</title> <link rel='shortcut icon' href='canvil.ico' type='image/x-icon' />
<link rel='stylesheet' href='report.css' />
<link rel='stylesheet' href='custom.css' />
<style>
pre {
overflow: auto;
}
img {
width: 100%;
max-width: 8in;
}
</style>
</head>
<body>
<div class='HeaderStyle'>
<h1 class='TitleFontPrint'>___TITLE___</h1><br/>
<h4 class='TitleFontPrintSub'><br>___DATE___</h4></div>
<div class='contentDiv'>
<br>
<h3>Individual test results and logs.</h3>
<table border="1" cellpadding="6" cellspacing="0" style="border-top-color: gray; border-top-style: solid; border-top-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px">
<!-- <tr><td><a href=ap_auto_basic_cx/index.html>AP AUto Basic CX Report</a></td><td><a href=ap_auto_basic_cx/logs>Logs</a></td></tr> -->
___TR_TESTS___
</table>
<P>
<table border="1" cellpadding="2" cellspacing="0" style="border-top-color: gray; border-top-style: solid; border-top-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px">
<tr><th>Test Rig</th><th>DUT Hardware</th><th>DUT Software</th><th>DUT Model</th><th>DUT Serial</th></tr>
<!-- <tr><td>Ben-Home-OTA</td><td>Linksys-MR8300</td><td>TIP-OpenWrt</td><td>Linksys-MR8300</td><td>Unknown</td></tr> -->
___TR_DUT___
</table>
<P>
<table border="1" cellpadding="2" cellspacing="0" style="border-top-color: gray; border-top-style: solid; border-top-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px">
<tr><th>Test-ID</th><th>Short Description</th><th>Pass/Fail</th><th>Numeric Result</th><th>Test Details</th></tr>
<!-- <tr><td>AP AUtomated Test</td><td>Daul Band Performance</td><td>PASS</td><td>86.44</td><td>Dual-Concurrent vs 90% of Sum: 435.68 Mbps / 558.84 Mbps Dual-Concurrent vs 90% of Sum: 598.17 Mbps / 630.11 Mbps</td></tr> -->
___TR_KPI___
</table>
</div><!--end content-div -->
<div class='FooterStyle'><span class='Gradient'>Generated by Candela Technologies LANforge network testing tool.<br/>
<a href='https://www.candelatech.com/' target='_blank'>www.candelatech.com</a>
</span>
<a class='LogoImgLink' href='https://www.candelatech.com/' target='_blank'><img align='right' src='candela_swirl_small-72h.png'></a></div><br/>
</body>
</html>

125
gui/lf_gui_report_summary.pl Executable file
View File

@@ -0,0 +1,125 @@
#!/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 .= "<tr><td><a href=\"$line/index.html\">$line</html></td><td><a href=\"$line/logs\">Logs</td></tr>\n";
}
else {
$tests_tr .= "<tr><td><a href=\"$line/index.html\">$line</html></td><td></td></tr>\n";
}
if ( -f "$line/kpi.csv") {
my @kpi = `cat $line/kpi.csv`;
chomp(@kpi);
my $i = 0;
foreach my $k (@kpi) {
$i++;
if ($i == 1) {
next; # skip header
}
my @cols = split(/\t/, $k);
if ($dut_tr eq "") {
$dut_tr = "<tr><td>$cols[1]</td><td>$cols[2]</td><td>$cols[3]</td><td>$cols[4]</td><td>$cols[5]</td></tr>\n";
}
$kpi_tr .= "<tr><td>$cols[7]</td><td>$cols[8]</td><td>$cols[9]</td><td>$cols[10]</td><td>$cols[11]</td></tr>\n";
}
}
}
}
my $date = `date`;
while (<>) {
my $ln = $_;
chomp($ln);
$ln =~ s/___TITLE___/$title/g;
$ln =~ s/___DATE___/$date/g;
$ln =~ s/___TR_DUT___/$dut_tr/g;
$ln =~ s/___TR_KPI___/$kpi_tr/g;
$ln =~ s/___TR_TESTS___/$tests_tr/g;
print "$ln\n";
}
exit(0);
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----

View File

@@ -152,7 +152,7 @@ if ($ttype ne "") {
# Copy some place it can be seen easily?
print("LANforge GUI test complete, rpt-dest: $rpt_dest location: $loc\n");
if ($rpt_dest ne "") {
if (-d $loc) {
if ($lfmgr_host eq "localhost" || $lfmgr_host eq "127.0.0.1") {
# Must be on the local system
my $cp = "cp -ar $loc $rpt_dest";
print "Copy test results: $cp\n";

View File

@@ -184,7 +184,7 @@ elsif ($::action eq "set") {
$cmd = "add_text_blob '$test_type' '$test_name' $ln";
print("$cmd\n");
if ($i % 25 == 0) {
if (($i % 25) != 0) {
$::utils->doCmd($cmd, 1); # send and do not wait for result
}
else {