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 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

View File

@@ -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

View File

@@ -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(

View File

@@ -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)"

View File

@@ -18,6 +18,7 @@ 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");

View File

@@ -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
cmd_ok \
"grep -q 'Status information:' $p-log_error" \ "grep -q 'Status information:' $p-log_error" \
"debug" "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" \

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