mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-12 06:00:14 +00:00
Fix lib tests for MySQL 5.0.
This commit is contained in:
@@ -467,9 +467,6 @@ rm_tmpdir() {
|
|||||||
|
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
CMD_PIDOF="$(which pidof)"
|
|
||||||
CMD_PGREP="$(which pgrep)"
|
|
||||||
|
|
||||||
_seq() {
|
_seq() {
|
||||||
local i="$1"
|
local i="$1"
|
||||||
awk "BEGIN { for(i=1; i<=$i; i++) print i; }"
|
awk "BEGIN { for(i=1; i<=$i; i++) print i; }"
|
||||||
@@ -629,7 +626,7 @@ collect() {
|
|||||||
local d="$1" # directory to save results in
|
local d="$1" # directory to save results in
|
||||||
local p="$2" # prefix for each result file
|
local p="$2" # prefix for each result file
|
||||||
|
|
||||||
local mysqld_pid=$(_pidof mysqld | head -n1)
|
local mysqld_pid=$(_pidof mysqld | awk '{print $1; exit;}')
|
||||||
|
|
||||||
if [ "$CMD_PMAP" -a "$mysqld_pid" ]; then
|
if [ "$CMD_PMAP" -a "$mysqld_pid" ]; then
|
||||||
if $CMD_PMAP --help 2>&1 | grep -- -x >/dev/null 2>&1 ; then
|
if $CMD_PMAP --help 2>&1 | grep -- -x >/dev/null 2>&1 ; then
|
||||||
|
@@ -45,7 +45,7 @@ collect() {
|
|||||||
local p="$2" # prefix for each result file
|
local p="$2" # prefix for each result file
|
||||||
|
|
||||||
# Get pidof mysqld.
|
# Get pidof mysqld.
|
||||||
local mysqld_pid=$(_pidof mysqld | head -n1)
|
local mysqld_pid=$(_pidof mysqld | awk '{print $1; exit;}')
|
||||||
|
|
||||||
# Get memory allocation info before anything else.
|
# Get memory allocation info before anything else.
|
||||||
if [ "$CMD_PMAP" -a "$mysqld_pid" ]; then
|
if [ "$CMD_PMAP" -a "$mysqld_pid" ]; then
|
||||||
|
21
t/lib/Cxn.t
21
t/lib/Cxn.t
@@ -83,11 +83,12 @@ test_var_val(
|
|||||||
test => 'Default wait_timeout',
|
test => 'Default wait_timeout',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
my $set_calls = 0;
|
||||||
my $cxn = make_cxn(
|
my $cxn = make_cxn(
|
||||||
dsn_string => 'h=127.1,P=12345,u=msandbox,p=msandbox',
|
dsn_string => 'h=127.1,P=12345,u=msandbox,p=msandbox',
|
||||||
set => sub {
|
set => sub {
|
||||||
my ($dbh) = @_;
|
my ($dbh) = @_;
|
||||||
$dbh->do("SET unique_checks=0");
|
$set_calls++;
|
||||||
$dbh->do("SET \@a := \@a + 1");
|
$dbh->do("SET \@a := \@a + 1");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -122,11 +123,10 @@ test_var_val(
|
|||||||
test => 'Sets --set-vars',
|
test => 'Sets --set-vars',
|
||||||
);
|
);
|
||||||
|
|
||||||
test_var_val(
|
is(
|
||||||
$cxn->dbh(),
|
$set_calls,
|
||||||
'unique_checks',
|
1,
|
||||||
'OFF',
|
'Calls set callback'
|
||||||
test => 'Calls set callback',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$cxn->dbh()->do("SET \@a := 1");
|
$cxn->dbh()->do("SET \@a := 1");
|
||||||
@@ -172,11 +172,10 @@ test_var_val(
|
|||||||
test => 'Reconnect sets --set-vars',
|
test => 'Reconnect sets --set-vars',
|
||||||
);
|
);
|
||||||
|
|
||||||
test_var_val(
|
is(
|
||||||
$cxn->dbh(),
|
$set_calls,
|
||||||
'unique_checks',
|
2,
|
||||||
'OFF',
|
'Reconnect calls set callback'
|
||||||
test => 'Reconnect calls set callback',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
test_var_val(
|
test_var_val(
|
||||||
|
@@ -41,7 +41,8 @@ SKIP: {
|
|||||||
ok(
|
ok(
|
||||||
no_diff(
|
no_diff(
|
||||||
$tp->get_create_table($dbh, 'sakila', 'actor'),
|
$tp->get_create_table($dbh, 'sakila', 'actor'),
|
||||||
"$sample/sakila.actor",
|
$sandbox_version ge '5.1' ? "$sample/sakila.actor"
|
||||||
|
: "$sample/sakila.actor-5.0",
|
||||||
cmd_output => 1,
|
cmd_output => 1,
|
||||||
),
|
),
|
||||||
"get_create_table(sakila.actor)"
|
"get_create_table(sakila.actor)"
|
||||||
|
@@ -15,9 +15,10 @@ use PerconaTest;
|
|||||||
my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
|
my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
|
||||||
push @ARGV, "$trunk/t/lib/bash/*.sh" unless @ARGV;
|
push @ARGV, "$trunk/t/lib/bash/*.sh" unless @ARGV;
|
||||||
|
|
||||||
$ENV{BIN_DIR} = "$trunk/bin";
|
$ENV{BIN_DIR} = "$trunk/bin";
|
||||||
$ENV{LIB_DIR} = "$trunk/lib/bash";
|
$ENV{LIB_DIR} = "$trunk/lib/bash";
|
||||||
$ENV{T_LIB_DIR} = "$trunk/t/lib";
|
$ENV{T_LIB_DIR} = "$trunk/t/lib";
|
||||||
|
$ENV{SANDBOX_VERSION} = "$sandbox_version";
|
||||||
|
|
||||||
system("$trunk/util/test-bash-functions $trunk/t/lib/samples/bash/dummy.sh @ARGV");
|
system("$trunk/util/test-bash-functions $trunk/t/lib/samples/bash/dummy.sh @ARGV");
|
||||||
|
|
||||||
|
@@ -62,12 +62,16 @@ cmd_ok \
|
|||||||
"innodbstatus2"
|
"innodbstatus2"
|
||||||
|
|
||||||
cmd_ok \
|
cmd_ok \
|
||||||
"grep -q 'error log seems to be /tmp/12345/data/mysqld.log' $p-output" \
|
"grep -q 'error log seems to be .*/mysqld.log' $p-output" \
|
||||||
"Finds MySQL error log"
|
"Finds MySQL error log"
|
||||||
|
|
||||||
cmd_ok \
|
if [[ "$SANDBOX_VERSION" > "5.0" ]]; then
|
||||||
"grep -q 'Status information:' $p-log_error" \
|
cmd_ok \
|
||||||
"debug"
|
"grep -q 'Status information:' $p-log_error" \
|
||||||
|
"debug"
|
||||||
|
else
|
||||||
|
is "1" "1" "SKIP Can't determine MySQL 5.0 error log"
|
||||||
|
fi
|
||||||
|
|
||||||
cmd_ok \
|
cmd_ok \
|
||||||
"grep -q 'COMMAND[ ]\+PID[ ]\+USER' $p-lsof" \
|
"grep -q 'COMMAND[ ]\+PID[ ]\+USER' $p-lsof" \
|
||||||
|
@@ -37,7 +37,7 @@ CREATE TABLE `user` (
|
|||||||
`max_updates` int(11) unsigned NOT NULL default '0',
|
`max_updates` int(11) unsigned NOT NULL default '0',
|
||||||
`max_connections` int(11) unsigned NOT NULL default '0',
|
`max_connections` int(11) unsigned NOT NULL default '0',
|
||||||
`max_user_connections` int(11) unsigned NOT NULL default '0',
|
`max_user_connections` int(11) unsigned NOT NULL default '0',
|
||||||
PRIMARY KEY (`Host`,`User`)
|
PRIMARY KEY (`Host`,`User`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
|
||||||
|
|
||||||
|
|
||||||
|
8
t/lib/samples/tables/sakila.actor-5.0
Normal file
8
t/lib/samples/tables/sakila.actor-5.0
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
CREATE TABLE `actor` (
|
||||||
|
`actor_id` smallint(5) unsigned NOT NULL auto_increment,
|
||||||
|
`first_name` varchar(45) NOT NULL,
|
||||||
|
`last_name` varchar(45) NOT NULL,
|
||||||
|
`last_update` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`actor_id`),
|
||||||
|
KEY `idx_actor_last_name` (`last_name`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8
|
Reference in New Issue
Block a user