diff options
author | des <des@FreeBSD.org> | 2003-12-07 17:43:30 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-12-07 17:43:30 +0000 |
commit | dc062489f5085bfb7ebe145ee208d2857bd5197e (patch) | |
tree | 336e8fa6d6e7af554ea6d5f91a7d0d8b04fa8a89 | |
parent | ef7fbaac4f9ae990852d6dbbd8dffeec674c4102 (diff) | |
download | FreeBSD-src-dc062489f5085bfb7ebe145ee208d2857bd5197e.zip FreeBSD-src-dc062489f5085bfb7ebe145ee208d2857bd5197e.tar.gz |
Log all results to a history file in the log directory.
-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'); |