[PATCH 2/2] testbot: Standardize logging in the job scheduler.

Francois Gouget fgouget at codeweavers.com
Tue May 8 06:04:16 CDT 2018


Generic WineTestBot modules such as Jobs are supposed to let higher
level layers handle the logging or errors. But since the job scheduler
is part of the Engine it can log errors itself.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/WineTestBot/Engine/Scheduler.pm | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/testbot/lib/WineTestBot/Engine/Scheduler.pm b/testbot/lib/WineTestBot/Engine/Scheduler.pm
index fbe160420..4eef3c95d 100644
--- a/testbot/lib/WineTestBot/Engine/Scheduler.pm
+++ b/testbot/lib/WineTestBot/Engine/Scheduler.pm
@@ -32,6 +32,7 @@ our @EXPORT = qw(ScheduleJobs CheckJobs);
 
 use WineTestBot::Config;
 use WineTestBot::Jobs;
+use WineTestBot::Log;
 use WineTestBot::RecordGroups;
 use WineTestBot::VMs;
 
@@ -306,8 +307,7 @@ sub _CheckAndClassifyVMs()
       }
       else
       {
-        require WineTestBot::Log;
-        WineTestBot::Log::LogMsg("Unexpected $VMKey status ". $VM->Status ."\n");
+        LogMsg "Unexpected $VMKey status ". $VM->Status ."\n";
         $FoundVMErrors = 1;
         # Don't interfere with this VM
         $Sched->{busyvms}->{$VMKey} = 1;
@@ -352,8 +352,7 @@ sub _CheckAndClassifyVMs()
       }
       elsif ($VM->Status ne "off")
       {
-        require WineTestBot::Log;
-        WineTestBot::Log::LogMsg("Unexpected $VMKey status ". $VM->Status ."\n");
+        LogMsg "Unexpected $VMKey status ". $VM->Status ."\n";
         $FoundVMErrors = 1;
         # Don't interfere with this VM
         $Sched->{busyvms}->{$VMKey} = 1;
@@ -738,8 +737,7 @@ sub _DumpHostCounters($$)
   my $HostKey = $VM->GetHost();
   my $PrettyHost = ($PrettyHostNames ? $PrettyHostNames->{$HostKey} : "") ||
                    $HostKey;
-  require WineTestBot::Log;
-  WineTestBot::Log::LogMsg("$PrettyHost:$Counters\n") if ($Counters);
+  LogMsg "$PrettyHost:$Counters\n" if ($Counters);
 
   $Host->{dumpedcounters} = 1;
 }
@@ -778,8 +776,7 @@ sub _DumpHostVMs($$$$)
   }
   my $PrettyHost = ($PrettyHostNames ? $PrettyHostNames->{$HostKey} : "") ||
                    $HostKey;
-  require WineTestBot::Log;
-  WineTestBot::Log::LogMsg("$PrettyHost: @VMInfo\n");
+  LogMsg "$PrettyHost: @VMInfo\n";
 
   $Host->{dumpedvms} = 1;
 }
-- 
2.17.0



More information about the wine-devel mailing list