From 981dbd9071707b59559f9330bf6e89a3e11617ba Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Sat, 17 Jul 2010 22:53:57 -0400 Subject: [PATCH] Remove the test database directories when doing cleanup. --- t/98-cleanup.t | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/t/98-cleanup.t b/t/98-cleanup.t index 0f06fa30b..2a5d79aba 100644 --- a/t/98-cleanup.t +++ b/t/98-cleanup.t @@ -6,21 +6,24 @@ use 5.008003; use strict; use warnings; use Test::More tests => 2; +use File::Path 'rmtree'; opendir my $dh, '.' or die qq{Could not opendir?: $!\n}; for my $dir (readdir $dh) { next if $dir !~ /^bucardo_test_database_[A-Z]/ or ! -d $dir; my $pidfile = "$dir/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; + 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; + } } + rmtree($dir); } pass 'Test databases are shut down'; @@ -37,4 +40,4 @@ if (-d $dir) { pass "Removed directory $dir"; - +exit; -- 2.39.5