It also better matches the ParseWineTestReport() structure. --- testbot/lib/WineTestBot/LogUtils.pm | 60 +++++++++++++++-------------- 1 file changed, 31 insertions(+), 29 deletions(-)
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm index dd8228e69..4d1ddda8c 100644 --- a/testbot/lib/WineTestBot/LogUtils.pm +++ b/testbot/lib/WineTestBot/LogUtils.pm @@ -92,39 +92,41 @@ sub ParseTaskLog($) { my ($FileName) = @_;
- if (open(my $LogFile, "<", $FileName)) + my $LogFile; + if (!open($LogFile, "<", $FileName)) { - my $LogInfo = {Type => "build"}; - foreach my $Line (<$LogFile>) + return {NoLog => "Unable to open the task log for reading: $!"}; + } + + my $LogInfo = {Type => "build"}; + foreach my $Line (<$LogFile>) + { + chomp $Line; + if ($Line eq "Task: tests") { - chomp $Line; - if ($Line eq "Task: tests") - { - $LogInfo->{Type} = "tests"; - } - elsif ($Line eq "Task: ok") - { - $LogInfo->{Task} ||= "ok"; - } - elsif ($Line eq "Task: Patch failed to apply") - { - $LogInfo->{Task} = "badpatch"; - last; # Should be the last and most specific message - } - elsif ($Line =~ /^Task: Updated ([a-zA-Z0-9.]+)$/) - { - $LogInfo->{$1} = "updated"; - } - elsif ($Line =~ /^Task: / or _IsPerlError($Line)) - { - $LogInfo->{Task} = "failed"; - } + $LogInfo->{Type} = "tests"; + } + elsif ($Line eq "Task: ok") + { + $LogInfo->{Task} ||= "ok"; + } + elsif ($Line eq "Task: Patch failed to apply") + { + $LogInfo->{Task} = "badpatch"; + last; # Should be the last and most specific message + } + elsif ($Line =~ /^Task: Updated ([a-zA-Z0-9.]+)$/) + { + $LogInfo->{$1} = "updated"; + } + elsif ($Line =~ /^Task: / or _IsPerlError($Line)) + { + $LogInfo->{Task} = "failed"; } - close($LogFile); - $LogInfo->{Task} ||= "missing"; - return $LogInfo; } - return {NoLog => "Unable to open the task log for reading: $!"}; + close($LogFile); + $LogInfo->{Task} ||= "missing"; + return $LogInfo; }