mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Fix CMD_MYSQL and CMD_MYSQLDUMP in pt-mysql-summary so they can be specified on cmd line, then do so in pt-mysql-summary.t so mysqldump 5.6 is used with 5.6 because earlier versions don't work with MySQL 5.6.
This commit is contained in:
@@ -2236,8 +2236,10 @@ report_mysql_summary () {
|
|||||||
|
|
||||||
TOOL="pt-mysql-summary"
|
TOOL="pt-mysql-summary"
|
||||||
|
|
||||||
CMD_MYSQL="$(_which mysql)"
|
# These vars are declared earlier in the collect_mysql_info package,
|
||||||
CMD_MYSQLDUMP="$( _which mysqldump )"
|
# but if they're still undefined here, try to find them in PATH.
|
||||||
|
[ "$CMD_MYSQL" ] || CMD_MYSQL="$(_which mysql)"
|
||||||
|
[ "$CMD_MYSQLDUMP" ] || CMD_MYSQLDUMP="$( _which mysqldump )"
|
||||||
|
|
||||||
check_mysql () {
|
check_mysql () {
|
||||||
# Check that mysql and mysqldump are in PATH. If not, we're
|
# Check that mysql and mysqldump are in PATH. If not, we're
|
||||||
|
@@ -14,18 +14,23 @@ use PerconaTest;
|
|||||||
|
|
||||||
my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
|
my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
|
||||||
|
|
||||||
use Test::More tests => 7;
|
use Test::More;
|
||||||
use File::Temp qw( tempdir );
|
use File::Temp qw( tempdir );
|
||||||
|
|
||||||
local $ENV{PTDEBUG} = "";
|
local $ENV{PTDEBUG} = "";
|
||||||
|
|
||||||
|
# mysqldump from earlier versions doesn't seem to work with 5.6,
|
||||||
|
# so use the actual mysqldump from each MySQL bin which should
|
||||||
|
# always be compatible with itself.
|
||||||
|
my $env = qq\CMD_MYSQLDUMP="$ENV{PERCONA_TOOLKIT_SANDBOX}/bin/mysqldump"\;
|
||||||
|
|
||||||
#
|
#
|
||||||
# --save-samples
|
# --save-samples
|
||||||
#
|
#
|
||||||
|
|
||||||
my $dir = tempdir( "percona-testXXXXXXXX", CLEANUP => 1 );
|
my $dir = tempdir( "percona-testXXXXXXXX", CLEANUP => 1 );
|
||||||
|
|
||||||
`$trunk/bin/$tool --sleep 1 --save-samples $dir -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
|
`$env $trunk/bin/$tool --sleep 1 --save-samples $dir -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
-e $dir,
|
-e $dir,
|
||||||
@@ -41,13 +46,13 @@ ok(
|
|||||||
"And leaves all files in there"
|
"And leaves all files in there"
|
||||||
) or diag($n_files, `ls -l $dir`);
|
) or diag($n_files, `ls -l $dir`);
|
||||||
|
|
||||||
undef($dir);
|
undef($dir); # rm the dir because CLEANUP => 1
|
||||||
|
|
||||||
#
|
#
|
||||||
# --databases
|
# --databases
|
||||||
#
|
#
|
||||||
|
|
||||||
my $out = `$trunk/bin/$tool --sleep 1 --databases mysql 2>/dev/null -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
|
my $out = `$env $trunk/bin/$tool --sleep 1 --databases mysql 2>/dev/null -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
|
||||||
|
|
||||||
like(
|
like(
|
||||||
$out,
|
$out,
|
||||||
@@ -61,7 +66,7 @@ for my $i (2..5) {
|
|||||||
no_diff(
|
no_diff(
|
||||||
sub {
|
sub {
|
||||||
local $ENV{_NO_FALSE_NEGATIVES} = 1;
|
local $ENV{_NO_FALSE_NEGATIVES} = 1;
|
||||||
print `$trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i -- --defaults-file=/tmp/12345/my.sandbox.cnf | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Skipping schema analysis/'`
|
print `$env $trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i -- --defaults-file=/tmp/12345/my.sandbox.cnf | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Skipping schema analysis/'`
|
||||||
},
|
},
|
||||||
"t/pt-mysql-summary/samples/expected_output_temp00$i.txt",
|
"t/pt-mysql-summary/samples/expected_output_temp00$i.txt",
|
||||||
),
|
),
|
||||||
@@ -69,4 +74,4 @@ for my $i (2..5) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit;
|
done_testing;
|
||||||
|
Reference in New Issue
Block a user