From 95fde8103274e2464cfb24111929a4df7ebb6451 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 3 Feb 2010 15:11:52 +0100 Subject: [PATCH 1/4] Bug #31602 mysql-test-run.pl seems to have problems with file names including spaces. Too complex/risky to try to fix Instead, detect the problem and communicate that this is not supported --- mysql-test/mysql-test-run.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a2ea36aa34e..2994df80bb1 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -946,6 +946,11 @@ sub command_line_setup { # Find the absolute path to the test directory $glob_mysql_test_dir= cwd(); + if ($glob_mysql_test_dir =~ / /) + { + die("Working directory \"$glob_mysql_test_dir\" contains space\n". + "Bailing out, cannot function properly with space in path"); + } if (IS_CYGWIN) { # Use mixed path format i.e c:/path/to/ From 0ad9a5992d0832b07beaa5326d4d53e36669184d Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 9 Feb 2010 18:13:57 +0100 Subject: [PATCH 2/4] Bug #50618 Please allow 'sleep $variable' in mtr Made mtr's sleep function understand $variables A few fixes since previous patch, added tests --- client/mysqltest.cc | 22 +++++++++++++++++----- mysql-test/r/mysqltest.result | 13 ++++++++----- mysql-test/t/mysqltest.test | 22 ++++++++++++++++++++++ 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index d2ee5855d26..539b5ccae5f 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -491,6 +491,8 @@ void free_replace(); void do_get_replace_regex(struct st_command *command); void free_replace_regex(); +/* Used by sleep */ +void check_eol_junk_line(const char *eol); void free_all_replace(){ free_replace(); @@ -1045,7 +1047,7 @@ void check_command_args(struct st_command *command, } /* Check for too many arguments passed */ ptr= command->last_argument; - while(ptr <= command->end) + while(ptr <= command->end && *ptr != '#') { if (*ptr && *ptr != ' ') die("Extra argument '%s' passed to '%.*s'", @@ -4211,10 +4213,19 @@ int do_disable_rpl_parse(struct st_command *command __attribute__((unused))) int do_sleep(struct st_command *command, my_bool real_sleep) { int error= 0; - char *p= command->first_argument; - char *sleep_start, *sleep_end= command->end; + char *sleep_start, *sleep_end; double sleep_val; + char *p; + static DYNAMIC_STRING ds_sleep; + const struct command_arg sleep_args[] = { + { "sleep_delay", ARG_STRING, TRUE, &ds_sleep, "Number of seconds to sleep." } + }; + check_command_args(command, command->first_argument, sleep_args, + sizeof(sleep_args)/sizeof(struct command_arg), + ' '); + p= ds_sleep.str; + sleep_end= ds_sleep.str + ds_sleep.length; while (my_isspace(charset_info, *p)) p++; if (!*p) @@ -4223,11 +4234,13 @@ int do_sleep(struct st_command *command, my_bool real_sleep) /* Check that arg starts with a digit, not handled by my_strtod */ if (!my_isdigit(charset_info, *sleep_start)) die("Invalid argument to %.*s \"%s\"", command->first_word_len, - command->query,command->first_argument); + command->query, sleep_start); sleep_val= my_strtod(sleep_start, &sleep_end, &error); + check_eol_junk_line(sleep_end); if (error) die("Invalid argument to %.*s \"%s\"", command->first_word_len, command->query, command->first_argument); + dynstr_free(&ds_sleep); /* Fixed sleep time selected by --sleep option */ if (opt_sleep >= 0 && !real_sleep) @@ -4236,7 +4249,6 @@ int do_sleep(struct st_command *command, my_bool real_sleep) DBUG_PRINT("info", ("sleep_val: %f", sleep_val)); if (sleep_val) my_sleep((ulong) (sleep_val * 1000000L)); - command->last_argument= sleep_end; return 0; } diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 79341b30f7a..67c08b0ae97 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -147,9 +147,10 @@ hello hello ;;;;;;;; # MySQL: -- The -mysqltest: At line 1: End of line junk detected: "6" -mysqltest: At line 1: End of line junk detected: "6" -mysqltest: At line 1: Missing delimiter +mysqltest: At line 1: Extra argument '6' passed to 'sleep' +mysqltest: At line 1: Extra argument '6' passed to 'sleep' +mysqltest: At line 1: Extra argument 'A comment +show status' passed to 'sleep' mysqltest: At line 1: End of line junk detected: "sleep 7 # Another comment " @@ -354,8 +355,10 @@ here is the sourced script here is the sourced script "hello" "hello" -mysqltest: At line 1: Missing argument to sleep -mysqltest: At line 1: Missing argument to real_sleep +mysqltest: At line 2: Invalid argument to sleep "xyz" +mysqltest: At line 2: Invalid argument to real_sleep "xyz" +mysqltest: At line 1: Missing required argument 'sleep_delay' to command 'sleep' +mysqltest: At line 1: Missing required argument 'sleep_delay' to command 'real_sleep' mysqltest: At line 1: Invalid argument to sleep "abc" mysqltest: At line 1: Invalid argument to real_sleep "abc" 1 diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 20b35d41515..25293ff29e7 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -920,6 +920,28 @@ sleep 0.5; sleep 1; real_sleep 1; +# Parameter from variable, legal and illegal +let $sleep_var= 0.1; +sleep $sleep_var; +let $sleep_var= 1; +--real_sleep $sleep_var + +--write_file $MYSQL_TMP_DIR/sleep.inc +let $sleep_var= xyz; +--sleep $sleep_var +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQL_TMP_DIR/sleep.inc 2>&1 +--remove_file $MYSQL_TMP_DIR/sleep.inc + +--write_file $MYSQL_TMP_DIR/sleep.inc +let $sleep_var= xyz; +real_sleep $sleep_var; +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQL_TMP_DIR/sleep.inc 2>&1 +--remove_file $MYSQL_TMP_DIR/sleep.inc + # Missing parameter --error 1 --exec echo "sleep ;" | $MYSQL_TEST 2>&1 From 2c026bdba08e99856ae21fd88fb071be49dcbd91 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 11 Feb 2010 11:22:07 +0100 Subject: [PATCH 3/4] Bug #47389 Innodb tests are skipped when running as unix root user Add --user=root to collect_mysqld_features() if running as root Please disregard previous commit; this is much simpler. --- mysql-test/mysql-test-run.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a2ea36aa34e..07797410188 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1482,6 +1482,12 @@ sub collect_mysqld_features { mtr_add_arg($args, "--verbose"); mtr_add_arg($args, "--help"); + # Need --user=root if running as *nix root user + if (!IS_WINDOWS and $> == 0) + { + mtr_add_arg($args, "--user=root"); + } + my $exe_mysqld= find_mysqld($basedir); my $cmd= join(" ", $exe_mysqld, @$args); my $list= `$cmd`; From 242f4dda3ae110ac51664b6ee49a2c9435cb6167 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 11 Feb 2010 14:26:58 +0100 Subject: [PATCH 4/4] renaming test variables+c to variables_community, + is problematic --- mysql-test/r/{variables+c.result => variables_community.result} | 0 mysql-test/t/{variables+c.test => variables_community.test} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename mysql-test/r/{variables+c.result => variables_community.result} (100%) rename mysql-test/t/{variables+c.test => variables_community.test} (100%) diff --git a/mysql-test/r/variables+c.result b/mysql-test/r/variables_community.result similarity index 100% rename from mysql-test/r/variables+c.result rename to mysql-test/r/variables_community.result diff --git a/mysql-test/t/variables+c.test b/mysql-test/t/variables_community.test similarity index 100% rename from mysql-test/t/variables+c.test rename to mysql-test/t/variables_community.test