GetLogLineCategory() identifies log lines of interest which makes it possible to decide how to display them.
Signed-off-by: Francois Gouget fgouget@codeweavers.com ---
This makes it reusable in WineSendLog.pl.
testbot/lib/WineTestBot/LogUtils.pm | 61 +++++++++++++++++++++- testbot/web/JobDetails.pl | 78 +++++++++++------------------ 2 files changed, 88 insertions(+), 51 deletions(-)
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm index 3e40fbc35..daa9c0bd8 100644 --- a/testbot/lib/WineTestBot/LogUtils.pm +++ b/testbot/lib/WineTestBot/LogUtils.pm @@ -27,7 +27,7 @@ WineTestBot::LogUtils - Provides functions to parse task logs
use Exporter 'import'; -our @EXPORT = qw(ParseTaskLog); +our @EXPORT = qw(GetLogLineCategory ParseTaskLog);
# @@ -74,4 +74,63 @@ sub ParseTaskLog($$) return "nolog:Unable to open the task log for reading: $!"; }
+ +# +# Log querying and formatting +# + +=pod +=over 12 + +=item C<GetLogLineCategory()> + +Identifies the category of the given log line: an error message, a todo, just +an informational message or none of these. The category can then be used to +decide whether to hide the line or, on the contrary, highlight it. + +=back +=cut + +sub GetLogLineCategory($) +{ + my ($Line) = @_; + + if ($Line =~ /: Test marked todo: /) + { + return "todo"; + } + if ($Line =~ /: Tests skipped: / or + $Line =~ /^\w+:\w+ skipped /) + { + return "skip"; + } + if ($Line =~ /: Test (?:failed|succeeded inside todo block): / or + $Line =~ /Fatal: test .* does not exist/ or + $Line =~ / done (258)/ or + $Line =~ /: unhandled exception [0-9a-fA-F]{8} at / or + $Line =~ /^Unhandled exception: / or + # Git errors + $Line =~ /^CONFLICT / or + $Line =~ /^error: patch failed:/ or + $Line =~ /^error: corrupt patch / or + # Build errors + $Line =~ /: error: / or + $Line =~ /^Makefile:[0-9]+: recipe for target .* failed$/ or + $Line =~ /^(?:Build|Reconfig|Task): (?!ok)/ or + # Typical perl errors + $Line =~ /^Use of uninitialized value/) + { + return "error"; + } + if ($Line =~ /^+ \S/ or + $Line =~ /^\w+:\w+ start / or + # Build messages + $Line =~ /^(?:Build|Reconfig|Task): ok/) + { + return "info"; + } + + return "none"; +} + 1; diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl index f05c0f62e..07924f4e6 100644 --- a/testbot/web/JobDetails.pl +++ b/testbot/web/JobDetails.pl @@ -28,6 +28,7 @@ use URI::Escape;
use WineTestBot::Config; use WineTestBot::Jobs; +use WineTestBot::LogUtils; use WineTestBot::StepsTasks; use WineTestBot::Engine::Notify;
@@ -228,59 +229,36 @@ sub GeneratePage($) $self->SUPER::GeneratePage(); }
+=pod +=over 12 + +=item C<GetHtmlLine()> + +Determines if the log line should be shown, how, and escapes it so it is valid +HTML. + +When not showing the full log, returns undef except for error messages which +are the only lines tha should be shown. +When showing the full log error messages and other lines of interest are +highlighted to make the log more readable. + +=back +=cut + sub GetHtmlLine($$$) { my ($self, $FullLog, $Line) = @_;
- $Line = $self->escapeHTML($Line); - if ($Line =~ /: Test marked todo: /) - { - return (undef, $Line) if (!$FullLog); - my $Html = $Line; - $Html =~ s~^(.*\S)\s*\r?$~<span class='log-todo'>$1</span>~; - return ($Html, $Line); - } - if ($Line =~ /: Tests skipped: / or - $Line =~ /^\w+:\w+ skipped /) - { - return (undef, $Line) if (!$FullLog); - my $Html = $Line; - $Html =~ s~^(.*\S)\s*\r?$~<span class='log-skip'>$1</span>~; - return ($Html, $Line); - } - if ($Line =~ /: Test (?:failed|succeeded inside todo block): / or - $Line =~ /Fatal: test .* does not exist/ or - $Line =~ / done (258)/ or - $Line =~ /: unhandled exception [0-9a-fA-F]{8} at / or - $Line =~ /^Unhandled exception: / or - # Git errors - $Line =~ /^CONFLICT / or - $Line =~ /^error: patch failed:/ or - $Line =~ /^error: corrupt patch / or - # Build errors - $Line =~ /: error: / or - $Line =~ /^Makefile:[0-9]+: recipe for target .* failed$/ or - $Line =~ /^(?:Build|Reconfig|Task): (?!ok)/ or - # Typical perl errors - $Line =~ /^Use of uninitialized value/) - { - return ($Line, $Line) if (!$FullLog); - my $Html = $Line; - $Html =~ s~^(.*\S)\s*\r?$~<span class='log-error'>$1</span>~; - return ($Html, $Line); - } - if ($FullLog && - ($Line =~ /^+ \S/ or - $Line =~ /^\w+:\w+ start / or - # Build messages - $Line =~ /^(?:Build|Reconfig|Task): ok/)) + my $Category = GetLogLineCategory($Line); + return undef if ($Category ne "error" and !$FullLog); + + my $Html = $self->escapeHTML($Line); + if ($FullLog and $Category ne "none") { - my $Html = $Line; - $Html =~ s~^(.*\S)\s*\r?$~<span class='log-info'>$1</span>~; - return ($Html, $Line); + # Highlight all line categories in the full log + $Html =~ s~^(.*\S)\s*\r?$~<span class='log-$Category'>$1</span>~; } - - return (undef, $Line); + return $Html; }
my @MILogFiles = qw(exe32.report exe64.report log log.old); @@ -429,8 +407,8 @@ sub GenerateBody($) { $CurrentDll = $1; } - my ($Highlight, $Plain) = $self->GetHtmlLine($MoreInfo->{Full}, $Line); - next if (!$MoreInfo->{Full} and !defined $Highlight); + my $Html = $self->GetHtmlLine($MoreInfo->{Full}, $Line); + next if (!defined $Html);
if ($PrintedDll ne $CurrentDll && !$MoreInfo->{Full}) { @@ -451,7 +429,7 @@ sub GenerateBody($) } else { - print(($Highlight || $Plain), "\n"); + print "$Html\n"; } } close($LogFile);
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/WineTestBot/LogUtils.pm | 55 ++++++++++++++++++++++++++++- testbot/web/JobDetails.pl | 20 ++++------- 2 files changed, 60 insertions(+), 15 deletions(-)
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm index daa9c0bd8..3dfd7c5e7 100644 --- a/testbot/lib/WineTestBot/LogUtils.pm +++ b/testbot/lib/WineTestBot/LogUtils.pm @@ -27,7 +27,7 @@ WineTestBot::LogUtils - Provides functions to parse task logs
use Exporter 'import'; -our @EXPORT = qw(GetLogLineCategory ParseTaskLog); +our @EXPORT = qw(GetLogFileNames GetLogLabel GetLogLineCategory ParseTaskLog);
# @@ -133,4 +133,57 @@ sub GetLogLineCategory($) return "none"; }
+=pod +=over 12 + +=item C<GetLogFileNames()> + +Scans the directory for test reports and task logs and returns their filenames. +The filenames are returned in the order in which the logs are meant to be +presented. + +=back +=cut + +sub GetLogFileNames($;$) +{ + my ($Dir, $IncludeOld) = @_; + + my @Candidates = ("exe32.report", "exe64.report", + "log", "err"); + push @Candidates, "log.old", "err.old" if ($IncludeOld); + + my @Logs; + foreach my $FileName (@Candidates) + { + push @Logs, $FileName if (-f "$Dir/$FileName" and !-z "$Dir/$FileName"); + } + return @Logs; +} + +my %_LogFileLabels = ( + "exe32.report" => "32 bit Windows report", + "exe64.report" => "64 bit Windows report", + "err" => "task errors", + "log" => "task log", + "err.old" => "old task errors", + "log.old" => "old logs", +); + +=pod +=over 12 + +=item C<GetLogLabel()> + +Returns a user-friendly description of the content of the specified log file. + +=back +=cut + +sub GetLogLabel($) +{ + my ($LogFileName) = @_; + return $_LogFileLabels{$LogFileName}; +} + 1; diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl index 07924f4e6..e5f792929 100644 --- a/testbot/web/JobDetails.pl +++ b/testbot/web/JobDetails.pl @@ -261,14 +261,6 @@ sub GetHtmlLine($$$) return $Html; }
-my @MILogFiles = qw(exe32.report exe64.report log log.old); -my %MILogLabels = ( - "exe32.report" => "32 bit Windows report", - "exe64.report" => "64 bit Windows report", - "log" => "task log", - "log.old" => "old logs", -); - sub InitMoreInfo($) { my ($self) = @_; @@ -282,15 +274,15 @@ sub InitMoreInfo($)
my $Value = $self->GetParam("f$Key"); my $TaskDir = $StepTask->GetTaskDir(); - foreach my $Log (@MILogFiles) + foreach my $Log (@{GetLogFileNames($TaskDir, 1)}) { - if (!-f "$TaskDir/$Log" or -z "$TaskDir/$Log") + if ($Log =~ s/^err/log/) { - my $Err = $Log; - next if ($Err !~ s/^log/err/ or !-f "$TaskDir/$Err" or -z "$TaskDir/$Err"); + # We don't want separate entries for log* and err* but we also want a + # log* entry even if only err* exists. + next if (($More->{$Key}->{Logs}->[-1] || "") eq $Log); } push @{$More->{$Key}->{Logs}}, $Log; - $More->{$Key}->{Full} = $Log if (uri_escape($Log) eq $Value); } $More->{$Key}->{Full} ||= ""; @@ -385,7 +377,7 @@ sub GenerateBody($)
foreach my $Log (@{$MoreInfo->{Logs}}) { - $self->GenerateMoreInfoLink($Key, $MILogLabels{$Log}, "Full", $Log); + $self->GenerateMoreInfoLink($Key, GetLogLabel($Log), "Full", $Log); } print "</div>\n";
When run in --debug mode WineSendLog prints the emails it would normally send instead of piping them to sendmail. Also the script now prints the error messages to stderr by default to make it easier to figure things out when running it on the command line. The --log-only option can be used when that's not desired.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/Engine.pl | 2 +- testbot/bin/WineSendLog.pl | 193 +++++++++++++++++++++++++++++++------ 2 files changed, 164 insertions(+), 31 deletions(-)
diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl index ce3509440..464b6db45 100755 --- a/testbot/bin/Engine.pl +++ b/testbot/bin/Engine.pl @@ -320,7 +320,7 @@ sub HandleJobStatusChange($$$) CloseAllDBBackEnds(); WineTestBot::Log::SetupRedirects();
- exec("$BinDir/${ProjectName}SendLog.pl $JobKey") or + exec("$BinDir/${ProjectName}SendLog.pl --log-only $JobKey") or LogMsg "Unable to exec ${ProjectName}SendLog.pl: $!\n"; exit(1); } diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl index e03395af1..ed3453b80 100755 --- a/testbot/bin/WineSendLog.pl +++ b/testbot/bin/WineSendLog.pl @@ -36,14 +36,47 @@ sub BEGIN unshift @INC, "$::RootDir/lib"; } } +my $Name0 = $0; +$Name0 =~ s+^.*/++; +
use Algorithm::Diff; + use WineTestBot::Config; use WineTestBot::Jobs; use WineTestBot::Log; use WineTestBot::StepsTasks;
+# +# Logging and error handling helpers +# + +my $Debug; +sub Debug(@) +{ + print STDERR @_ if ($Debug); +} + +sub DebugTee($@) +{ + my ($File) = shift; + print $File @_; + Debug(@_); +} + +my $LogOnly; +sub Error(@) +{ + print STDERR "$Name0:error: ", @_ if (!$LogOnly); + LogMsg @_; +} + + +# +# Log analysis +# + sub IsBotFailure($) { my ($ErrLine) = @_; @@ -121,7 +154,7 @@ sub ReadLog($$$) } else { - LogMsg "Unable to open '$LogName' for reading: $!\n"; + Error "Unable to open '$LogName' for reading: $!\n"; }
return @Messages; @@ -179,7 +212,19 @@ sub SendLog($) my $StepsTasks = CreateStepsTasks(undef, $Job); my @SortedKeys = sort @{$StepsTasks->GetKeys()};
- open (SENDMAIL, "|/usr/sbin/sendmail -oi -t -odq"); + # + # Send a job summary and all the logs as attachments to the developer + # + + Debug("-------------------- Developer email --------------------\n"); + if ($Debug) + { + open(SENDMAIL, ">>&=", 1); + } + else + { + open (SENDMAIL, "|/usr/sbin/sendmail -oi -t -odq"); + } print SENDMAIL "From: $RobotEMail\n"; print SENDMAIL "To: $To\n"; my $Subject = "TestBot job " . $Job->Id . " results"; @@ -218,6 +263,7 @@ EOF $TestFailures; }
+ # Print the job summary my @FailureKeys; foreach my $Key (@SortedKeys) { @@ -322,6 +368,7 @@ EOF } }
+ # Print the log attachments foreach my $Key (@SortedKeys) { my $StepTask = $StepsTasks->GetItem($Key); @@ -334,6 +381,7 @@ Content-Transfer-Encoding: 8bit EOF print SENDMAIL "Content-Disposition: attachment; filename=", $StepTask->VM->Name, ".log\n\n"; + print SENDMAIL "Not dumping logs in debug mode\n" if ($Debug);
my $PrintSeparator = !1; my $TaskDir = $StepTask->GetTaskDir(); @@ -343,7 +391,7 @@ EOF while (defined($Line = <LOGFILE>)) { $Line =~ s/\s*$//; - print SENDMAIL "$Line\n"; + print SENDMAIL "$Line\n" if (!$Debug); $PrintSeparator = 1; } close LOGFILE; @@ -356,11 +404,11 @@ EOF { if ($PrintSeparator) { - print SENDMAIL "\n"; + print SENDMAIL "\n" if (!$Debug); $PrintSeparator = !1; } $Line =~ s/\s*$//; - print SENDMAIL "$Line\n"; + print SENDMAIL "$Line\n" if (!$Debug); } close ERRFILE; } @@ -369,10 +417,12 @@ EOF print SENDMAIL "--==13F70BD1-BA1B-449A-9CCB-B6A8E90CED47==--\n"; close(SENDMAIL);
- if (! defined($Job->Patch)) - { - return; - } + # This is all for jobs submitted from the website + return if (!defined $Job->Patch); + + # + # Build a job summary with only the new errors + #
my $Messages = ""; foreach my $Key (@FailureKeys) @@ -401,7 +451,7 @@ EOF } else { - LogMsg "BotFailure found in ${LatestName}.err\n"; + Error "BotFailure found in ${LatestName}.err\n"; } if ($MessagesFromErr || $MessagesFromLog) { @@ -411,15 +461,28 @@ EOF } elsif ($BotFailure) { - LogMsg "BotFailure found in $TaskDir/err\n"; + Error "BotFailure found in $TaskDir/err\n"; } }
+ # + # Send a summary of the new errors to the mailing list + # + + Debug("\n-------------------- Mailing list email --------------------\n"); + my $WebSite = ($UseSSL ? "https://" : "http://") . $WebHostName;
if ($Messages) { - open (SENDMAIL, "|/usr/sbin/sendmail -oi -t -odq"); + if ($Debug) + { + open(SENDMAIL, ">>&=", 1); + } + else + { + open (SENDMAIL, "|/usr/sbin/sendmail -oi -t -odq"); + } print SENDMAIL "From: $RobotEMail\n"; print SENDMAIL "To: $To\n"; print SENDMAIL "Cc: $WinePatchCc\n"; @@ -445,6 +508,14 @@ EOF print SENDMAIL $Messages; close SENDMAIL; } + else + { + Debug("Found no error to report to the mailing list\n"); + } + + # + # Create a .testbot file for the patches website + #
my $Patch = $Job->Patch; if (defined $Patch->WebPatchId and -d "$DataDir/webpatches") @@ -452,9 +523,12 @@ EOF my $BaseName = "$DataDir/webpatches/" . $Patch->WebPatchId; if (open (my $result, ">", "$BaseName.testbot")) { - print $result "Status: " . ($Messages ? "Failed" : "OK") . "\n"; - print $result "Job-ID: " . $Job->Id . "\n"; - print $result "URL: $WebSite/JobDetails.pl?Key=" . $Job->GetKey() . "\n"; + Debug("\n-------------------- WebPatches report --------------------\n"); + # Only take into account new errors to decide whether the job was + # successful or not. + DebugTee($result, "Status: ". ($Messages ? "Failed" : "OK") ."\n"); + DebugTee($result, "Job-ID: ". $Job->Id ."\n"); + DebugTee($result, "URL: $WebSite/JobDetails.pl?Key=". $Job->GetKey() ."\n");
foreach my $Key (@SortedKeys) { @@ -496,7 +570,7 @@ EOF } else { - LogMsg "Job " . $Job->Id . ": Unable to open '$BaseName.testbot' for writing: $!"; + Error "Job ". $Job->Id .": Unable to open '$BaseName.testbot' for writing: $!"; } } } @@ -509,37 +583,96 @@ EOF $ENV{PATH} = "/usr/bin:/bin"; delete $ENV{ENV};
-my $JobId = $ARGV[0]; -if (! $JobId) +my $Usage; +sub ValidateNumber($$) +{ + my ($Name, $Value) = @_; + + # Validate and untaint the value + return $1 if ($Value =~ /^(\d+)$/); + Error "$Value is not a valid $Name\n"; + $Usage = 2; + return undef; +} + +my ($JobId); +while (@ARGV) { - die "Usage: WineSendLog.pl JobId"; + my $Arg = shift @ARGV; + if ($Arg eq "--debug") + { + $Debug = 1; + } + elsif ($Arg eq "--log-only") + { + $LogOnly = 1; + } + elsif ($Arg =~ /^(?:-?|-h|--help)$/) + { + $Usage = 0; + last; + } + elsif ($Arg =~ /^-/) + { + Error "unknown option '$Arg'\n"; + $Usage = 2; + last; + } + elsif (!defined $JobId) + { + $JobId = ValidateNumber('job id', $Arg); + } + else + { + Error "unexpected argument '$Arg'\n"; + $Usage = 2; + last; + } }
-# Untaint parameters -if ($JobId =~ /^(\d+)$/) +# Check parameters +if (!defined $Usage) { - $JobId = $1; + if (!defined $JobId) + { + Error "you must specify the job id\n"; + $Usage = 2; + } } -else +if (defined $Usage) { - LogMsg "Invalid JobId $JobId\n"; - exit(1); + if ($Usage) + { + Error "try '$Name0 --help' for more information\n"; + exit $Usage; + } + print "Usage: $Name0 [--debug] [--help] JOBID\n"; + print "\n"; + print "Analyze the job's logs and notifies the developer and the patches website.\n"; + print "\n"; + print "Where:\n"; + print " JOBID Id of the job to report on.\n"; + print " --debug More verbose messages for debugging.\n"; + print " --log-only Only send error messages to the log instead of also printing them\n"; + print " on stderr.\n"; + print " --help Shows this usage message.\n"; + exit 0; }
my $Job = CreateJobs()->GetItem($JobId); -if (! defined($Job)) +if (!defined $Job) { - LogMsg "Job $JobId doesn't exist\n"; - exit(1); + Error "Job $JobId doesn't exist\n"; + exit 1; }
# -# Analyze the log and notify the developer +# Analyze the log, notify the developer and the Patches website #
SendLog($Job);
LogMsg "Log for job $JobId sent\n";
-exit(0); +exit 0;
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/WineSendLog.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl index ed3453b80..2f097796e 100755 --- a/testbot/bin/WineSendLog.pl +++ b/testbot/bin/WineSendLog.pl @@ -48,6 +48,9 @@ use WineTestBot::Log; use WineTestBot::StepsTasks;
+my $PART_BOUNDARY = "==13F70BD1-BA1B-449A-9CCB-B6A8E90CED47=="; + + # # Logging and error handling helpers # @@ -241,9 +244,9 @@ sub SendLog($) } print SENDMAIL <<"EOF"; MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="==13F70BD1-BA1B-449A-9CCB-B6A8E90CED47==" +Content-Type: multipart/mixed; boundary="$PART_BOUNDARY"
---==13F70BD1-BA1B-449A-9CCB-B6A8E90CED47== +--$PART_BOUNDARY Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit @@ -374,7 +377,7 @@ EOF my $StepTask = $StepsTasks->GetItem($Key);
print SENDMAIL <<"EOF"; ---==13F70BD1-BA1B-449A-9CCB-B6A8E90CED47== +--$PART_BOUNDARY Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit @@ -414,7 +417,7 @@ EOF } }
- print SENDMAIL "--==13F70BD1-BA1B-449A-9CCB-B6A8E90CED47==--\n"; + print SENDMAIL "--$PART_BOUNDARY--\n"; close(SENDMAIL);
# This is all for jobs submitted from the website
GetLogLineCategory()'s error detection is much more complete and this avoids code duplication.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/WineSendLog.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl index 2f097796e..33978095e 100755 --- a/testbot/bin/WineSendLog.pl +++ b/testbot/bin/WineSendLog.pl @@ -45,6 +45,7 @@ use Algorithm::Diff; use WineTestBot::Config; use WineTestBot::Jobs; use WineTestBot::Log; +use WineTestBot::LogUtils; use WineTestBot::StepsTasks;
@@ -290,8 +291,8 @@ EOF { $CurrentDll = $1; } - if ($Line =~ m/: Test failed: / || $Line =~ m/ done (258)/ || - $Line =~ m/: unhandled exception [0-9a-fA-F]{8} at /) + my $Category = GetLogLineCategory($Line); + if ($Category eq "error") { if ($PrintedDll ne $CurrentDll) {
Currently we will either have a test report or a task log file so it's ok to only take into account the first file returned by GetLogFileNames().
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/WineSendLog.pl | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl index 33978095e..53b184cff 100755 --- a/testbot/bin/WineSendLog.pl +++ b/testbot/bin/WineSendLog.pl @@ -272,11 +272,13 @@ EOF foreach my $Key (@SortedKeys) { my $StepTask = $StepsTasks->GetItem($Key); + my $TaskDir = $StepTask->GetTaskDir();
print SENDMAIL "\n=== ", $StepTask->GetTitle(), " ===\n";
- my $TaskDir = $StepTask->GetTaskDir(); - if (open LOGFILE, "<$TaskDir/log") + my $LogFiles = GetLogFileNames($TaskDir); + my $LogName = $LogFiles->[0] || "log"; + if (open LOGFILE, "<$TaskDir/$LogName") { my $HasLogEntries = !1; my $PrintedSomething = !1; @@ -376,6 +378,7 @@ EOF foreach my $Key (@SortedKeys) { my $StepTask = $StepsTasks->GetItem($Key); + my $TaskDir = $StepTask->GetTaskDir();
print SENDMAIL <<"EOF"; --$PART_BOUNDARY @@ -387,9 +390,10 @@ EOF $StepTask->VM->Name, ".log\n\n"; print SENDMAIL "Not dumping logs in debug mode\n" if ($Debug);
+ my $LogFiles = GetLogFileNames($TaskDir); + my $LogName = $LogFiles->[0] || "log"; my $PrintSeparator = !1; - my $TaskDir = $StepTask->GetTaskDir(); - if (open LOGFILE, "<$TaskDir/log") + if (open LOGFILE, "<$TaskDir/$LogName") { my $Line; while (defined($Line = <LOGFILE>)) @@ -432,8 +436,8 @@ EOF foreach my $Key (@FailureKeys) { my $StepTask = $StepsTasks->GetItem($Key); - my $TaskDir = $StepTask->GetTaskDir(); + my ($BotFailure, $MessagesFromErr) = CheckErrLog("$TaskDir/err"); if (! $BotFailure) { @@ -449,7 +453,9 @@ EOF # Filter out failures that happened in the full test suite: # the test suite is run against code which is already in Wine # so any failure it reported is not caused by this patch. - $MessagesFromLog = CompareLogs("$LatestName.log", "$TaskDir/log", + my $LogFiles = GetLogFileNames($TaskDir); + my $LogName = $LogFiles->[0] || "log"; + $MessagesFromLog = CompareLogs("$LatestName.log", "$TaskDir/$LogName", $BaseName, $StepTask->CmdLineArg); } } @@ -537,11 +543,14 @@ EOF foreach my $Key (@SortedKeys) { my $StepTask = $StepsTasks->GetItem($Key); + my $TaskDir = $StepTask->GetTaskDir(); + print $result "\n=== ", $StepTask->GetTitle(), " ===\n";
+ my $LogFiles = GetLogFileNames($TaskDir); + my $LogName = $LogFiles->[0] || "log"; my $PrintSeparator = !1; - my $TaskDir = $StepTask->GetTaskDir(); - if (open(my $logfile, "<", "$TaskDir/log")) + if (open(my $logfile, "<", "$TaskDir/$LogName")) { my $Line; while (defined($Line = <$logfile>))
Comparing the compilation log with the reference WineTest report makes no sense. So handle the WineTest reports and task logs separately.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/WineSendLog.pl | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl index 53b184cff..29da4a04d 100755 --- a/testbot/bin/WineSendLog.pl +++ b/testbot/bin/WineSendLog.pl @@ -439,13 +439,23 @@ EOF my $TaskDir = $StepTask->GetTaskDir();
my ($BotFailure, $MessagesFromErr) = CheckErrLog("$TaskDir/err"); - if (! $BotFailure) + if ($BotFailure) + { + # TestBot errors are not the developer's fault and prevent us from doing + # any meaningful analysis. So skip. + Error "A TestBot error was found in $TaskDir/err\n"; + next; + } + + my $MessagesFromLog = ""; + my $LogFiles = GetLogFileNames($TaskDir); + my $LogName = $LogFiles->[0] || "log"; + if ($LogName =~ /.report$/) { $StepTask->FileName =~ m/^(.*)_test(64)?.exe$/; my ($BaseName, $Bits) = ($1, $2 || "32"); my $LatestName = "$DataDir/latest/" . $StepTask->VM->Name . "_$Bits"; my ($LatestBotFailure, $Dummy) = CheckErrLog("$LatestName.err"); - my $MessagesFromLog = ""; if (! $LatestBotFailure) { if (defined($StepTask->CmdLineArg)) @@ -463,15 +473,20 @@ EOF { Error "BotFailure found in ${LatestName}.err\n"; } - if ($MessagesFromErr || $MessagesFromLog) + } + elsif (open(my $LogFile, "<", "$TaskDir/$LogName")) + { + foreach my $Line (<$LogFile>) { - $Messages .= "\n=== " . $StepTask->GetTitle() . " ===\n" . - $MessagesFromLog . $MessagesFromErr; + my $Category = GetLogLineCategory($Line); + $MessagesFromLog .= $Line if ($Category eq "error"); } + close($LogFile); } - elsif ($BotFailure) + if ($MessagesFromErr || $MessagesFromLog) { - Error "BotFailure found in $TaskDir/err\n"; + $Messages .= "\n=== " . $StepTask->GetTitle() . " ===\n" . + $MessagesFromLog . $MessagesFromErr; } }