[PATCH 2/2] testbot/LogUtils: Tweak ParseTaskLog() to reduce the indentation level.
Francois Gouget
fgouget at codeweavers.com
Thu Jan 23 03:41:49 CST 2020
It also better matches the ParseWineTestReport() structure.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
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 af17c110d9..8cd3ae1178 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;
}
--
2.20.1
More information about the wine-devel
mailing list