Commit 0120bac7 authored by kent@mysql.com's avatar kent@mysql.com

mysql-test-run.pl:

  Added --restart-cleanup option
drop-on-restart.inc:
  DROP commands to cleanup on restart
  new file
mysqltest.c:
  Added option --include=<sql-file>
parent a50023d7
...@@ -157,6 +157,7 @@ static uint global_expected_errors; ...@@ -157,6 +157,7 @@ static uint global_expected_errors;
static int record = 0, opt_sleep=0; static int record = 0, opt_sleep=0;
static char *db = 0, *pass=0; static char *db = 0, *pass=0;
const char *user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./"; const char *user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./";
const char *opt_include= 0;
static int port = 0; static int port = 0;
static my_bool opt_big_test= 0, opt_compress= 0, silent= 0, verbose = 0; static my_bool opt_big_test= 0, opt_compress= 0, silent= 0, verbose = 0;
static my_bool tty_password= 0; static my_bool tty_password= 0;
...@@ -3117,6 +3118,8 @@ static struct my_option my_long_options[] = ...@@ -3117,6 +3118,8 @@ static struct my_option my_long_options[] =
#endif #endif
{"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0, {"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"include", 'i', "Include SQL before each test case.", (gptr*) &opt_include,
(gptr*) &opt_include, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"manager-host", OPT_MANAGER_HOST, "Undocumented: Used for debugging.", {"manager-host", OPT_MANAGER_HOST, "Undocumented: Used for debugging.",
(gptr*) &manager_host, (gptr*) &manager_host, 0, GET_STR, REQUIRED_ARG, (gptr*) &manager_host, (gptr*) &manager_host, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
...@@ -4924,6 +4927,11 @@ int main(int argc, char **argv) ...@@ -4924,6 +4927,11 @@ int main(int argc, char **argv)
*/ */
var_set_errno(-1); var_set_errno(-1);
if (opt_include)
{
open_file(opt_include);
}
while (!abort_flag && !read_query(&q)) while (!abort_flag && !read_query(&q))
{ {
int current_line_inc = 1, processed = 0; int current_line_inc = 1, processed = 0;
......
This diff is collapsed.
...@@ -143,6 +143,7 @@ our $glob_use_running_server= 0; ...@@ -143,6 +143,7 @@ our $glob_use_running_server= 0;
our $glob_use_running_ndbcluster= 0; our $glob_use_running_ndbcluster= 0;
our $glob_use_running_ndbcluster_slave= 0; our $glob_use_running_ndbcluster_slave= 0;
our $glob_use_embedded_server= 0; our $glob_use_embedded_server= 0;
our $glob_mysqld_restart= 0;
our @glob_test_mode; our @glob_test_mode;
our $using_ndbcluster_master= 0; our $using_ndbcluster_master= 0;
...@@ -162,6 +163,7 @@ our $path_mysqltest_log; ...@@ -162,6 +163,7 @@ our $path_mysqltest_log;
our $path_my_basedir; our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line our $opt_vardir; # A path but set directly on cmd line
our $opt_tmpdir; # A path but set directly on cmd line our $opt_tmpdir; # A path but set directly on cmd line
our $opt_restart_cleanup; # Source a file with SQL drop statements
our $opt_usage; our $opt_usage;
our $opt_suite; our $opt_suite;
...@@ -626,14 +628,15 @@ sub command_line_setup () { ...@@ -626,14 +628,15 @@ sub command_line_setup () {
# Misc # Misc
'big-test' => \$opt_big_test, 'big-test' => \$opt_big_test,
'comment=s' => \$opt_comment,
'debug' => \$opt_debug, 'debug' => \$opt_debug,
'fast' => \$opt_fast, 'fast' => \$opt_fast,
'comment=s' => \$opt_comment,
'local' => \$opt_local, 'local' => \$opt_local,
'local-master' => \$opt_local_master, 'local-master' => \$opt_local_master,
'netware' => \$opt_netware, 'netware' => \$opt_netware,
'old-master' => \$opt_old_master, 'old-master' => \$opt_old_master,
'reorder' => \$opt_reorder, 'reorder' => \$opt_reorder,
'restart-cleanup' => \$opt_restart_cleanup,
'script-debug' => \$opt_script_debug, 'script-debug' => \$opt_script_debug,
'sleep=i' => \$opt_sleep, 'sleep=i' => \$opt_sleep,
'socket=s' => \$opt_socket, 'socket=s' => \$opt_socket,
...@@ -2242,6 +2245,7 @@ sub report_failure_and_restart ($) { ...@@ -2242,6 +2245,7 @@ sub report_failure_and_restart ($) {
{ {
stop_masters_slaves(); stop_masters_slaves();
} }
$glob_mysqld_restart= 1;
print "Resuming Tests\n\n"; print "Resuming Tests\n\n";
} }
...@@ -3063,6 +3067,12 @@ sub run_mysqltest ($) { ...@@ -3063,6 +3067,12 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--sleep=%d", $opt_sleep); mtr_add_arg($args, "--sleep=%d", $opt_sleep);
} }
if ( $opt_restart_cleanup and $glob_mysqld_restart )
{
mtr_add_arg($args, "--include=%s", "include/drop-on-restart.inc");
$glob_mysqld_restart= 0;
}
if ( $opt_debug ) if ( $opt_debug )
{ {
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir); mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir);
......
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