From 0c785d63b2c8157d81ea362b8644d646e244c67a Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Thu, 25 Aug 2011 11:44:56 -0600 Subject: [PATCH] Fix pt-index-usage/basics.t by fixing pt-heartbeat/standard_options.t. Make pt-kill/basics.t dump output if tests fail. --- t/pt-heartbeat/standard_options.t | 3 ++- t/pt-kill/basics.t | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/t/pt-heartbeat/standard_options.t b/t/pt-heartbeat/standard_options.t index 3a168dcd..8a459ce4 100644 --- a/t/pt-heartbeat/standard_options.t +++ b/t/pt-heartbeat/standard_options.t @@ -48,6 +48,7 @@ like( `rm -rf /tmp/mk-script.pid`; # ############################################################################# -# Done. +# Doe. # ############################################################################# +$sb->wipe_clean($dbh); exit; diff --git a/t/pt-kill/basics.t b/t/pt-kill/basics.t index 918bef1a..a82e199b 100644 --- a/t/pt-kill/basics.t +++ b/t/pt-kill/basics.t @@ -11,6 +11,8 @@ use warnings FATAL => 'all'; use English qw(-no_match_vars); use Test::More; +use Data::Dumper; + use PerconaTest; use Sandbox; require "$trunk/bin/pt-kill"; @@ -32,7 +34,7 @@ my $cmd = "$trunk/bin/pt-kill -F $cnf -h 127.1"; # Shell out to a sleep(10) query and try to capture the query. # Backticks don't work here. -system("/tmp/12345/use -h127.1 -P12345 -umsandbox -pmsandbox -e 'select sleep(5)' >/dev/null&"); +system("/tmp/12345/use -h127.1 -P12345 -umsandbox -pmsandbox -e 'select sleep(5)' >/dev/null &"); $output = `$cmd --busy-time 1s --print --run-time 10`; @@ -47,7 +49,10 @@ $output = `$cmd --busy-time 1s --print --run-time 10`; # 2009-05-27T22:19:47 KILL 5 (Query 8 sec) select sleep(10) # 2009-05-27T22:19:48 KILL 5 (Query 9 sec) select sleep(10) my @times = $output =~ m/\(Query (\d+) sec\)/g; -ok(@times > 2 && @times < 7, "There were 2 to 5 captures"); +ok( + @times > 2 && @times < 7, + "There were 2 to 5 captures" +) or print STDERR Dumper($output); # This is to catch a bad bug where there wasn't any sleep time when # --iterations was 0, and another bug when --run-time was not respected. @@ -56,7 +61,10 @@ ok(@times > 2 && @times < 7, "There were 2 to 5 captures"); system("/tmp/12345/use -h127.1 -P12345 -umsandbox -pmsandbox -e 'select sleep(10)' >/dev/null&"); $output = `$cmd --busy-time 1s --print --run-time 11s`; @times = $output =~ m/\(Query (\d+) sec\)/g; -ok(@times > 7 && @times < 12, 'Approximately 9 or 10 captures with --iterations 0'); +ok( + @times > 7 && @times < 12, + 'Approximately 9 or 10 captures with --iterations 0' +) or print STDERR Dumper($output); # ############################################################################