Francois Gouget : testbot/LogUtils: Tweak ParseTaskLog() to reduce the indentation level.
Alexandre Julliard
julliard at winehq.org
Thu Jan 23 15:46:59 CST 2020
Module: tools
Branch: master
Commit: 78070bbb413cac303cbc4ea58e0ed5efd84ba41b
URL: https://source.winehq.org/git/tools.git/?a=commit;h=78070bbb413cac303cbc4ea58e0ed5efd84ba41b
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Thu Jan 23 10:41:49 2020 +0100
testbot/LogUtils: Tweak ParseTaskLog() to reduce the indentation level.
It also better matches the ParseWineTestReport() structure.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 af17c11..8cd3ae1 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;
}
More information about the wine-cvs
mailing list