Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
61 changes: 36 additions & 25 deletions common/prettify.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use warnings;

use FileHandle;
use Cwd;
our $path = "";
Comment thread
mitza-oci marked this conversation as resolved.

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

Expand All @@ -20,6 +21,8 @@ sub new ($)
my $self = {};
my $basename = shift;
my $filename = $basename . "_Full.html";
my $log_root = main::GetVariable('log_root');
$path = ((defined $log_root) ? ($log_root . '/' . $filename) : $filename);
$self->{ERROR_COUNTER} = 0;
$self->{WARNING_COUNTER} = 0;
$self->{SECTION_COUNTER} = 0;
Expand Down Expand Up @@ -620,7 +623,6 @@ sub Footer ()
{
my $self = shift;
my $out = $self->{FH};

my $indent = ' ';
print $out $indent, "<testsuite name=\"Autobuild_Tests\" ";
if (defined $self->{TIMESTAMP} and length $self->{TIMESTAMP})
Expand All @@ -629,32 +631,30 @@ sub Footer ()
}

my $numtests = @{$self->{TESTS}};

if ($numtests == 0)
{
# Need to insert a dummy testcase to jenkins doesn't think there is
# a failure.
print $out 'tests="1">', "\n", $indent x 2,
'<testcase name="dummy_test"/>', "\n";
if ($numtests > 0) {
print $out "tests=\"$numtests\" failures=\"$self->{FAILED}\" hostname=\"$Prettify::Config_HTML::host\">\n";
}
else
{
print $out "tests=\"$numtests\" failures=\"$self->{FAILED}\">\n";
else { # Insert a dummy testcase so jenkins doesn't think there is a failure.
print $out 'tests="1">', "\n", $indent x 2, '<testcase name="dummy_test"/>', "\n";
}

foreach my $test (@{$self->{TESTS}})
{
my $error = $test->{ERROR} || '';
print $out $indent x 2, "<properties>\n";
foreach my $k (keys %Prettify::commits) {
print $out $indent x 3, "<property name=\"$k\" value=\"$Prettify::commits{$k}\"/>\n";
}
print $out $indent x 3, "<property name=\"log_file\" value=\"$Prettify::Full_HTML::path\"/>\n";
print $out $indent x 2, "</properties>\n";

foreach my $test (@{$self->{TESTS}}) {
my $error = $test->{ERROR} || '';
print $out $indent x 2,
"<testcase name=\"$test->{NAME}\" status=\"$test->{RESULT}\" ",
"time=\"$test->{TIME}\"", ($error eq "" ? "/>\n" : '>');
"<testcase name=\"$test->{NAME}\" status=\"$test->{RESULT}\" ",
"time=\"$test->{TIME}\"", ($error eq "" ? "/>\n" : '>');

if ($error ne "")
{
print $out "<failure>\n", $indent x 3,
"<![CDATA[$error]]></failure><system-out>\n", $indent x 3,
"<![CDATA[$test->{OUT}]]></system-out></testcase>\n";
if ($error ne "") {
print $out "<failure>\n",
$indent x 3, "<![CDATA[$error]]></failure><system-out>\n",
$indent x 3, "<![CDATA[$test->{OUT}]]></system-out></testcase>\n";
}
}

Expand Down Expand Up @@ -1117,6 +1117,7 @@ use base qw(common::parse_compiler_output);
use Data::Dumper;
use File::Basename;
use FileHandle;
our %commits = ();

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

Expand Down Expand Up @@ -1385,7 +1386,6 @@ sub Normal_Handler ($)

sub Setup_Handler ($)
{

my $self = shift;
my $s = shift;
if (!defined $s)
Expand Down Expand Up @@ -1655,13 +1655,15 @@ sub Config_Handler ($)
my $revision = $totals->{GIT_REVISIONS}[0];
print "Matched GIT url to revision $revision\n";
$totals->{GIT_CHECKEDOUT_ACE} = $revision;
$commits{'GIT_COMMIT_ACE'} = $revision;
}
elsif ($url =~ m/(git|https):\/\/.*\/OpenDDS\.git/i)
elsif ($url =~ m/(git@|(git|https):\/\/).*\/OpenDDS\.git/i)
{
print "Matched GIT url $url\n";
my $revision = $totals->{GIT_REVISIONS}[0];
print "Matched GIT url to revision $revision\n";
$totals->{GIT_CHECKEDOUT_OPENDDS} = $revision;
$commits{'GIT_COMMIT_OPENDDS'} = $revision;
if (exists ($self->{OUTPUT}[$self->{FAILED_TESTS_ONLY} ? 0 : 4]))
{
(@{$self->{OUTPUT}})[$self->{FAILED_TESTS_ONLY} ? 0 : 4]->{GIT_CHECKEDOUT_OPENDDS} = $revision;
Expand Down Expand Up @@ -1929,6 +1931,8 @@ use strict;
use warnings;

use FileHandle;
our $host = 'localhost';
my $host_next = 0;

sub new ($)
{
Expand Down Expand Up @@ -1976,10 +1980,17 @@ sub Normal ($)
my $s = shift;
my $state = shift;
if (defined $state) {
$state = lc($state);
$state = lc($state);
}

if (defined $state && $state eq 'config') {
if ($host eq 'localhost') {
if ($host_next == 1) {
$host = $s;
}
elsif ($s eq "<h3>Hostname</h3>") {
$host_next = 1;
}
}
$s =~ s/</&lt;/g;
$s =~ s/>/&gt;/g;
$s =~ s/&lt;\s*(\/?\s*h\d|\/a|a\s*href\s*=\s*\s*"[^"]*")\s*&gt;/<$1>/g;
Expand Down
21 changes: 16 additions & 5 deletions scoreboard.pl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
our $use_local = 0;

our $use_build_logs = 0;
our $junit_xml_output = 0;

our $custom_css = "";

Expand Down Expand Up @@ -1590,8 +1591,13 @@ ($$@)
## for now, implement it as a no-op which returns something which is undefined.
sub GetVariable ($)
{
my %a=();
return $a{'UNDEFINED'};
my $v = shift;
if ($v eq 'junit_xml_output') {
return $junit_xml_output;
} else {
my %a=();
return $a{'UNDEFINED'};
}
}

###############################################################################
Expand Down Expand Up @@ -1748,14 +1754,14 @@ sub get_time_str
# be saved by this name and placed in the
# directory pointed by -d].

use vars qw/$opt_b $opt_c $opt_d $opt_f $opt_h $opt_i $opt_o $opt_v $opt_t $opt_z $opt_l $opt_r $opt_s $opt_k $opt_x $opt_j $opt_y $opt_n/;
use vars qw/$opt_b $opt_c $opt_d $opt_f $opt_h $opt_i $opt_o $opt_v $opt_t $opt_z $opt_l $opt_r $opt_s $opt_k $opt_x $opt_j $opt_y $opt_n $opt_u/;

if (!getopts ('bcd:f:hi:o:t:vzlr:s:k:xj:y:n')
if (!getopts ('bcd:f:hi:o:t:vzlr:s:k:xj:y:n:u')
|| !defined $opt_d
|| defined $opt_h) {
print "scoreboard.pl [-h] -d dir [-v] [-f file] [-i file] [-o file]\n",
" [-t title] [-z] [-l] [-r file] [-s file] [-c] [-x]\n",
" [-k num_logs] [-b] [-j filelist] [-y file] [-n]\n";
" [-k num_logs] [-b] [-j filelist] [-y file] [-n] [-u]\n";
print "\n";
print " -h display this help\n";
print " -d directory where the output files are placed \n";
Expand All @@ -1775,6 +1781,7 @@ sub get_time_str
print " -j comma separated list of input files which for an integrated page has to be generated\n";
print " -y specify name of file with custom CSS styling";
print " -n generate build links that open in new tab/window";
print " -u generate *_JUnit.xml files";
print " All other options will be ignored \n";
exit (1);
}
Expand Down Expand Up @@ -1815,6 +1822,10 @@ sub get_time_str
$use_build_logs = 1;
}

if (defined $opt_u) {
$junit_xml_output = 1;
}

if (defined $opt_y) {
open my $css_fh, '<', $opt_y or die "Can't open custom CSS file $opt_y";
read $css_fh, $custom_css, -s $css_fh;
Expand Down