mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 02:34:19 +00:00
Stabilize t/lib/Daemon.t. Add PerconaTest::get_cmd_pid().
This commit is contained in:
@@ -819,6 +819,20 @@ sub tables_used {
|
||||
return [ sort keys %tables ];
|
||||
}
|
||||
|
||||
sub get_cmd_pid {
|
||||
my $cmd = shift;
|
||||
$cmd =~ s/\./\\./g;
|
||||
$cmd =~ s/-/\\-/g;
|
||||
my $output = `ps wx | grep -v grep | grep '$cmd'`;
|
||||
my @cmds = $output =~ m/\n/g;
|
||||
if ( @cmds > 1 ) {
|
||||
die "Found " . scalar @cmds . " commands matching '$cmd': @cmds";
|
||||
}
|
||||
my ($pid) = $output =~ m/^\s*(\d+)/;
|
||||
return wantarray ? ($pid, $output) : $pid;
|
||||
}
|
||||
|
||||
|
||||
sub can_load_data {
|
||||
my $output = `/tmp/12345/use -e "SELECT * FROM percona_test.load_data" 2>/dev/null`;
|
||||
return ($output || '') =~ /1/;
|
||||
|
Reference in New Issue
Block a user