Francois Gouget : testbot/VMs: Make sure only one process uses a VM at a time.

Alexandre Julliard julliard at winehq.org
Thu Sep 12 16:27:53 CDT 2019


Module: tools
Branch: master
Commit: c0c486a133f12a95af29a759692a38988ed123b7
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=c0c486a133f12a95af29a759692a38988ed123b7

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Sep 11 17:02:37 2019 +0200

testbot/VMs: Make sure only one process uses a VM at a time.

The TestBot should already be respecting that rule.
But starting a process to operate on a VM always goes through VM::Run()
so enforce this rule by checking that the VM's ChildPid field is not
already set before starting a new process.

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

---

 testbot/lib/WineTestBot/VMs.pm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index 78e066f..2bf3504 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -154,6 +154,7 @@ use WineTestBot::LibvirtDomain;
 use WineTestBot::Missions;
 use WineTestBot::RecordGroups;
 use WineTestBot::TestAgent;
+use WineTestBot::Utils;
 
 
 sub _initialize($$)
@@ -374,9 +375,16 @@ sub OnSaved($)
 sub Run($$$$$$)
 {
   my ($self, $NewStatus, $Args, $ChildTimeout, $ChildSetup, $SetupData) = @_;
-
   my $Tool = basename($Args->[0]);
 
+  if (defined $self->ChildPid)
+  {
+    my $ErrMessage = "Cannot run ". ShArgv2Cmd(@$Args) ." because the ". $self->ChildPid ." process is already using the ". $self->Name ." VM";
+    require WineTestBot::Log;
+    WineTestBot::Log::LogMsg("$ErrMessage\n");
+    return $ErrMessage;
+  }
+
   # There are two $VM->ChildPid race conditions to avoid:
   # - Between the child process and new calls to ScheduleJobs().
   #   We cannot leave setting ChildPid to the child process because then it




More information about the wine-cvs mailing list