[tools] testbot/WinRun*: Simplify LogTaskError().

Francois Gouget fgouget at codeweavers.com
Tue Feb 2 20:32:20 CST 2021


The TestBot engine redirects stderr to testbot.log so there is no need
to manually open and append to that file.
This also makes the Debug() call in LogTaskError() redundant.
Add the "tool:error:" prefix. This clarifies which errors come from the
script, and which come from the TestBot Engine.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48658
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/WineRunBuild.pl    | 14 +-------------
 testbot/bin/WineRunReconfig.pl | 14 +-------------
 testbot/bin/WineRunTask.pl     | 14 +-------------
 testbot/bin/WineRunWineTest.pl | 12 +-----------
 4 files changed, 4 insertions(+), 50 deletions(-)

diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index 2764ffc92..ff130526e 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -178,19 +178,7 @@ LogMsg "Task $JobId/$StepNo/$TaskNo started\n";
 sub LogTaskError($)
 {
   my ($ErrMessage) = @_;
-  Debug("$Name0:error: ", $ErrMessage);
-
-  my $OldUMask = umask(002);
-  if (open(my $ErrFile, ">>", "$TaskDir/testbot.log"))
-  {
-    print $ErrFile $ErrMessage;
-    close($ErrFile);
-  }
-  else
-  {
-    Error "Unable to open 'testbot.log' for writing: $!\n";
-  }
-  umask($OldUMask);
+  print STDERR "$Name0:error: ", $ErrMessage;
 }
 
 sub WrapUpAndExit($;$$$)
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index 8047d3e6e..004987f5b 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -179,19 +179,7 @@ LogMsg "Task $JobId/$StepNo/$TaskNo started\n";
 sub LogTaskError($)
 {
   my ($ErrMessage) = @_;
-  Debug("$Name0:error: ", $ErrMessage);
-
-  my $OldUMask = umask(002);
-  if (open(my $ErrFile, ">>", "$TaskDir/testbot.log"))
-  {
-    print $ErrFile $ErrMessage;
-    close($ErrFile);
-  }
-  else
-  {
-    Error "Unable to open 'testbot.log' for writing: $!\n";
-  }
-  umask($OldUMask);
+  print STDERR "$Name0:error: ", $ErrMessage;
 }
 
 sub WrapUpAndExit($;$$$)
diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl
index 303648807..6056806f3 100755
--- a/testbot/bin/WineRunTask.pl
+++ b/testbot/bin/WineRunTask.pl
@@ -207,19 +207,7 @@ LogMsg "Task $JobId/$StepNo/$TaskNo started\n";
 sub LogTaskError($)
 {
   my ($ErrMessage) = @_;
-  Debug("$Name0:error: ", $ErrMessage);
-
-  my $OldUMask = umask(002);
-  if (open(my $ErrFile, ">>", "$TaskDir/testbot.log"))
-  {
-    print $ErrFile $ErrMessage;
-    close($ErrFile);
-  }
-  else
-  {
-    Error "Unable to open 'testbot.log' for writing: $!\n";
-  }
-  umask($OldUMask);
+  print STDERR "$Name0:error: ", $ErrMessage;
 }
 
 my $ReportNames;
diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl
index bcf89bfa7..7892bca74 100755
--- a/testbot/bin/WineRunWineTest.pl
+++ b/testbot/bin/WineRunWineTest.pl
@@ -204,17 +204,7 @@ LogMsg "Task $JobId/$StepNo/$TaskNo started\n";
 sub LogTaskError($)
 {
   my ($ErrMessage) = @_;
-  Debug("$Name0:error: ", $ErrMessage);
-
-  if (open(my $ErrFile, ">>", "$TaskDir/testbot.log"))
-  {
-    print $ErrFile $ErrMessage;
-    close($ErrFile);
-  }
-  else
-  {
-    Error "Unable to open 'testbot.log' for writing: $!\n";
-  }
+  print STDERR "$Name0:error: ", $ErrMessage;
 }
 
 my $ReportNames;
-- 
2.20.1



More information about the wine-devel mailing list