Francois Gouget : testbot/LogUtils: Store the filename in the $LogInfo structures.
Alexandre Julliard
julliard at winehq.org
Tue Jan 28 15:29:54 CST 2020
Module: tools
Branch: master
Commit: 96cd74841084de0c2d23108e897bc76ef8476861
URL: https://source.winehq.org/git/tools.git/?a=commit;h=96cd74841084de0c2d23108e897bc76ef8476861
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Tue Jan 28 12:05:35 2020 +0100
testbot/LogUtils: Store the filename in the $LogInfo structures.
Also standardize on $LogPath for the full path to log files, and
$LogName for their basename, which matches the field names.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/lib/WineTestBot/LogUtils.pm | 55 +++++++++++++++++++++++--------------
1 file changed, 34 insertions(+), 21 deletions(-)
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index 9aa2e81..8187826 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -90,16 +90,22 @@ Contains an error message if the task log could not be read.
sub ParseTaskLog($)
{
- my ($FileName) = @_;
+ my ($LogPath) = @_;
+
+ my $LogName = basename($LogPath);
+ my $LogInfo = {
+ LogName => $LogName,
+ LogPath => $LogPath,
+ };
my $LogFile;
- if (!open($LogFile, "<", $FileName))
+ if (!open($LogFile, "<", $LogPath))
{
- my $LogName = basename($FileName);
- return {BadLog => "Unable to open '$LogName' for reading: $!"};
+ $LogInfo->{BadLog} = "Unable to open '$LogName' for reading: $!";
+ return $LogInfo;
}
- my $LogInfo = {Type => "build"};
+ $LogInfo->{Type} = "build";
foreach my $Line (<$LogFile>)
{
chomp $Line;
@@ -362,16 +368,12 @@ Contains an error message if the report could not be read.
sub ParseWineTestReport($$$)
{
- my ($FileName, $IsWineTest, $TaskTimedOut) = @_;
-
- my $LogFile;
- if (!open($LogFile, "<", $FileName))
- {
- my $LogName = basename($FileName);
- return {BadLog => "Unable to open '$LogName' for reading: $!"};
- }
+ my ($LogPath, $IsWineTest, $TaskTimedOut) = @_;
+ my $LogName = basename($LogPath);
my $LogInfo = {
+ LogName => $LogName,
+ LogPath => $LogPath,
IsWineTest => $IsWineTest,
TaskTimedOut => $TaskTimedOut,
@@ -381,6 +383,13 @@ sub ParseWineTestReport($$$)
Extra => [],
};
+ my $LogFile;
+ if (!open($LogFile, "<", $LogPath))
+ {
+ $LogInfo->{BadLog} = "Unable to open '$LogName' for reading: $!";
+ return $LogInfo;
+ }
+
my $Cur = _NewCurrentUnit("", "");
foreach my $Line (<$LogFile>)
{
@@ -757,10 +766,10 @@ An array containing the error messages.
sub GetLogErrors($)
{
- my ($LogFileName) = @_;
+ my ($LogPath) = @_;
my ($IsReport, $GetCategory);
- if ($LogFileName =~ /\.report$/)
+ if ($LogPath =~ /\.report$/)
{
$IsReport = 1;
$GetCategory = \&GetReportLineCategory;
@@ -770,12 +779,16 @@ sub GetLogErrors($)
$GetCategory = \&GetLogLineCategory;
}
+ my $LogName = basename($LogPath);
my $LogInfo = {
+ LogName => $LogName,
+ LogPath => $LogPath,
+
ErrCount => undef, # until we open a log
ErrGroupNames => [],
ErrGroups => {},
};
- if (open(my $LogFile, "<", $LogFileName))
+ if (open(my $LogFile, "<", $LogPath))
{
$LogInfo->{ErrCount} ||= 0;
my $CurrentModule = "";
@@ -805,14 +818,14 @@ sub GetLogErrors($)
}
close($LogFile);
}
- elsif (-f $LogFileName)
+ elsif (-f $LogPath)
{
- $LogInfo->{BadLog} = "Could not open '". basename($LogFileName) ."' for reading: $!";
+ $LogInfo->{BadLog} = "Could not open '$LogName' for reading: $!";
my $Group = _AddLogGroup($LogInfo, "TestBot errors");
_AddLogError($LogInfo, $Group, $LogInfo->{BadLog});
}
- if (open(my $LogFile, "<", "$LogFileName.err"))
+ if (open(my $LogFile, "<", "$LogPath.err"))
{
$LogInfo->{ErrCount} ||= 0;
# Add the related extra errors
@@ -831,9 +844,9 @@ sub GetLogErrors($)
}
close($LogFile);
}
- elsif (-f "$LogFileName.err")
+ elsif (-f "$LogPath.err")
{
- $LogInfo->{BadLog} ||= "Could not open '". basename($LogFileName) .".err' for reading: $!";
+ $LogInfo->{BadLog} ||= "Could not open '$LogName.err' for reading: $!";
my $Group = _AddLogGroup($LogInfo, "TestBot errors");
_AddLogError($LogInfo, $Group, $LogInfo->{BadLog});
}
More information about the wine-cvs
mailing list