summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authormsvensson@neptunus.(none) <>2006-11-13 13:39:49 +0100
committermsvensson@neptunus.(none) <>2006-11-13 13:39:49 +0100
commit5110d91ec34b877a8302ad76797f61188534a48d (patch)
tree0d8c6ce9a29ace8f6948b48b345f627ad5a46a7b /mysql-test
parent1ebb9dbd038daf5238598be547497dce8e8e6ad8 (diff)
downloadmariadb-git-5110d91ec34b877a8302ad76797f61188534a48d.tar.gz
Make it possible for .test suites to run "mysql_upgrade"
Add new test file mysql_upgrade.test
Diffstat (limited to 'mysql-test')
-rwxr-xr-xmysql-test/mysql-test-run.pl54
-rw-r--r--mysql-test/r/mysql_upgrade.result127
-rw-r--r--mysql-test/t/mysql_upgrade.test20
3 files changed, 196 insertions, 5 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index ba9f788494a..5b8df86d73a 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -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 () {
@@ -1789,6 +1825,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
# ----------------------------------------------------
if ( ! $glob_win32 )
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
new file mode 100644
index 00000000000..1f93d727561
--- /dev/null
+++ b/mysql-test/r/mysql_upgrade.result
@@ -0,0 +1,127 @@
+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
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
new file mode 100644
index 00000000000..50d316a0767
--- /dev/null
+++ b/mysql-test/t/mysql_upgrade.test
@@ -0,0 +1,20 @@
+# 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
+
+