mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-19 17:04:00 +00:00
Only run pt-ioprofile.t if the system has strace.
This commit is contained in:
@@ -19,24 +19,22 @@ use Sandbox;
|
|||||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||||
my $dbh = $sb->get_dbh_for('master');
|
my $dbh = $sb->get_dbh_for('master');
|
||||||
|
my $have_strace = `which strace 2>/dev/null`;
|
||||||
|
|
||||||
if ( !$dbh ) {
|
if ( !$dbh ) {
|
||||||
plan skip_all => "Cannot connect to master sandbox";
|
plan skip_all => "Cannot connect to master sandbox";
|
||||||
}
|
}
|
||||||
else {
|
elsif ( !$have_strace ) {
|
||||||
plan tests => 5;
|
plan skip_all => 'strace is not installed or not in PATH';
|
||||||
}
|
}
|
||||||
|
|
||||||
my $output = "";
|
my $output = `$trunk/bin/pt-ioprofile --help 2>&1`;
|
||||||
|
|
||||||
$output = `$trunk/bin/pt-ioprofile --help 2>&1`;
|
|
||||||
like(
|
like(
|
||||||
$output,
|
$output,
|
||||||
qr/--version/,
|
qr/--version/,
|
||||||
"--help"
|
"--help"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
my $t0 = time;
|
my $t0 = time;
|
||||||
$output = `$trunk/bin/pt-ioprofile --run-time 3 2>&1`;
|
$output = `$trunk/bin/pt-ioprofile --run-time 3 2>&1`;
|
||||||
my $t1 = time;
|
my $t1 = time;
|
||||||
@@ -47,17 +45,16 @@ like(
|
|||||||
"Runs without a file (bug 925778)"
|
"Runs without a file (bug 925778)"
|
||||||
);
|
);
|
||||||
|
|
||||||
TODO: {
|
# If the system is really slow, it may take a second to process the files
|
||||||
local $::TODO = "Timing-related test, may occasionally fail";
|
# and then clean up all the temp stuff. We'll give it a few seconds benefit
|
||||||
# If the system is really slow, it may take a second to process the files
|
# of the doubt.
|
||||||
# and then clean up all the temp stuff. We'll give it a few seconds benefit of the doubt.
|
cmp_ok(
|
||||||
cmp_ok(
|
int($t1 - $t0),
|
||||||
int($t1 - $t0),
|
'<=',
|
||||||
'<=',
|
6,
|
||||||
6,
|
"Runs for --run-time, more or less"
|
||||||
"Runs for --run-time, more or less"
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Short options.
|
# Short options.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
@@ -72,4 +69,4 @@ like(
|
|||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||||
exit;
|
done_testing;
|
||||||
|
Reference in New Issue
Block a user