diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/tinderbox/tbmaster.pl | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/tools/tinderbox/tbmaster.pl b/tools/tools/tinderbox/tbmaster.pl index a702639..ac68506 100644 --- a/tools/tools/tinderbox/tbmaster.pl +++ b/tools/tools/tinderbox/tbmaster.pl @@ -121,6 +121,37 @@ sub readconf($) { } ### +### Record a tinderbox result in the history file +### +sub history($$$) { + my $start = shift; + my $end = shift; + my $success = shift; + + my $history = strftime("%Y-%m-%d %H:%M:%S\t", localtime($start)); + $history .= strftime("%Y-%m-%d %H:%M:%S\t", localtime($end)); + $history .= expand('ARCH') . "\t"; + $history .= expand('MACHINE') . "\t"; + my $date = expand('DATE'); + if ($date) { + $date =~ s/\s+/\t/g; + $history .= expand('BRANCH') . ":" . expand('DATE') . "\t"; + } else { + $history .= expand('BRANCH') . "\t"; + } + $history .= $success ? "OK\n" : "FAIL\n"; + + my $fn = expand('LOGDIR') . "/history"; + local *HISTORY; + if (sysopen(HISTORY, $fn, O_WRONLY|O_APPEND|O_CREAT, 0644)) { + syswrite(HISTORY, $history, length($history)); + close(HISTORY); + } else { + print(STDERR "failed to record result to history file:\n$history\n"); + } +} + +### ### Report a tinderbox failure ### sub report($$$$) { @@ -153,6 +184,8 @@ sub tinderbox($$$) { my $arch = shift; my $machine = shift; + my $start = time(); + $CONFIG{'BRANCH'} = $branch; $CONFIG{'ARCH'} = $arch; $CONFIG{'MACHINE'} = $machine; @@ -268,6 +301,11 @@ sub tinderbox($$$) { close(BRIEF); close(FULL); + my $end = time(); + + # Record result in history file + history($start, $end, !$error); + # Mail out error reports if ($error && $CONFIG{'RECIPIENT'}) { my $sender = expand('SENDER'); |