Fix lib tests for MySQL 5.0.

This commit is contained in:
Daniel Nichter
2012-02-02 10:56:55 -07:00
parent 4d462bbbdd
commit c40e5db1bf
8 changed files with 35 additions and 25 deletions

View File

@@ -467,9 +467,6 @@ rm_tmpdir() {
set -u
CMD_PIDOF="$(which pidof)"
CMD_PGREP="$(which pgrep)"
_seq() {
local i="$1"
awk "BEGIN { for(i=1; i<=$i; i++) print i; }"
@@ -629,7 +626,7 @@ collect() {
local d="$1" # directory to save results in
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 --help 2>&1 | grep -- -x >/dev/null 2>&1 ; then

View File

@@ -45,7 +45,7 @@ collect() {
local p="$2" # prefix for each result file
# 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.
if [ "$CMD_PMAP" -a "$mysqld_pid" ]; then

View File

@@ -83,11 +83,12 @@ test_var_val(
test => 'Default wait_timeout',
);
my $set_calls = 0;
my $cxn = make_cxn(
dsn_string => 'h=127.1,P=12345,u=msandbox,p=msandbox',
set => sub {
my ($dbh) = @_;
$dbh->do("SET unique_checks=0");
$set_calls++;
$dbh->do("SET \@a := \@a + 1");
},
);
@@ -122,11 +123,10 @@ test_var_val(
test => 'Sets --set-vars',
);
test_var_val(
$cxn->dbh(),
'unique_checks',
'OFF',
test => 'Calls set callback',
is(
$set_calls,
1,
'Calls set callback'
);
$cxn->dbh()->do("SET \@a := 1");
@@ -172,11 +172,10 @@ test_var_val(
test => 'Reconnect sets --set-vars',
);
test_var_val(
$cxn->dbh(),
'unique_checks',
'OFF',
test => 'Reconnect calls set callback',
is(
$set_calls,
2,
'Reconnect calls set callback'
);
test_var_val(

View File

@@ -41,7 +41,8 @@ SKIP: {
ok(
no_diff(
$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,
),
"get_create_table(sakila.actor)"

View File

@@ -18,6 +18,7 @@ push @ARGV, "$trunk/t/lib/bash/*.sh" unless @ARGV;
$ENV{BIN_DIR} = "$trunk/bin";
$ENV{LIB_DIR} = "$trunk/lib/bash";
$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");

View File

@@ -62,12 +62,16 @@ cmd_ok \
"innodbstatus2"
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"
if [[ "$SANDBOX_VERSION" > "5.0" ]]; then
cmd_ok \
"grep -q 'Status information:' $p-log_error" \
"debug"
else
is "1" "1" "SKIP Can't determine MySQL 5.0 error log"
fi
cmd_ok \
"grep -q 'COMMAND[ ]\+PID[ ]\+USER' $p-lsof" \

View 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