[Tools] testbot: Rename DBIBackEnd::PrepareForFork() to Close().

Francois Gouget fgouget at codeweavers.com
Mon Oct 2 20:26:36 CDT 2017


It can also be useful after the fork() and before the exec() so a more
generic name describing what it does is more appropriate.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/Engine.pl                 | 4 +++-
 testbot/lib/ObjectModel/DBIBackEnd.pm | 2 +-
 testbot/lib/WineTestBot/Tasks.pm      | 4 +++-
 testbot/lib/WineTestBot/VMs.pm        | 4 +++-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl
index 6dddc8f7..6a052778 100755
--- a/testbot/bin/Engine.pl
+++ b/testbot/bin/Engine.pl
@@ -280,7 +280,9 @@ sub HandleJobStatusChange($$$)
 
   if ($OldStatus eq "running" && $NewStatus ne "running")
   {
-    $ActiveBackEnds{'WineTestBot'}->PrepareForFork();
+    # Make sure the child process does not inherit the database connection
+    $ActiveBackEnds{'WineTestBot'}->Close();
+
     my $Pid = fork;
     if (!defined $Pid)
     {
diff --git a/testbot/lib/ObjectModel/DBIBackEnd.pm b/testbot/lib/ObjectModel/DBIBackEnd.pm
index d65182d0..4082a0ac 100644
--- a/testbot/lib/ObjectModel/DBIBackEnd.pm
+++ b/testbot/lib/ObjectModel/DBIBackEnd.pm
@@ -565,7 +565,7 @@ sub DeleteAll($$)
   return undef;
 }
 
-sub PrepareForFork($)
+sub Close($)
 {
   my ($self) = @_;
 
diff --git a/testbot/lib/WineTestBot/Tasks.pm b/testbot/lib/WineTestBot/Tasks.pm
index 900498a6..520d4030 100644
--- a/testbot/lib/WineTestBot/Tasks.pm
+++ b/testbot/lib/WineTestBot/Tasks.pm
@@ -99,7 +99,9 @@ sub Run($$)
     $RunScript = "RunTask.pl";
   }
 
-  $self->GetBackEnd()->PrepareForFork();
+  # Make sure the child process does not inherit the database connection
+  $self->GetBackEnd()->Close();
+
   my $Pid = fork;
   if (!defined $Pid)
   {
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index dafce67d..d6bb537a 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -516,7 +516,9 @@ sub RunRevert($)
   my ($ErrProperty, $ErrMessage) = $self->Save();
   return $ErrMessage if (defined $ErrMessage);
 
-  $self->GetBackEnd()->PrepareForFork();
+  # Make sure the child process does not inherit the database connection
+  $self->GetBackEnd()->Close();
+
   my $Pid = fork;
   if (!defined $Pid)
   {
-- 
2.14.1



More information about the wine-patches mailing list