Make ptc exit status 0, 255, or a bitmask of flags for various problems.

This commit is contained in:
Daniel Nichter
2013-10-03 11:32:11 -07:00
parent f6661ca658
commit cd29c0d7dc
5 changed files with 278 additions and 164 deletions

View File

@@ -123,7 +123,7 @@ $exit_status = pt_table_checksum::main(@args,
is(
$exit_status,
1,
512, # = TABLE_DIFF but nothing else; https://bugs.launchpad.net/percona-toolkit/+bug/944051
"--replicate-check on by default, detects diff"
);
@@ -297,7 +297,7 @@ is_deeply(
is(
$exit_status,
1,
2048,
"Non-zero exit status"
);
@@ -386,8 +386,8 @@ like(
is(
$exit_status,
1,
"Exit status 1 when no slaves are found (bug 1087804)"
8, # https://bugs.launchpad.net/percona-toolkit/+bug/944051
"Exit status 8 when no slaves are found (bug 1087804)"
) or diag($output);
# #############################################################################

View File

@@ -171,7 +171,7 @@ $output = output(sub {
is(
$exit_status,
0,
1024,
"Bad key_len chunks are not errors"
) or diag($output);

View File

@@ -153,7 +153,7 @@ like(
is(
$exit_status,
1,
2048, # https://bugs.launchpad.net/percona-toolkit/+bug/944051
"Non-zero exit status (bug 1009510)"
);

View File

@@ -26,9 +26,6 @@ if ( !$master_dbh ) {
elsif ( !$slave_dbh ) {
plan skip_all => 'Cannot connect to sandbox slave1';
}
else {
plan tests => 6;
}
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the tool will die.
@@ -116,19 +113,26 @@ like(
diag(`rm -rf $pid_file >/dev/null 2>&1`);
diag(`touch $pid_file`);
eval {
pt_table_checksum::main(@args, $cnf, '--pid', $pid_file);
};
$output = output(
sub { $exit_status = pt_table_checksum::main(@args, $cnf, '--pid', $pid_file) },
stderr => 1,
);
like(
$EVAL_ERROR,
qr/PID file $pid_file already exists/,
$output,
qr/PID file $pid_file exists/,
'Dies if PID file already exists (issue 391)'
);
is(
$exit_status,
4,
"Exit status 4 if if PID file already exist (bug 944051)"
);
diag(`rm -rf $pid_file >/dev/null 2>&1`);
# #############################################################################
# Done.
# #############################################################################
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
exit;
done_testing;