From 5494e1fa1054462a2ff6d5d9f21ef98d3684e4b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 7 Dec 2003 17:43:30 +0000 Subject: [PATCH] Log all results to a history file in the log directory. --- tools/tools/tinderbox/tbmaster.pl | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tools/tools/tinderbox/tbmaster.pl b/tools/tools/tinderbox/tbmaster.pl index a7026391df8..ac685066b54 100644 --- a/tools/tools/tinderbox/tbmaster.pl +++ b/tools/tools/tinderbox/tbmaster.pl @@ -120,6 +120,37 @@ sub readconf($) { return 1; } +### +### 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 ### @@ -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'); -- 2.45.2