Francois Gouget : testbot: Tweak the scripts so they print error messages on stderr by default.

Alexandre Julliard julliard at winehq.org
Wed Oct 11 07:24:43 CDT 2017


Module: tools
Branch: master
Commit: 9efe233073c826b5dffe3bcb145bc1d982d3aa0d
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=9efe233073c826b5dffe3bcb145bc1d982d3aa0d

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Oct 10 23:56:51 2017 +0200

testbot: Tweak the scripts so they print error messages on stderr by default.

When the scripts are started by the Engine their stderr is redirected to
the log in order to also capture Perl errors.
Since the scripts always log error messages, to avoid getting duplicates
they were only printing errors to stderr if given the --debug option.
As a result usage errors were not printed by default.
So the scripts now print the messages to stderr by default and the
Engine can invoke them with the --log-only option where needed to avoid
the stderr duplicates.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/bin/LibvirtTool.pl       | 9 +++++++--
 testbot/bin/WineRunBuild.pl      | 9 +++++++--
 testbot/bin/WineRunReconfig.pl   | 9 +++++++--
 testbot/bin/WineRunTask.pl       | 9 +++++++--
 testbot/lib/WineTestBot/Tasks.pm | 2 +-
 testbot/lib/WineTestBot/VMs.pm   | 2 +-
 6 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl
index aa256f3..358eebf 100755
--- a/testbot/bin/LibvirtTool.pl
+++ b/testbot/bin/LibvirtTool.pl
@@ -51,9 +51,10 @@ sub Debug(@)
   print STDERR @_ if ($Debug);
 }
 
+my $LogOnly;
 sub Error(@)
 {
-  Debug("$Name0:error: ", @_);
+  print STDERR "$Name0:error: ", @_ if (!$LogOnly);
   LogMsg @_;
 }
 
@@ -99,6 +100,10 @@ while (@ARGV)
   {
     $Debug = 1;
   }
+  elsif ($Arg eq "--log-only")
+  {
+    $LogOnly = 1;
+  }
   elsif ($Arg eq "revert")
   {
     $Action = $Arg;
@@ -158,7 +163,7 @@ if (!defined $Usage)
 }
 if (defined $Usage)
 {
-  print "Usage: $Name0 [--debug] [--help] revert VMName\n";
+  print "Usage: $Name0 [--debug] [--log-only] [--help] revert VMName\n";
   exit $Usage;
 }
 
diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index 85fe568..f385fee 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -54,9 +54,10 @@ sub Debug(@)
   print STDERR @_ if ($Debug);
 }
 
+my $LogOnly;
 sub Error(@)
 {
-  Debug("$Name0:error: ", @_);
+  print STDERR "$Name0:error: ", @_ if (!$LogOnly);
   LogMsg @_;
 }
 
@@ -88,6 +89,10 @@ while (@ARGV)
   {
     $Debug = 1;
   }
+  elsif ($Arg eq "--log-only")
+  {
+    $LogOnly = 1;
+  }
   elsif ($Arg =~ /^(?:-\?|-h|--help)$/)
   {
     $Usage = 0;
@@ -130,7 +135,7 @@ if (!defined $Usage)
 }
 if (defined $Usage)
 {
-    print "Usage: $Name0 [--debug] [--help] JobId StepNo TaskNo\n";
+    print "Usage: $Name0 [--debug] [--log-only] [--help] JobId StepNo TaskNo\n";
     exit $Usage;
 }
 
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index b2071cd..aa529a2 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -54,9 +54,10 @@ sub Debug(@)
   print STDERR @_ if ($Debug);
 }
 
+my $LogOnly;
 sub Error(@)
 {
-  Debug("$Name0:error: ", @_);
+  print STDERR "$Name0:error: ", @_ if (!$LogOnly);
   LogMsg @_;
 }
 
@@ -88,6 +89,10 @@ while (@ARGV)
   {
     $Debug = 1;
   }
+  elsif ($Arg eq "--log-only")
+  {
+    $LogOnly = 1;
+  }
   elsif ($Arg =~ /^(?:-\?|-h|--help)$/)
   {
     $Usage = 0;
@@ -130,7 +135,7 @@ if (!defined $Usage)
 }
 if (defined $Usage)
 {
-    print "Usage: $Name0 [--debug] [--help] JobId StepNo TaskNo\n";
+    print "Usage: $Name0 [--debug] [--log-only] [--help] JobId StepNo TaskNo\n";
     exit $Usage;
 }
 
diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl
index 2328b31..fc0bcf3 100755
--- a/testbot/bin/WineRunTask.pl
+++ b/testbot/bin/WineRunTask.pl
@@ -53,9 +53,10 @@ sub Debug(@)
   print STDERR @_ if ($Debug);
 }
 
+my $LogOnly;
 sub Error(@)
 {
-  Debug("$Name0:error: ", @_);
+  print STDERR "$Name0:error: ", @_ if (!$LogOnly);
   LogMsg @_;
 }
 
@@ -113,6 +114,10 @@ while (@ARGV)
   {
     $Debug = 1;
   }
+  elsif ($Arg eq "--log-only")
+  {
+    $LogOnly = 1;
+  }
   elsif ($Arg =~ /^(?:-\?|-h|--help)$/)
   {
     $Usage = 0;
@@ -155,7 +160,7 @@ if (!defined $Usage)
 }
 if (defined $Usage)
 {
-    print "Usage: $Name0 [--debug] [--help] JobId StepNo TaskNo\n";
+    print "Usage: $Name0 [--debug] [--log-only] [--help] JobId StepNo TaskNo\n";
     exit $Usage;
 }
 
diff --git a/testbot/lib/WineTestBot/Tasks.pm b/testbot/lib/WineTestBot/Tasks.pm
index 520d403..b4298fb 100644
--- a/testbot/lib/WineTestBot/Tasks.pm
+++ b/testbot/lib/WineTestBot/Tasks.pm
@@ -128,7 +128,7 @@ sub Run($$)
     }
     $ENV{PATH} = "/usr/bin:/bin";
     delete $ENV{ENV};
-    exec("$BinDir/${ProjectName}$RunScript", $JobId, $StepNo, $TaskNo) or
+    exec("$BinDir/${ProjectName}$RunScript", "--log-only", $JobId, $StepNo, $TaskNo) or
     require WineTestBot::Log;
     WineTestBot::Log::LogMsg("Unable to exec ${ProjectName}$RunScript: $!\n");
     exit(1);
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index 1c6cdd7..af052d9 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -276,7 +276,7 @@ sub RunRevert($)
     delete $ENV{ENV};
     require WineTestBot::Log;
     WineTestBot::Log::SetupRedirects();
-    exec("$BinDir/LibvirtTool.pl", "revert", $self->GetKey()) or
+    exec("$BinDir/LibvirtTool.pl", "--log-only", "revert", $self->GetKey()) or
     WineTestBot::Log::LogMsg("Unable to exec LibvirtTool.pl: $!\n");
     exit(1);
   }




More information about the wine-cvs mailing list