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
9 changes: 2 additions & 7 deletions command/process_logs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,10 @@ sub clean_logs ($)
}

# Delete anything left in the list

foreach my $file (@existing) {
unlink $file . ".txt";
unlink $file . "_JUnit.xml";
unlink $file . "_Full.html";
unlink $file . "_Brief.html";
unlink $file . "_Totals.html";
unlink $file . "_Config.html";
delete_prettify_output($file);
}

return 1;
}

Expand Down
10 changes: 10 additions & 0 deletions common/prettify.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ sub parse_art_finished
return undef;
}

sub delete_prettify_output
{
my $prefix = shift();

for my $suffix (".txt", "_JUnit.xml", "_Full.html", "_Brief.html", "_Totals.html", "_Config.html", ".build.json") {
unlink($prefix . $suffix);
}

}

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

Expand Down
87 changes: 31 additions & 56 deletions scoreboard.pl
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,26 @@ sub check_post
return 0;
}

my $timestamp_re = qr/...._.._.._.._../;

sub list_logs
{
my $list_ref = shift;
my $dir = shift;

my $dh = new DirHandle($dir);
if (defined $dh) {
while (defined($_ = $dh->read)) {
if ($_ =~ m/^(...._.._.._.._..)\.txt/) {
push @$list_ref, "$dir/$1";
}
}
undef $dh;
return 1;
} else {
print STDERR "Error: Could not read $dir\n";
if (!defined($dh)) {
print STDERR ("ERROR: Could not read $dir\n");
return 0;
}

while (defined($_ = $dh->read)) {
if ($_ =~ m/^($timestamp_re)\.txt/) {
push(@$list_ref, "$dir/$1");
}
}

return 1;
}

sub delete_old_logs
Expand All @@ -134,7 +137,7 @@ sub delete_old_logs
for (my $i = $keep; $i < $n; ++$i) {
my $fb = shift(@$logs_ref);
print " Removing $fb files\n" if ($verbose);
unlink($fb.".txt", $fb."_JUnit.xml", $fb."_Full.html", $fb."_Brief.html", $fb."_Totals.html", $fb."_Config.html");
Prettify::delete_prettify_output($fb);
}
return ($keep < $n);
}
Expand All @@ -143,20 +146,22 @@ sub get_latest
{
my $build_dir = shift;
my $file_name = "$build_dir/latest.txt";
my $latest = "";
my $timestamp = undef;
my $text = undef;
my $fh = new FileHandle($file_name, 'r');
if (defined $fh) {
print " Loading latest from $file_name\n" if ($verbose);
while (<$fh>) {
if ($_ =~ m/(...._.._.._.._..) /) {
$latest = "$build_dir/$1";
if ($_ =~ m/($timestamp_re) /) {
$timestamp = "$build_dir/$1";
$text = $_;
}
}
undef $fh;
} else {
print STDERR " Error: Could not find $file_name\n";
}
return $latest;
return $timestamp, $text;
}

sub set_latest_build_info
Expand Down Expand Up @@ -201,34 +206,6 @@ sub set_latest_build_info
}
}

sub update_latest_build_info
{
my $dir = shift;
my $buildname = shift;
my $file_name = "$dir/$buildname/latest.txt";
my $latest;
my $fh = new FileHandle($file_name, 'r');
if (defined $fh) {
print " Loading latest from $file_name\n" if ($verbose);
while (<$fh>) {
if ($_ =~ m/(...._.._.._.._..) /) {
$builds{$buildname}{BASENAME} = $1;
$latest = $_;
}
}
undef $fh;
} else {
print STDERR " Error: Could not find $file_name\n";
return 0;
}
if (!defined $latest) {
print STDERR " Error: Could not read latest build info for $buildname\n";
return 0;
}
set_latest_build_info($latest, $buildname);
return 1;
}

sub write_failed_tests_by_test
{
my $directory = shift;
Expand Down Expand Up @@ -407,7 +384,7 @@ ()

foreach my $buildname (keys %builds) {
my $latest = load_web_latest ($builds{$buildname}{URL});
if (defined $latest && $latest =~ m/(...._.._.._.._..) /) {
if (defined $latest && $latest =~ m/($timestamp_re) /) {
$builds{$buildname}{BASENAME} = $1;
set_latest_build_info($latest, $buildname);
} else {
Expand Down Expand Up @@ -734,7 +711,7 @@ ($)
print " No status for $buildname\n" if ($verbose);
}
my $latest = load_web_latest($build_url);
if (defined $latest && $latest =~ /^(...._.._.._.._..) /) {
if (defined $latest && $latest =~ /^($timestamp_re) /) {
my $basename = $1;
my $fn = "$build_dir/$basename.txt";
if (! -r $fn) {
Expand Down Expand Up @@ -770,10 +747,10 @@ ($)
my $post = check_post($build_dir);
print " post=$post, use_build_logs=$use_build_logs\n" if ($verbose);

my $latest = get_latest($build_dir);
my ($latest_timestamp, $latest_text) = get_latest($build_dir);
foreach my $file (@existing) {
my $totals_exist = (-e "${file}_Totals.html") && !(-z _);
if (($post && !$totals_exist) || ($totals_exist && !$use_build_logs && ($latest eq $file))) {
if (($post && !$totals_exist) || ($totals_exist && !$use_build_logs && ($latest_timestamp eq $file))) {
# process only the latest text file if logs already exist
print " Prettifying $file.txt\n" if($verbose);
Prettify::Process("$file.txt", $buildname, \%failed_tests_by_test, $use_build_logs, $builds{$buildname}->{DIFFROOT}, $prefix, $totals_exist);
Expand All @@ -787,7 +764,11 @@ ($)
my $diffRoot = $builds{$buildname}->{DIFFROOT};
utility::index_logs($build_dir, $buildname, $diffRoot);
}
update_latest_build_info($directory, $buildname);
if (!defined $latest_text) {
print STDERR " Error: Could not read latest build info for $buildname\n";
return 0;
}
set_latest_build_info($latest_text, $buildname);
}
write_failed_tests_by_test($directory, \%failed_tests_by_test);
}
Expand Down Expand Up @@ -836,7 +817,7 @@ ($)
}

while (defined($_ = $dh->read)) {
if ($_ =~ m/^(...._.._.._.._..)\.txt/) {
if ($_ =~ m/^($timestamp_re)\.txt/) {
push @existing, "$cache_dir/$1";
}
}
Expand All @@ -854,15 +835,9 @@ ($)
}

# Delete anything left in the list

foreach my $file (@existing) {
print " Removing $file files\n" if ($verbose);
unlink $file . ".txt";
unlink $file . ".build.json";
unlink $file . "_Full.html";
unlink $file . "_Brief.html";
unlink $file . "_Totals.html";
unlink $file . "_Config.html";
Prettify::delete_prettify_output($file);
}
}
}
Expand Down
Loading