Shut down all of our test databases, make room for future of five at once (!)
authorGreg Sabino Mullane <[email protected]>
Fri, 12 Jun 2009 21:35:15 +0000 (17:35 -0400)
committerGreg Sabino Mullane <[email protected]>
Fri, 12 Jun 2009 21:35:15 +0000 (17:35 -0400)
t/99_cleanup.t
t/CP_Testing.pm

index c86274f97657fd15c15713c33132e6c6d36294ae..54bb707e3d63b19eac1bc26e03bed0208f846e74 100644 (file)
@@ -16,6 +16,6 @@ my $cp = CP_Testing->new();
 
 $cp->cleanup();
 
-pass 'Test database has been shut down';
+pass 'Test database(s) shut down';
 
 exit;
index b4672287a000a1a2e3a292deea767ba57b951ded..5638cb1d1353946954d9b3e798c6128969cce541 100644 (file)
@@ -36,18 +36,22 @@ sub cleanup {
 
        my $self = shift;
        my $dbdir = $self->{dbdir} or die;
-       my $pidfile = "$dbdir/data space/postmaster.pid";
-       return if ! -e $pidfile;
-       open my $fh, '<', $pidfile or die qq{Could not open "$pidfile": $!\n};
-       <$fh> =~ /^(\d+)/ or die qq{File "$pidfile" did not start with a number!\n};
-       my $pid = $1;
-       close $fh or die qq{Could not close "$pidfile": $!\n};
-       kill 15 => $pid;
-       sleep 1;
-       if (kill 0 => $pid) {
-               kill 9 => $pid;
+       for my $dirnum ('', '2', '3', '4', '5') {
+               my $pidfile = "$dbdir$dirnum/data space/postmaster.pid";
+               next if ! -e $pidfile;
+               open my $fh, '<', $pidfile or die qq{Could not open "$pidfile": $!\n};
+               <$fh> =~ /^(\d+)/ or die qq{File "$pidfile" did not start with a number!\n};
+               my $pid = $1;
+               close $fh or die qq{Could not close "$pidfile": $!\n};
+               kill 15 => $pid;
+               sleep 1;
+               if (kill 0 => $pid) {
+                       kill 9 => $pid;
+               }
        }
+
        return;
+
 }
 
 sub test_database_handle {