Make it possible for .test suites to run "mysql_upgrade"

Add new test file mysql_upgrade.test
parent 1ebb9dbd
......@@ -546,7 +546,7 @@ int main(int argc, char **argv)
}
if (find_file(mysqlcheck_name, basedir, MYF(0), path, sizeof(path),
"bin", NullS))
"bin", "client", NullS))
{
ret= 1;
printf("Can't find program '%s'\n", mysqlcheck_name);
......@@ -583,7 +583,7 @@ int main(int argc, char **argv)
fix_priv_tables:
if (find_file(mysql_name, basedir, MYF(0), path, sizeof(path),
"bin", NullS))
"bin", "client", NullS))
{
ret= 1;
puts("Could not find MySQL command-line client (mysql).\n"
......
This diff is collapsed.
......@@ -142,6 +142,7 @@ our $opt_verbose= 0; # Verbose output, enable with --verbose
our $exe_master_mysqld;
our $exe_mysql;
our $exe_mysqladmin;
our $exe_mysql_upgrade;
our $exe_mysqlbinlog;
our $exe_mysql_client_test;
our $exe_mysqld;
......@@ -1403,7 +1404,15 @@ sub executable_setup () {
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
if ( $mysql_version_id >= 50100 )
{
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
}
if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
{
$exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
}
else
{
$exe_mysql_upgrade= "";
}
if ( ! $glob_win32 )
......@@ -1444,13 +1453,13 @@ sub executable_setup () {
if ( $glob_use_embedded_server )
{
$exe_mysqltest=
mtr_exe_exists(vs_config_dirs('libmysqld/examples', 'mysqltest_embedded'),
"$glob_basedir/libmysqld/examples/mysqltest_embedded",
mtr_exe_exists(vs_config_dirs('libmysqld/examples','mysqltest_embedded'),
"$glob_basedir/libmysqld/examples/mysqltest_embedded",
"$path_client_bindir/mysqltest_embedded");
}
else
{
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
}
# Look for mysql_client_test executable which may _not_ exist in
......@@ -1467,7 +1476,7 @@ sub executable_setup () {
$exe_mysql_client_test=
mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'),
"$glob_basedir/tests/mysql_client_test",
"$glob_basedir/bin");
"$glob_basedir/bin/mysql_client_test");
}
}
......@@ -1529,6 +1538,33 @@ sub mysql_client_test_arguments()
return join(" ", $exe, @$args);
}
sub mysql_upgrade_arguments()
{
my $exe= $exe_mysql_upgrade;
my $args;
mtr_init_args(\$args);
# if ( $opt_valgrind_mysql_ugrade )
# {
# valgrind_arguments($args, \$exe);
# }
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--user=root");
mtr_add_arg($args, "--port=$master->[0]->{'port'}");
mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
mtr_add_arg($args, "--datadir=$master->[0]->{'path_myddir'}");
mtr_add_arg($args, "--basedir=$glob_basedir");
if ( $opt_debug )
{
mtr_add_arg($args,
"--debug=d:t:A,$path_vardir_trace/log/mysql_upgrade.trace");
}
return join(" ", $exe, @$args);
}
# Note that some env is setup in spawn/run, in "mtr_process.pl"
sub environment_setup () {
......@@ -1788,6 +1824,14 @@ sub environment_setup () {
# ----------------------------------------------------
$ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
# ----------------------------------------------------
# Setup env so childs can execute mysql_upgrade
# ----------------------------------------------------
if ( $mysql_version_id >= 50000 )
{
$ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
}
# ----------------------------------------------------
# Setup env so childs can execute mysql_fix_system_tables
# ----------------------------------------------------
......
Run mysql_upgrade once
mysql.columns_priv OK
mysql.db OK
mysql.func OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.proc OK
mysql.procs_priv OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
@hadGrantPriv:=1
1
1
1
1
1
@hadShowDbPriv:=1
1
1
1
1
1
@hadCreateViewPriv:=1
1
1
1
1
1
@hadCreateRoutinePriv:=1
1
1
1
1
1
@hadCreateUserPriv:=1
1
1
1
1
1
Run it again - should say already completed
@hadGrantPriv:=1
1
1
1
1
1
@hadShowDbPriv:=1
1
1
1
1
1
@hadCreateViewPriv:=1
1
1
1
1
1
@hadCreateRoutinePriv:=1
1
1
1
1
1
@hadCreateUserPriv:=1
1
1
1
1
1
Force should run it regardless of wheter it's been run before
mysql.columns_priv OK
mysql.db OK
mysql.func OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.proc OK
mysql.procs_priv OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
@hadGrantPriv:=1
1
1
1
1
1
@hadShowDbPriv:=1
1
1
1
1
1
@hadCreateViewPriv:=1
1
1
1
1
1
@hadCreateRoutinePriv:=1
1
1
1
1
1
@hadCreateUserPriv:=1
1
1
1
1
1
# Only run test if "mysql_upgrade" is found
--require r/have_mysql_upgrade.inc
--disable_query_log
select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
--enable_query_log
#
# Basic test thta we can run mysql_upgrde and that it finds the
# expected binaries it uses.
#
--echo Run mysql_upgrade once
--exec $MYSQL_UPGRADE 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err
--echo Run it again - should say already completed
--exec $MYSQL_UPGRADE 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err
--echo Force should run it regardless of wheter it's been run before
--exec $MYSQL_UPGRADE --force 2> $MYSQLTEST_VARDIR/log/mysql_upgrade.err
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment