Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 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
94 changes: 63 additions & 31 deletions common/prettify.pm
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ sub new ($)
my $self = {};
my $basename = shift;
my $buildname = shift;
my $failed_tests = shift;
my $rev_link = shift;
my $log_prefix = shift;

Expand All @@ -383,6 +384,7 @@ sub new ($)
$self->{SUBSECTION_COUNTER} = 0;
$self->{TITLE} = "Failed Test Brief Log By Build";
$self->{GIT_CHECKEDOUT_OPENDDS} = "unknown";
$self->{FAILED_TESTS} = $failed_tests;
$self->{REV_LINK} = $rev_link;

unless (-e $filename) {
Expand All @@ -393,6 +395,8 @@ sub new ($)
$self->{FH} = new FileHandle ($filename, '>>');
$self->{FILENAME} = $filename;
$self->{BUILDNAME} = $buildname;
$self->{USE_BUILDNAME} = '';
$self->{CURRENT_SUBSECTION} = '';

bless ($self, $class);
return $self;
Expand All @@ -401,7 +405,6 @@ sub new ($)
sub Header ()
{
my $self = shift;

if (defined $self->{LAST_SECTION} && $self->{LAST_SECTION} eq 'Test') {
print {$self->{FH}} "<html>\n";
print {$self->{FH}} "<body bgcolor=\"white\">\n";
Expand Down Expand Up @@ -471,30 +474,44 @@ sub Subsection ($)
sub Print_Sections ()
{
my $self = shift;
my $rev = substr($self->{GIT_CHECKEDOUT_OPENDDS}, 0, 8);
my $rev_line;
if ($rev ne "unknown") {
$rev_line = "Rev: ";
if (length($self->{REV_LINK})) {
$rev_line .= "<a href=$self->{REV_LINK}";
$rev_line =~ s/\/$//g;
$rev_line .= "/$rev>";
}
$rev_line .= $rev;
if (length($self->{REV_LINK})) {
$rev_line .= "</a>";
}
}

if (defined $self->{LAST_SECTION} && defined $self->{LAST_SUBSECTION} && $self->{LAST_SECTION} eq 'Test') {
if (defined $self->{BUILDNAME}) {
if (defined $self->{USE_BUILDNAME}) {
print {$self->{FH}} "<hr><h2>$self->{BUILDNAME}</h2>\n";
my $rev = substr($self->{GIT_CHECKEDOUT_OPENDDS}, 0, 8);
if ($rev ne "unknown") {
my $rev_line = "Rev: ";
if (length($self->{REV_LINK})) {
$rev_line .= "<a href=$self->{REV_LINK}";
$rev_line =~ s/\/$//g;
$rev_line .= "/$rev>";
}
$rev_line .= $rev;
if (length($self->{REV_LINK})) {
$rev_line .= "</a>";
}
print {$self->{FH}} "$rev_line<hr>\n";
}
$self->{BUILDNAME} = undef;
print {$self->{FH}} "$rev_line\n";
}
$self->{USE_BUILDNAME} = undef;
}

if (defined $self->{FAILED_TESTS}->{$self->{LAST_SUBSECTION}}) {
$self->{FAILED_TESTS}->{$self->{LAST_SUBSECTION}} = $self->{FAILED_TESTS}->{$self->{LAST_SUBSECTION}} . "<h3>$self->{BUILDNAME}</h3>\n$rev_line<br><br>\n";
}
else {
$self->{FAILED_TESTS}->{$self->{LAST_SUBSECTION}} = "<h3>$self->{BUILDNAME}</h3>\n$rev_line<br><br>\n";
}

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

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

Comment thread
kuznetsovmoci marked this conversation as resolved.
$self->{LAST_SUBSECTION} = undef;

}
}

Expand All @@ -504,7 +521,6 @@ sub Error ($)
my $s = shift;

if (defined $self->{LAST_SECTION} && $self->{LAST_SECTION} eq 'Test') {

# Escape any '<' or '>' signs
$s =~ s/</&lt;/g;
$s =~ s/>/&gt;/g;
Expand All @@ -513,10 +529,17 @@ sub Error ($)

$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";
my $Err1 = "<a name=\"error_$counter\"></a>\n";
my $Err2 = "<tt>[<a href=\"$self->{FULLHTML}#error_$counter" . "\">Details</a>] </tt>";
my $Err3 = "<font color=\"FF0000\"><tt>$s</tt></font><br>\n";

print {$self->{FH}} $Err1;
print {$self->{FH}} $Err2;
print {$self->{FH}} $Err3;

$self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} = $self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} . $Err1;
$self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} = $self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} . $Err2;
$self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} = $self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} . $Err3;
}
}

Expand All @@ -534,10 +557,17 @@ sub Warning ($)

$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";
my $Warning1 = "<a name=\"warning_$counter\"></a>\n";
my $Warning2 = "<tt>[<a href=\"$self->{FULLHTML}#warning_$counter" . "\">Details</a>] </tt>";
Comment thread
kuznetsovmoci marked this conversation as resolved.
Outdated
my $Warning3 = "<font color=\"FF7700\"><tt>$s</tt></font><br>\n";

print {$self->{FH}} $Warning1;
print {$self->{FH}} $Warning2;
print {$self->{FH}} $Warning3;

$self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} = $self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} . $Warning1;
$self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} = $self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} . $Warning2;
$self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} = $self->{FAILED_TESTS}->{$self->{CURRENT_SUBSECTION}} . $Warning3;
}
}

Expand Down Expand Up @@ -1060,13 +1090,14 @@ use FileHandle;

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

sub new ($$$$$$)
sub new ($$$$$$$)
{
my $proto = shift;
my $class = ref ($proto) || $proto;
my $self = {};
my $basename = shift;
my $buildname = shift;
my $failed_tests_ref = shift;
my $skip_failed_test_logs = shift;
my $rev_link = shift;
my $log_prefix = shift;
Expand All @@ -1076,6 +1107,7 @@ sub new ($$$$$$)
$self->{STATE} = '';
$self->{LAST_SECTION} = '';
$self->{LAST_DESCRIPTION} = '';
$self->{FAILED_TESTS} = $failed_tests_ref;

# Initialize the hash table of handlers for each section

Expand All @@ -1099,9 +1131,9 @@ sub new ($$$$$$)
new Prettify::Totals_HTML ($basename), #Must be 2
new Prettify::Config_HTML ($basename), #Must be 3
);

if (!$skip_failed_test_logs) {
push @{$self->{OUTPUT}}, new Prettify::Failed_Tests_HTML ($basename, $buildname, $rev_link, $log_prefix); #Must be 4, if used
push @{$self->{OUTPUT}}, new Prettify::Failed_Tests_HTML ($basename, $buildname, $self->{FAILED_TESTS}, $rev_link, $log_prefix); #Must be 4, if used
Copy link
Copy Markdown

@ClaytonCalabrese ClaytonCalabrese Feb 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this comment be changed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or removed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is logic that relies on this being #4 - similar to other reports above

Copy link
Copy Markdown

@ClaytonCalabrese ClaytonCalabrese Feb 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make the comment more clear. I assumed it meant that it needed 4 variables passed to be used.

Copy link
Copy Markdown
Contributor Author

@kuznetsovmoci kuznetsovmoci Feb 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it more clear, and there is also a context right above, which makes it even more understandable:

    @{$self->{OUTPUT}} =
        (
            new Prettify::Full_HTML ($basename),   #Must be at 0
            new Prettify::Brief_HTML ($basename),
            new Prettify::Totals_HTML ($basename), #Must be at 2
            new Prettify::Config_HTML ($basename), #Must be at 3
        );

}

my $junit = main::GetVariable ('junit_xml_output');
Expand Down Expand Up @@ -1452,7 +1484,6 @@ sub Setup_Handler ($)
{
(@{$self->{OUTPUT}})[4]->{GIT_CHECKEDOUT_OPENDDS} = $sha;
}

}
$self->Output_Normal ($s);
}
Expand Down Expand Up @@ -1720,17 +1751,18 @@ 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 $failed_tests_ref = shift // {};
my $skip_failed_test_logs = shift // 1;
my $rev_link = shift // "";
my $log_prefix = shift // "";

my $processor = new Prettify ($basename, $buildname, $skip_failed_test_logs, $rev_link, $log_prefix);
my $processor = new Prettify ($basename, $buildname, $failed_tests_ref, $skip_failed_test_logs, $rev_link, $log_prefix);

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

Expand Down
57 changes: 49 additions & 8 deletions scoreboard.pl
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,14 @@ ($$)
print $indexhtml "\n<hr>\n";

### Failed Test Reports
print $indexhtml "<br><a href=\"" . $log_prefix . "_Failed_Tests_By_Build.html\">Failed Test Brief Log By Build</a><br>\n";


if (!$use_build_logs) {
print $indexhtml "<br><a href=\"" . $log_prefix . "_Failed_Tests_By_Build.html\">Failed Test Brief Log By Build</a><br>\n";
print $indexhtml "<br><a href=\"" . $log_prefix . "_Failed_Tests_By_Test.html\">Failed Test Brief Log By Test</a><br>\n";
}

### Print timestamp

print $indexhtml '<br>Last updated at ' . get_time_str() . "<br>\n";

### Print the Footer
Expand Down Expand Up @@ -504,6 +509,9 @@ ($)
sub update_cache ($)
{
my $directory = shift;
my %failed_tests_by_test;
my $failed_tests_by_test_ref = \%failed_tests_by_test;

Comment thread
kuznetsovmoci marked this conversation as resolved.

print "Updating Local Cache\n" if ($verbose);

Expand Down Expand Up @@ -543,11 +551,21 @@ ($)
}

print " Prettifying\n" if($verbose);

Prettify::Process ("$directory/$buildname/$filename", $buildname, $use_build_logs, $builds{$buildname}->{DIFFROOT}, "$directory/$log_prefix");
Comment thread
kuznetsovmoci marked this conversation as resolved.
Outdated
Prettify::Process ("$directory/$buildname/$filename", $buildname, $failed_tests_by_test_ref, $use_build_logs, $builds{$buildname}->{DIFFROOT}, "$directory/$log_prefix");
}
}
}

my $failed_tests_by_test_file_name = $directory . "/" . $log_prefix . "_Failed_Tests_By_Test.html";
my $failed_tests_by_test_file = new FileHandle ($failed_tests_by_test_file_name, 'w');
my $title = "Failed Test Brief Log By Test";
print {$failed_tests_by_test_file} "<h1>$title</h1>\n";

while (my ($k, $v) = each %failed_tests_by_test) {
print {$failed_tests_by_test_file} "<hr><h2>$k</h2><hr>\n";
print {$failed_tests_by_test_file} "$v<br>\n";
}
}

###############################################################################
Expand All @@ -564,6 +582,8 @@ ($)
sub local_update_cache ($)
{
my $directory = shift;
my %failed_tests_by_test;
my $failed_tests_by_test_ref = \%failed_tests_by_test;

print "Updating Local Cache\n" if ($verbose);

Expand All @@ -572,7 +592,12 @@ ($)
return;
}

my $failed_tests = $directory . "/" . $log_prefix . "_Failed_Tests_By_Build.html";
my $failed_tests = $directory . "/" . $log_prefix . "_Failed_Tests_By_Build.html";
Comment thread
kuznetsovmoci marked this conversation as resolved.
Outdated
if (-e $failed_tests) {
unlink $failed_tests;
}

$failed_tests = $directory . "/" . $log_prefix . "_Failed_Tests_By_Test.html";
Comment thread
kuznetsovmoci marked this conversation as resolved.
Outdated
if (-e $failed_tests) {
unlink $failed_tests;
}
Expand Down Expand Up @@ -662,8 +687,8 @@ ($)
foreach my $file (@existing) {
if ( -e $file . "_Totals.html" || $post == 1 ) {
print " Prettifying $file.txt\n" if($verbose);

Prettify::Process ("$file.txt", $buildname, $use_build_logs, $builds{$buildname}->{DIFFROOT}, "$directory/$log_prefix");
Comment thread
kuznetsovmoci marked this conversation as resolved.
Outdated
Prettify::Process ("$file.txt", $buildname, $failed_tests_by_test_ref, $use_build_logs, $builds{$buildname}->{DIFFROOT}, "$directory/$log_prefix");
$updated++;
} else {
# Create the triggerfile for the next time we run
Expand Down Expand Up @@ -764,6 +789,16 @@ ($)
$builds{$buildname}{CVS_TIMESTAMP} = $1; ## PRISMTECH still use some cvs, please leave
}
}

my $failed_tests_by_test_file_name = $directory . "/" . $log_prefix . "_Failed_Tests_By_Test.html";
my $failed_tests_by_test_file = new FileHandle ($failed_tests_by_test_file_name, 'w');
my $title = "Failed Test Brief Log By Test";
print {$failed_tests_by_test_file} "<h1>$title</h1>\n";

while (my ($k, $v) = each %failed_tests_by_test) {
print {$failed_tests_by_test_file} "<hr><h2>$k</h2>\n";
print {$failed_tests_by_test_file} "$v<br>\n";
}
}


Expand All @@ -789,7 +824,12 @@ ($)
return;
}

my $failed_tests = $directory . "/" . $log_prefix . "_Failed_Tests_By_Build.html";
my $failed_tests = $directory . "/" . $log_prefix . "_Failed_Tests_By_Build.html";
Comment thread
kuznetsovmoci marked this conversation as resolved.
Outdated
if (-e $failed_tests) {
unlink $failed_tests;
}

$failed_tests = $directory . "/" . $log_prefix . "_Failed_Tests_By_Test.html";
if (-e $failed_tests) {
unlink $failed_tests;
}
Expand Down Expand Up @@ -1155,6 +1195,7 @@ ($$$)

if (!$use_build_logs) {
print $indexhtml "<br><a href=\"" . $log_prefix . "_Failed_Tests_By_Build.html\">Failed Test Brief Log By Build</a><br>\n";
print $indexhtml "<br><a href=\"" . $log_prefix . "_Failed_Tests_By_Test.html\">Failed Test Brief Log By Test</a><br>\n";
}
print $indexhtml '<br>Last updated at ' . get_time_str() . "<br>\n";

Expand Down