Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 183 additions & 2 deletions common/prettify.pm
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,180 @@ sub Normal ($)
###############################################################################
###############################################################################

package Prettify::Failed_Tests_HTML;

use strict;
use warnings;

use FileHandle;

###############################################################################

sub new ($)
{
my $proto = shift;
my $class = ref ($proto) || $proto;
my $self = {};
my $basename = shift;
my $buildname = shift;

my $path = substr($basename, 0, index($basename, '/'));
my $filename = $path . "/Failed_Tests.html";

$basename =~ s/^.*\///;

$self->{FULLHTML} = $basename . "_Full.html";
$self->{ERROR_COUNTER} = 0;
$self->{WARNING_COUNTER} = 0;
$self->{SECTION_COUNTER} = 0;
$self->{SUBSECTION_COUNTER} = 0;
$self->{TITLE} = "Failed Test Brief Log";
$self->{GIT_CHECKEDOUT_OPENDDS} = "unknown";

unless (-e $filename) {
my $file_handle = new FileHandle ($filename, 'w');
print {$file_handle} "<h1>$self->{TITLE}</h1>\n";
}

$self->{FH} = new FileHandle ($filename, '>>');
$self->{FILENAME} = $filename;
$self->{BUILDNAME} = $buildname;

bless ($self, $class);
return $self;
}

sub Header ()
{
my $self = shift;
print {$self->{FH}} "<html>\n";
print {$self->{FH}} "<body bgcolor=\"white\">\n";
}

sub Footer ()
{
my $self = shift;

# In the case where there was no errors or warnings, output a note
if ($self->{ERROR_COUNTER} == 0 && $self->{WARNING_COUNTER} == 0) {
print {$self->{FH}} "No Errors or Warnings detected<br>\n";
}

print {$self->{FH}} "</body>\n";
print {$self->{FH}} "</html>\n";
}

sub Section ($)
{
my $self = shift;
my $s = shift;

# Escape any '<' or '>' signs
$s =~ s/</&lt;/g;
$s =~ s/>/&gt;/g;

my $counter = ++$self->{SECTION_COUNTER};

# Save for later use

$self->{LAST_SECTION} = $s;
}

sub Description ($)
{
my $self = shift;

# Ignore
}

sub Timestamp ($)
{
my $self = shift;
# Ignore
}

sub Subsection ($)
{
my $self = shift;
my $s = shift;

# Escape any '<' or '>' signs
$s =~ s/</&lt;/g;
$s =~ s/>/&gt;/g;

my $counter = ++$self->{SUBSECTION_COUNTER};

# Save for later use

$self->{LAST_SUBSECTION} = $s;
}

sub Print_Sections ()
{
my $self = shift;

if (defined $self->{LAST_SECTION} && defined $self->{LAST_SUBSECTION} && $self->{LAST_SECTION} eq 'Test') {
if (defined $self->{BUILDNAME}) {
print {$self->{FH}} "<hr><h2>$self->{BUILDNAME}</h2>\n";
my $rev = substr($self->{GIT_CHECKEDOUT_OPENDDS}, 0, 8);
Comment thread
kuznetsovmoci marked this conversation as resolved.
print {$self->{FH}} "Rev: $rev<hr>\n";
$self->{BUILDNAME} = undef;
}

print {$self->{FH}} "<a name=\"subsection_$self->{SUBSECTION_COUNTER}\"></a>";
print {$self->{FH}} "<h3>$self->{LAST_SUBSECTION}</h3>\n";
$self->{LAST_SUBSECTION} = undef;
}
}

sub Error ($)
{
my $self = shift;
my $s = shift;

# Escape any '<' or '>' signs
$s =~ s/</&lt;/g;
$s =~ s/>/&gt;/g;

my $counter = ++$self->{ERROR_COUNTER};

$self->Print_Sections ();

print {$self->{FH}} "<a name=\"error_$counter\"></a>\n";
print {$self->{FH}} "<tt>[<a href=\"$self->{FULLHTML}#error_$counter"
. "\">Details</a>] </tt>";
print {$self->{FH}} "<font color=\"FF0000\"><tt>$s</tt></font><br>\n";
}

sub Warning ($)
{
my $self = shift;
my $s = shift;

# Escape any '<' or '>' signs
$s =~ s/</&lt;/g;
$s =~ s/>/&gt;/g;

my $counter = ++$self->{WARNING_COUNTER};

$self->Print_Sections ();

print {$self->{FH}} "<a name=\"warning_$counter\"></a>\n";
print {$self->{FH}} "<tt>[<a href=\"$self->{FULLHTML}#warning_$counter"
. "\">Details</a>] </tt>";
print {$self->{FH}} "<font color=\"FF7700\"><tt>$s</tt></font><br>\n";
}

sub Normal ($)
{
my $self = shift;

# Ignore
}

###############################################################################
###############################################################################

package Prettify::JUnit;

use strict;
Expand Down Expand Up @@ -868,6 +1042,7 @@ sub new ($)
my $class = ref ($proto) || $proto;
my $self = {};
my $basename = shift;
my $buildname = shift;

# Initialize some variables

Expand Down Expand Up @@ -896,6 +1071,7 @@ sub new ($)
new Prettify::Brief_HTML ($basename),
new Prettify::Totals_HTML ($basename), #Must be 2
new Prettify::Config_HTML ($basename), #Must be 3
new Prettify::Failed_Tests_HTML ($basename, $buildname), #Must be 4
);

my $junit = main::GetVariable ('junit_xml_output');
Expand Down Expand Up @@ -1111,6 +1287,7 @@ sub Setup_Handler ($)
}

my $totals= (@{$self->{OUTPUT}})[2];
my $failed_test= (@{$self->{OUTPUT}})[4];

if ($s =~ m/Executing: (?:.*\/)?cvs(?:.exe)? /i) ## Prismtech still use some CVS please leave
{
Expand Down Expand Up @@ -1242,6 +1419,7 @@ sub Setup_Handler ($)
elsif ("$totals->{GIT_CHECKEDOUT_OPENDDS}" eq "Matched")
{
$totals->{GIT_CHECKEDOUT_OPENDDS} = $sha;
$failed_test->{GIT_CHECKEDOUT_OPENDDS} = $sha;
}
$self->Output_Normal ($s);
}
Expand Down Expand Up @@ -1316,6 +1494,7 @@ sub Config_Handler ($)
$outputs[3]->Normal($s, $state);

my $totals= (@{$self->{OUTPUT}})[2];
my $failed_tests= (@{$self->{OUTPUT}})[4];

if ($s =~ m/SVN_REVISION(_(\d))?=(\d+)/)
{
Expand Down Expand Up @@ -1372,6 +1551,7 @@ sub Config_Handler ($)
my $revision = $totals->{GIT_REVISIONS}[0];
print "Matched GIT url to revision $revision\n";
$totals->{GIT_CHECKEDOUT_OPENDDS} = $revision;
$failed_tests->{GIT_CHECKEDOUT_OPENDDS} = $revision;
}
}
elsif ($s =~ m/GIT_COMMIT=(.+)/)
Expand Down Expand Up @@ -1505,13 +1685,14 @@ sub BuildErrors ($)
# In this function we process the log file line by line,
# looking for errors.

sub Process ($)
sub Process ($$)
{
my $filename = shift;
my $basename = $filename;
$basename =~ s/\.txt$//;
my $buildname = shift;

my $processor = new Prettify ($basename);
my $processor = new Prettify ($basename, $buildname);

my $input = new FileHandle ($filename, 'r');

Expand Down
6 changes: 4 additions & 2 deletions scoreboard.pl
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ ($$)

### Print timestamp

print $indexhtml "<br><a href=\"Failed_Tests.html\">Failed Test Brief Log</a><br>\n";
print $indexhtml '<br>Last updated at ' . get_time_str() . "<br>\n";

### Print the Footer
Expand Down Expand Up @@ -539,7 +540,7 @@ ($)
}

print " Prettifying\n" if($verbose);
Prettify::Process ("$directory/$buildname/$filename");
Prettify::Process ("$directory/$buildname/$filename", $buildname);
}
}
}
Expand Down Expand Up @@ -653,7 +654,7 @@ ($)
if ( -e $file . "_Totals.html" ) {next;}
if ( $post == 1 ) {
print " Prettifying $file.txt\n" if($verbose);
Prettify::Process ("$file.txt");
Prettify::Process ("$file.txt", $buildname);
$updated++;
} else {
# Create the triggerfile for the next time we run
Expand Down Expand Up @@ -1138,6 +1139,7 @@ ($$$)

### Print timestamp

print $indexhtml "<br><a href=\"Failed_Tests.html\">Failed Test Brief Log</a><br>\n";
print $indexhtml '<br>Last updated at ' . get_time_str() . "<br>\n";

### Print the Footer
Expand Down