Change a pt-slave-restart test to use 'ps x' instead of 'ps -eaf'

Turns out that the former is fairly more portable than the latter.
This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-06-03 16:25:05 -03:00
parent 3f1a2cf575
commit 7094879081

View File

@@ -43,7 +43,7 @@ like($output, qr/Table 'test.t' doesn't exist'/, 'It is busted');
# Start an instance # Start an instance
diag(`$trunk/bin/pt-slave-restart --max-sleep .25 -h 127.0.0.1 -P 12346 -u msandbox -p msandbox --daemonize --pid /tmp/pt-slave-restart.pid --log /tmp/pt-slave-restart.log`); diag(`$trunk/bin/pt-slave-restart --max-sleep .25 -h 127.0.0.1 -P 12346 -u msandbox -p msandbox --daemonize --pid /tmp/pt-slave-restart.pid --log /tmp/pt-slave-restart.log`);
$output = `ps -eaf | grep 'pt-slave-restart \-\-max\-sleep ' | grep -v grep | grep -v pt-slave-restart.t`; $output = `ps x | grep 'pt-slave-restart \-\-max\-sleep ' | grep -v grep | grep -v pt-slave-restart.t`;
like($output, qr/pt-slave-restart --max/, 'It lives'); like($output, qr/pt-slave-restart --max/, 'It lives');
unlike($output, qr/Table 'test.t' doesn't exist'/, 'It is not busted'); unlike($output, qr/Table 'test.t' doesn't exist'/, 'It is not busted');
@@ -51,7 +51,7 @@ unlike($output, qr/Table 'test.t' doesn't exist'/, 'It is not busted');
ok(-f '/tmp/pt-slave-restart.pid', 'PID file created'); ok(-f '/tmp/pt-slave-restart.pid', 'PID file created');
ok(-f '/tmp/pt-slave-restart.log', 'Log file created'); ok(-f '/tmp/pt-slave-restart.log', 'Log file created');
my ($pid) = $output =~ /^\s+\d+\s+(\d+)\s+/; my ($pid) = $output =~ /^\s*(\d+)\s+/;
$output = `cat /tmp/pt-slave-restart.pid`; $output = `cat /tmp/pt-slave-restart.pid`;
is($output, $pid, 'PID file has correct PID'); is($output, $pid, 'PID file has correct PID');