mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-27 16:12:04 +00:00
Fix pqd/read_time.t so it doesn't access non-existent pid files.
This commit is contained in:
@@ -22,8 +22,8 @@ use POSIX qw(mkfifo);
|
|||||||
my $pid_file = '/tmp/mqd.pid';
|
my $pid_file = '/tmp/mqd.pid';
|
||||||
my $fifo = '/tmp/mqd.fifo';
|
my $fifo = '/tmp/mqd.fifo';
|
||||||
|
|
||||||
unlink $pid_file if $pid_file;
|
unlink $pid_file if -f $pid_file;
|
||||||
unlink $fifo if $fifo;
|
unlink $fifo if -f $fifo;
|
||||||
|
|
||||||
my ($start, $end, $waited, $timeout);
|
my ($start, $end, $waited, $timeout);
|
||||||
SKIP: {
|
SKIP: {
|
||||||
@@ -53,7 +53,7 @@ SKIP: {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink $pid_file if $pid_file;
|
unlink $pid_file if -f $pid_file;
|
||||||
mkfifo $fifo, 0700;
|
mkfifo $fifo, 0700;
|
||||||
system("$trunk/t/pt-query-digest/samples/write-to-fifo.pl $fifo 4 &");
|
system("$trunk/t/pt-query-digest/samples/write-to-fifo.pl $fifo 4 &");
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ $timeout = wait_for(
|
|||||||
);
|
);
|
||||||
$end = time;
|
$end = time;
|
||||||
$waited = $end - $start;
|
$waited = $end - $start;
|
||||||
if ( $timeout && $pid_file ) {
|
if ( $timeout && -f $pid_file ) {
|
||||||
# mqd ran longer than --read-timeout
|
# mqd ran longer than --read-timeout
|
||||||
chomp(my $pid = slurp_file($pid_file));
|
chomp(my $pid = slurp_file($pid_file));
|
||||||
kill SIGTERM => $pid if $pid;
|
kill SIGTERM => $pid if $pid;
|
||||||
@@ -75,11 +75,11 @@ if ( $timeout && $pid_file ) {
|
|||||||
|
|
||||||
ok(
|
ok(
|
||||||
$waited >= 2 && int($waited) <= 4,
|
$waited >= 2 && int($waited) <= 4,
|
||||||
sprintf("--read-timeout waited %.1f seconds reading a file", $waited)
|
sprintf("--read-timeout 2 waited %.1f seconds reading a file", $waited)
|
||||||
);
|
);
|
||||||
|
|
||||||
unlink $pid_file if $pid_file;
|
unlink $pid_file if -f $pid_file;
|
||||||
unlink $fifo if $fifo;
|
unlink $fifo if -f $fifo;
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
|
Reference in New Issue
Block a user