Author: turnstep
Date: Wed Jun 11 19:46:44 2008
New Revision: 11414

Modified:
   DBD-Pg/trunk/t/dbdpg_test_setup.pl

Log:
Respect the postmaster.pid if present on restarts.


Modified: DBD-Pg/trunk/t/dbdpg_test_setup.pl
==============================================================================
--- DBD-Pg/trunk/t/dbdpg_test_setup.pl  (original)
+++ DBD-Pg/trunk/t/dbdpg_test_setup.pl  Wed Jun 11 19:46:44 2008
@@ -104,26 +104,32 @@
                                warn "Test directory $testdir has been removed, 
will recreate from scratch\n";
                        }
                        else {
-                               warn "Restarting test database $testdsn at 
$testdir\n";
-                               my $option = '';
-                               if ($^O !~ /Win32/) {
-                                       if (! -e 
"$test_database_dir/data/socket") {
-                                               mkdir 
"$test_database_dir/data/socket";
-                                       }
-                                       $option = q{-o '-k socket'};
-                               }
-                               my $COM = qq{$pg_ctl $option -l 
$testdir/dbdpg_test.logfile -D $testdir start};
-                               if ($su) {
-                                       $COM = qq{su -m $su -c "$COM"};
+                               if (-e 
"$test_database_dir/data/postmaster.pid") {
+                                       ## Assume it's up, and move on
                                }
-                               $info = '';
-                               eval { $info = qx{$COM}; };
-                               if ($@ or $info !~ /\w/) {
-                                       $@ = "Could not startup new database 
($@) ($info)";
-                                       return $helpconnect, $@, undef;
+                               else {
+
+                                       warn "Restarting test database $testdsn 
at $testdir\n";
+                                       my $option = '';
+                                       if ($^O !~ /Win32/) {
+                                               if (! -e 
"$test_database_dir/data/socket") {
+                                                       mkdir 
"$test_database_dir/data/socket";
+                                               }
+                                               $option = q{-o '-k socket'};
+                                       }
+                                       my $COM = qq{$pg_ctl $option -l 
$testdir/dbdpg_test.logfile -D $testdir start};
+                                       if ($su) {
+                                               $COM = qq{su -m $su -c "$COM"};
+                                       }
+                                       $info = '';
+                                       eval { $info = qx{$COM}; };
+                                       if ($@ or $info !~ /\w/) {
+                                               $@ = "Could not startup new 
database ($@) ($info)";
+                                               return $helpconnect, $@, undef;
+                                       }
+                                       ## Wait for it to startup and verify 
the connection
+                                       sleep 1;
                                }
-                               ## Wait for it to startup and verify the 
connection
-                               sleep 1;
                                my $loop = 1;
                          STARTUP: {
                                        eval {

Reply via email to