mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 20:22:24 +00:00
Move test build scripts.
This commit is contained in:
parent
b2e446d352
commit
78540bcaba
4 changed files with 0 additions and 17 deletions
84
src/tools/make/buildall.pl
Executable file
84
src/tools/make/buildall.pl
Executable file
|
|
@ -0,0 +1,84 @@
|
|||
#!perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX "strftime";
|
||||
|
||||
my $branch = "v2docs";
|
||||
|
||||
my %machines = (
|
||||
"pi" => ['pi@pie', "sudo", "projects/oberon/vishap/voc"],
|
||||
"darwin" => ['dave@dcb', "sudo", "projects/oberon/vishap/voc"],
|
||||
"lub32" => ['dave@lub32', "sudo", "vishap/voc"],
|
||||
"ob32" => ['root@nas-ob32', "", "vishap/voc"],
|
||||
"fb64" => ['root@oberon', "", "vishap/voc"],
|
||||
"ub64" => ['dave@nas-ub64', "sudo", "vishap/voc"],
|
||||
"ce64" => ['-p5922 obe@www', "sudo", "vishap/voc"]
|
||||
);
|
||||
|
||||
|
||||
sub logged {
|
||||
my ($cmd, $id) = @_;
|
||||
my $child = fork;
|
||||
if (not defined $child) {die "Fork failed.";}
|
||||
if ($child) {
|
||||
# parent process
|
||||
print "Started $id, pid = $child\n";
|
||||
} else {
|
||||
# child process
|
||||
open(my $log, ">log/$id.log") // die "Could not create log file log/$id.log";
|
||||
print $log strftime("%Y/%m/%d %H.%M.%S ", localtime), "$id.log\n";
|
||||
print $log strftime("%H.%M.%S", localtime), "> $cmd\n";
|
||||
print $id, " ", strftime("%H.%M.%S", localtime), "> $cmd\n";
|
||||
open(my $pipe, "$cmd 2>&1 |") // die "Could not open pipe from command $cmd.";
|
||||
while (<$pipe>) {
|
||||
my $line = $_;
|
||||
print $id, " ", strftime("%H.%M.%S", localtime), " ", $line;
|
||||
print $log strftime("%H.%M.%S", localtime), " ", $line;
|
||||
}
|
||||
close($pipe);
|
||||
close($log);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for my $machine (sort keys %machines) {
|
||||
my ($login, $sudo, $dir) = @{$machines{$machine}};
|
||||
my $cmd = "ssh $login \"cd $dir && $sudo git checkout $branch && $sudo git pull && $sudo make full\" ";
|
||||
logged($cmd, $machine);
|
||||
}
|
||||
|
||||
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.
|
||||
#
|
||||
# my %status = ();
|
||||
# open(my $logs, "/tmp/buildall.log") // die "Couldn't open combined build log.";
|
||||
# while (<$logs>) {
|
||||
# if (/^([^ ]+) ([^ ]+) --- Branch ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) confidence tests passed ---/) {
|
||||
# $status{$1} = [$2, $3, $4, $5, $6];
|
||||
# }
|
||||
# }
|
||||
# close(my $logs);
|
||||
#
|
||||
#
|
||||
# sub svgtext {
|
||||
# my ($f, $x, $y, $msg) = @_;
|
||||
# print($f "<text x=\"$x\" y=\"$y\" font-family=\"Verdana\" font-size=\"18\" font-fill=\"black\">";
|
||||
# print($f $msg);
|
||||
# print($f "</text>\n");
|
||||
# }
|
||||
#
|
||||
#
|
||||
# open(my $svg, ">passing.svg") // dir "Could not create passing.svg.");
|
||||
# print $svg '<svg width="10cm" height="3cm" viewBox="0 0 1000 300" xmlns="http://www.w3.org/2000/svg" version="1.1">\n';
|
||||
#
|
||||
# my $i=1;
|
||||
# for my $host (sort keys %status) {
|
||||
# svgtext($svg, 10, $i*20, $host);
|
||||
# $i++;
|
||||
# }
|
||||
#
|
||||
# print $svg '</svg>\n';
|
||||
50
src/tools/make/postpush.pl
Executable file
50
src/tools/make/postpush.pl
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX "strftime";
|
||||
|
||||
|
||||
use CGI qw(:standard escapeHTML);
|
||||
use JSON;
|
||||
|
||||
sub writelog {
|
||||
my ($msg) = @_;
|
||||
|
||||
open(LOG, ">>/tmp/postpush.log") or die "Could not create postpush.log";
|
||||
flock(LOG, 2) or die "Could not lock postpush.log";
|
||||
print LOG sprintf("%s %s\n", strftime("%Y/%m/%d %H.%M.%S", localtime), $msg);
|
||||
close(LOG);
|
||||
}
|
||||
|
||||
my $postdata = from_json(param('POSTDATA'));
|
||||
|
||||
my $url = $postdata->{'repository'}->{'url'};
|
||||
my $ref = $postdata->{'ref'};
|
||||
my $name = $postdata->{'head_commit'}->{'author'}->{'name'};
|
||||
|
||||
my $branch = $ref; $branch =~ s'^.*\/'';
|
||||
my $repo = $url; $repo =~ s'^.*\/'';
|
||||
|
||||
#my $repo="repo"; my $branch="branch"; my $name="name";
|
||||
|
||||
writelog "Post push github web hook for repository $repo, branch $branch, name $name.";
|
||||
|
||||
|
||||
my $child = fork;
|
||||
if (not defined $child) {die "Fork failed.";}
|
||||
if ($child) {
|
||||
# parent process
|
||||
writelog "Started buildall, pid = $child.";
|
||||
} else {
|
||||
# child process
|
||||
close(STDIN); close(STDOUT); close(STDERR);
|
||||
exec 'perl /var/lib/nethserver/ibay/githubhook/buildall.pl >/tmp/buildall.log';
|
||||
exit;
|
||||
}
|
||||
|
||||
print header(),
|
||||
start_html("Vishap Oberon github post push web hook."),
|
||||
p("Repository $repo, branch $branch, name $name."),
|
||||
end_html();
|
||||
105
src/tools/make/pt.pl
Executable file
105
src/tools/make/pt.pl
Executable file
|
|
@ -0,0 +1,105 @@
|
|||
#!perl -w
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX "strftime";
|
||||
|
||||
|
||||
|
||||
|
||||
my %status = ();
|
||||
|
||||
|
||||
sub parselog {
|
||||
my ($fn) = @_;
|
||||
my $date = "";
|
||||
my $time = "";
|
||||
my $branch = "";
|
||||
my $os = "";
|
||||
my $compiler = "";
|
||||
my $datamodel = "";
|
||||
my $compilerok = "";
|
||||
my $libraryok = "";
|
||||
my $checksum = "";
|
||||
my $tests = "";
|
||||
open(my $log, $fn) // die "Couldn't open build log $fn.";
|
||||
while (<$log>) {
|
||||
if (/^([0-9/]+) [0-9.]+ [^ ]+\.log$/) {$date = $1;}
|
||||
if (/^[^ ]+ --- Cleaning branch ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ---$/) {
|
||||
($branch, $os, $compiler, $datamodel) = ($1, $2, $3, $4, $5);
|
||||
}
|
||||
if (/^--- Compiler build successfull ---$/) {$compilerok = "Built";}
|
||||
if (/^--- Library build successfull ---$/) {$libraryok = "Built";}
|
||||
if (/^--- Confidence tests passed ---$/) {$tests = "Passed";}
|
||||
if (/^--- Object file checksums match ---$/) {$checksum = "Match";}
|
||||
if (/^--- Object file checksum mismatch ---$/) {$checksum = "Changed";}
|
||||
if (/^--- 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 openlog directory.";
|
||||
my @logs = readdir DIR;
|
||||
closedir DIR;
|
||||
|
||||
for my $logname (sort @logs) {
|
||||
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';
|
||||
Loading…
Add table
Add a link
Reference in a new issue