Log scanner beginning to work.

This commit is contained in:
David Brown 2016-07-01 19:40:19 +01:00
parent 4981afd55a
commit 43d120814c
3 changed files with 117 additions and 43 deletions

View file

@ -1,3 +1,5 @@
![Build status](http://brownsmeet.com/build-status.svg)
### Ѵishap Oberon ### Ѵishap Oberon
[Ѵishap Oberon](http://oberon.vishap.am) is a free and open source (GPLv3) [Ѵishap Oberon](http://oberon.vishap.am) is a free and open source (GPLv3)
@ -26,10 +28,6 @@ languages, following the principals of Einstein and Antoine de Saint-Exupéry:
> when there is no longer anything to take away. (Antoine de Saint-Exupéry, > when there is no longer anything to take away. (Antoine de Saint-Exupéry,
> translated by Lewis Galantière.) > translated by Lewis Galantière.)
##### Build status
![Build status](http://brownsmeet.com/build-status.svg)
#### Installation #### Installation
##### Prerequisites ##### Prerequisites

View file

@ -56,32 +56,105 @@ while ((my $pid = wait) > 0) {print "Child pid $pid completed.\n";}
# # All builds have completed. Now scan the logs for pass/fail and build the passing report. # # All builds have completed. Now scan the logs for pass/fail and build the passing report.
#
# my %status = ();
# open(my $logs, "/tmp/buildall.log") // die "Couldn't open combined build log."; my %status = ();
# while (<$logs>) {
# if (/^([^ ]+) ([^ ]+) --- Branch ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) confidence tests passed ---/) {
# $status{$1} = [$2, $3, $4, $5, $6]; sub parselog {
# } my ($fn) = @_;
# } #print "Parsing log $fn\n";
# close(my $logs); my $date = "";
# my $time = "";
# my $branch = "";
# sub svgtext { my $os = "";
# my ($f, $x, $y, $msg) = @_; my $compiler = "";
# print($f "<text x=\"$x\" y=\"$y\" font-family=\"Verdana\" font-size=\"18\" font-fill=\"black\">"; my $datamodel = "";
# print($f $msg); my $compilerok = "";
# print($f "</text>\n"); my $libraryok = "";
# } my $checksum = "";
# my $tests = "";
# open(my $log, $fn) // die "Couldn't open build log $fn.";
# open(my $svg, ">passing.svg") // dir "Could not create passing.svg."); while (<$log>) {
# print $svg '<svg width="10cm" height="3cm" viewBox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg" version="1.1">\n'; if (/^([0-9\/]+) [0-9.]+ [^ ]+\.log$/) {$date = $1;}
# if (/^[^ ]+ --- Cleaning branch ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ---$/) {
# my $i=1; ($branch, $os, $compiler, $datamodel) = ($1, $2, $3, $4, $5);
# for my $host (sort keys %status) { }
# svgtext($svg, 10, $i*20, $host); if (/^([0-9.]+) --- Compiler build successfull ---$/) {$compilerok = "Built";}
# $i++; if (/^([0-9.]+) --- Library build successfull ---$/) {$libraryok = "Built";}
# } if (/^([0-9.]+) --- Confidence tests passed ---$/) {$tests = "Passed";}
# if (/^([0-9.]+) --- Object file checksums match ---$/) {$checksum = "Match";}
# print $svg '</svg>\n'; if (/^([0-9.]+) --- Object file checksum mismatch ---$/) {$checksum = "Changed";}
if (/^([0-9.]+) --- Object files checksummed ---$/) {$checksum = "New";}
}
close($log);
my $key = "$os-$compiler-$datamodel";
if ($key ne "") {
$status{$key} = [$date, $time, $os, $compiler, $datamodel, $branch, $compilerok, $libraryok, $checksum, $tests];
}
}
opendir DIR, "log" // die "Could not open log directory.";
my @logs = readdir DIR;
closedir DIR;
for my $logname (sort @logs) {
$logname = "log/" . $logname;
#print "Consider $logname\n";
if (-f $logname) {parselog($logname);}
}
my $emsperline = 1.2;
sub svgtext {
my ($f, $x, $y, $colour, $msg) = @_;
print $f '<text x="', $x;
print $f '" y="', ($y+1)*$emsperline + 0.3;
print $f 'em" font-family="Verdana" font-size="1em" fill="';
print $f $colour;
print $f '">';
print $f $msg;
print $f "</text>\n";
}
my $rows = keys %status;
open(my $svg, ">build-status.svg") // die "Could not create build-status.svg.";
print $svg '<svg width="680" height="';
print $svg ($rows+2) * $emsperline;
print $svg 'em" xmlns="http://www.w3.org/2000/svg" version="1.1">', "\n";
print $svg '<rect width="100%" height="100%" rx="20" ry="20" fill="#404040"/>', "\n";
my $col1 = 20;
my $col2 = 110;
my $col3 = 200;
my $col4 = 310;
my $col5 = 400;
my $col6 = 490;
my $col7 = 580;
svgtext($svg, $col1, 0, "#e0e0e0", "OS");
svgtext($svg, $col2, 0, "#e0e0e0", "Compiler");
svgtext($svg, $col3, 0, "#e0e0e0", "Data model");
svgtext($svg, $col4, 0, "#e0e0e0", "Compiler");
svgtext($svg, $col5, 0, "#e0e0e0", "Library");
svgtext($svg, $col6, 0, "#e0e0e0", "Checksum");
svgtext($svg, $col7, 0, "#e0e0e0", "Tests");
my $i=1;
for my $key (sort keys %status) {
my ($date, $time, $os, $compiler, $datamodel,
$branch, $compilerok, $libraryok, $checksum, $tests) = @{$status{$key}};
svgtext($svg, $col1, $i, "#c0c0c0", $os);
svgtext($svg, $col2, $i, "#c0c0c0", $compiler);
svgtext($svg, $col3, $i, "#c0c0c0", $datamodel);
svgtext($svg, $col4, $i, "#60ff60", $compilerok);
svgtext($svg, $col5, $i, "#60ff60", $libraryok);
svgtext($svg, $col6, $i, "#60ff60", $checksum);
svgtext($svg, $col7, $i, "#60ff60", $tests);
$i++;
}
print $svg "</svg>\n";
system 'scp -p build-status.svg dave@hub:/var/www';

View file

@ -11,6 +11,7 @@ my %status = ();
sub parselog { sub parselog {
my ($fn) = @_; my ($fn) = @_;
#print "Parsing log $fn\n";
my $date = ""; my $date = "";
my $time = ""; my $time = "";
my $branch = ""; my $branch = "";
@ -23,29 +24,31 @@ sub parselog {
my $tests = ""; my $tests = "";
open(my $log, $fn) // die "Couldn't open build log $fn."; open(my $log, $fn) // die "Couldn't open build log $fn.";
while (<$log>) { while (<$log>) {
if (/^([0-9/]+) [0-9.]+ [^ ]+\.log$/) {$date = $1;} if (/^([0-9\/]+) [0-9.]+ [^ ]+\.log$/) {$date = $1;}
if (/^[^ ]+ --- Cleaning branch ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ---$/) { if (/^[^ ]+ --- Cleaning branch ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ---$/) {
($branch, $os, $compiler, $datamodel) = ($1, $2, $3, $4, $5); ($branch, $os, $compiler, $datamodel) = ($1, $2, $3, $4, $5);
} }
if (/^--- Compiler build successfull ---$/) {$compilerok = "Built";} if (/^([0-9.]+) --- Compiler build successfull ---$/) {$compilerok = "Built";}
if (/^--- Library build successfull ---$/) {$libraryok = "Built";} if (/^([0-9.]+) --- Library build successfull ---$/) {$libraryok = "Built";}
if (/^--- Confidence tests passed ---$/) {$tests = "Passed";} if (/^([0-9.]+) --- Confidence tests passed ---$/) {$tests = "Passed";}
if (/^--- Object file checksums match ---$/) {$checksum = "Match";} if (/^([0-9.]+) --- Object file checksums match ---$/) {$checksum = "Match";}
if (/^--- Object file checksum mismatch ---$/) {$checksum = "Changed";} if (/^([0-9.]+) --- Object file checksum mismatch ---$/) {$checksum = "Changed";}
if (/^--- Object files checksummed ---$/) {$checksum = "New";} if (/^([0-9.]+) --- Object files checksummed ---$/) {$checksum = "New";}
} }
close($log); close($log);
my $key = "$os-$compiler-$datamodel"; my $key = "$os-$compiler-$datamodel";
if ($key ne "") { if ($key ne "") {
status{$key} = [$date, $time, $os, %compiler, $datamodel, $branch, $compilerok, $libraryok, $checksum, $tests]; $status{$key} = [$date, $time, $os, $compiler, $datamodel, $branch, $compilerok, $libraryok, $checksum, $tests];
} }
} }
opendir DIR, "log" // die "Could not openlog directory."; opendir DIR, "log" // die "Could not open log directory.";
my @logs = readdir DIR; my @logs = readdir DIR;
closedir DIR; closedir DIR;
for my $logname (sort @logs) { for my $logname (sort @logs) {
$logname = "log/" . $logname;
#print "Consider $logname\n";
if (-f $logname) {parselog($logname);} if (-f $logname) {parselog($logname);}
} }
@ -88,7 +91,7 @@ svgtext($svg, $col7, 0, "#e0e0e0", "Tests");
my $i=1; my $i=1;
for my $key (sort keys %status) { for my $key (sort keys %status) {
my ($date, $time, $os, %compiler, $datamodel, my ($date, $time, $os, $compiler, $datamodel,
$branch, $compilerok, $libraryok, $checksum, $tests) = @{$status{$key}}; $branch, $compilerok, $libraryok, $checksum, $tests) = @{$status{$key}};
svgtext($svg, $col1, $i, "#c0c0c0", $os); svgtext($svg, $col1, $i, "#c0c0c0", $os);
svgtext($svg, $col2, $i, "#c0c0c0", $compiler); svgtext($svg, $col2, $i, "#c0c0c0", $compiler);