Loading client/mysqltest.c +26 −24 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD, The list of error codes to --error are stored in an internal array of structs. This struct can hold numeric SQL error codes or SQLSTATE codes as strings. The element next to the last active element in the list is set to type ERR_EMPTY. When an SQL statement return an error we use set to type ERR_EMPTY. When an SQL statement returns an error, we use this list to check if this is an expected error. */ Loading Loading @@ -345,13 +345,6 @@ const char *command_names[]= "connection", "query", "connect", /* the difference between sleep and real_sleep is that sleep will use the delay from command line (--sleep) if there is one. real_sleep always uses delay from mysqltest's command line argument. the logic is that sometimes delays are cpu-dependent (and --sleep can be used to set this delay. real_sleep is used for cpu-independent delays */ "sleep", "real_sleep", "inc", Loading Loading @@ -1045,8 +1038,8 @@ int do_source(struct st_query *query) *p++= 0; query->last_argument= p; /* If this file has already been sourced, dont source it again. It's already available in the q_lines cache If this file has already been sourced, don't source it again. It's already available in the q_lines cache. */ if (parser.current_line < (parser.read_lines - 1)) return 0; Loading Loading @@ -1370,7 +1363,7 @@ int do_modify_var(struct st_query *query, const char *name, system <command> Eval the query to expand any $variables in the command. Execute the command withe the "system" command. Execute the command with the "system" command. NOTE If mysqltest is executed from cygwin shell, the command will be Loading Loading @@ -1633,11 +1626,19 @@ int do_disable_rpl_parse(struct st_query *query __attribute__((unused))) do_sleep() q called command real_sleep use the value from opt_sleep as number of seconds to sleep if real_sleep is false DESCRIPTION sleep <seconds> real_sleep real_sleep <seconds> The difference between the sleep and real_sleep commands is that sleep uses the delay from the --sleep command-line option if there is one. (If the --sleep option is not given, the sleep command uses the delay specified by its argument.) The real_sleep command always uses the delay specified by its argument. The logic is that sometimes delays are cpu-dependent, and --sleep can be used to set this delay. real_sleep is used for cpu-independent delays. */ int do_sleep(struct st_query *query, my_bool real_sleep) Loading @@ -1646,18 +1647,19 @@ int do_sleep(struct st_query *query, my_bool real_sleep) char *p= query->first_argument; char *sleep_start, *sleep_end= query->end; double sleep_val; char *cmd = (real_sleep ? "real_sleep" : "sleep"); while (my_isspace(charset_info, *p)) p++; if (!*p) die("Missing argument to sleep"); die("Missing argument to %s", cmd); sleep_start= p; /* Check that arg starts with a digit, not handled by my_strtod */ if (!my_isdigit(charset_info, *sleep_start)) die("Invalid argument to sleep \"%s\"", query->first_argument); die("Invalid argument to %s \"%s\"", cmd, query->first_argument); sleep_val= my_strtod(sleep_start, &sleep_end, &error); if (error) die("Invalid argument to sleep \"%s\"", query->first_argument); die("Invalid argument to %s \"%s\"", cmd, query->first_argument); /* Fixed sleep time selected by --sleep option */ if (opt_sleep && !real_sleep) Loading Loading @@ -2099,7 +2101,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user, /* Connect to a server and handle connection errors in case when they occur. Connect to a server and handle connection errors in case they occur. SYNOPSIS connect_n_handle_errors() Loading Loading @@ -2534,7 +2536,7 @@ my_bool end_of_query(int c) Normally that means it will read lines until it reaches the "delimiter" that marks end of query. Default delimiter is ';' The function should be smart enough not to detect delimiter's found inside strings sorrounded with '"' and '\'' escaped strings. found inside strings surrounded with '"' and '\'' escaped strings. If the first line in a query starts with '#' or '-' this line is treated as a comment. A comment is always terminated when end of line '\n' is Loading Loading @@ -2819,7 +2821,7 @@ static struct my_option my_long_options[] = {"compress", 'C', "Use the compressed server/client protocol.", (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statment", {"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.", (gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0, Loading Loading @@ -2861,7 +2863,7 @@ static struct my_option my_long_options[] = {"result-file", 'R', "Read/Store result from/in this file.", (gptr*) &result_file, (gptr*) &result_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"server-arg", 'A', "Send enbedded server this as a paramenter.", {"server-arg", 'A', "Send option value to embedded server as a parameter.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"server-file", 'F', "Read embedded server arguments from file.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, Loading Loading @@ -4315,7 +4317,7 @@ void get_query_type(struct st_query* q) q->type=(enum enum_commands) type; /* Found command */ /* If queries are disabled, only recognize --enable-queries and --disable-queries --enable_parsing and --disable_parsing */ if (parsing_disabled && q->type != Q_ENABLE_PARSING && q->type != Q_DISABLE_PARSING) Loading Loading @@ -4813,8 +4815,8 @@ int main(int argc, char **argv) /* my_stat() successful on result file. Check if we have not run a single query, but we do have a result file that contains data. Note that we don't care, if my_stat() fails. For example for non-existing or non-readable file we assume it's fine to have Note that we don't care, if my_stat() fails. For example, for a non-existing or non-readable file, we assume it's fine to have no query output from the test file, e.g. regarded as no error. */ die("No queries executed but result file found!"); Loading mysql-test/README +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ conflict with it. All tests must pass. If one or more of them fail on your system, please read the following manual section of how to report the problem: http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html You can create your own test cases. To create a test case: Loading mysql-test/mysql-test-run.sh +2 −2 Original line number Diff line number Diff line Loading @@ -894,7 +894,7 @@ show_failed_diff () $DIFF -c $result_file $reject_file echo "-------------------------------------------------------" echo "Please follow the instructions outlined at" echo "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html" echo "http://dev.mysql.com/doc/mysql/en/reporting-mysqltest-bugs.html" echo "to find the reason to this problem and how to report this." echo "" fi Loading Loading @@ -990,7 +990,7 @@ report_stats () { $ECHO "The log files in $MY_LOG_DIR may give you some hint" $ECHO "of what went wrong." $ECHO "If you want to report this error, please read first the documentation at" $ECHO "http://www.mysql.com/doc/en/MySQL_test_suite.html" $ECHO "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html" fi if [ $USE_RUNNING_SERVER -eq 0 ] Loading mysql-test/r/mysqltest.result +2 −0 Original line number Diff line number Diff line Loading @@ -297,7 +297,9 @@ here is the sourced script In loop here is the sourced script mysqltest: At line 1: Missing argument to sleep mysqltest: At line 1: Missing argument to real_sleep mysqltest: At line 1: Invalid argument to sleep "abc" mysqltest: At line 1: Invalid argument to real_sleep "abc" 1 2 101 Loading mysql-test/t/mysqltest.test +4 −0 Original line number Diff line number Diff line Loading @@ -667,10 +667,14 @@ real_sleep 1; # Missing parameter --error 1 --exec echo "sleep ;" | $MYSQL_TEST 2>&1 --error 1 --exec echo "real_sleep ;" | $MYSQL_TEST 2>&1 # Illegal parameter --error 1 --exec echo "sleep abc;" | $MYSQL_TEST 2>&1 --error 1 --exec echo "real_sleep abc;" | $MYSQL_TEST 2>&1 # ---------------------------------------------------------------------------- # Test inc Loading Loading
client/mysqltest.c +26 −24 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD, The list of error codes to --error are stored in an internal array of structs. This struct can hold numeric SQL error codes or SQLSTATE codes as strings. The element next to the last active element in the list is set to type ERR_EMPTY. When an SQL statement return an error we use set to type ERR_EMPTY. When an SQL statement returns an error, we use this list to check if this is an expected error. */ Loading Loading @@ -345,13 +345,6 @@ const char *command_names[]= "connection", "query", "connect", /* the difference between sleep and real_sleep is that sleep will use the delay from command line (--sleep) if there is one. real_sleep always uses delay from mysqltest's command line argument. the logic is that sometimes delays are cpu-dependent (and --sleep can be used to set this delay. real_sleep is used for cpu-independent delays */ "sleep", "real_sleep", "inc", Loading Loading @@ -1045,8 +1038,8 @@ int do_source(struct st_query *query) *p++= 0; query->last_argument= p; /* If this file has already been sourced, dont source it again. It's already available in the q_lines cache If this file has already been sourced, don't source it again. It's already available in the q_lines cache. */ if (parser.current_line < (parser.read_lines - 1)) return 0; Loading Loading @@ -1370,7 +1363,7 @@ int do_modify_var(struct st_query *query, const char *name, system <command> Eval the query to expand any $variables in the command. Execute the command withe the "system" command. Execute the command with the "system" command. NOTE If mysqltest is executed from cygwin shell, the command will be Loading Loading @@ -1633,11 +1626,19 @@ int do_disable_rpl_parse(struct st_query *query __attribute__((unused))) do_sleep() q called command real_sleep use the value from opt_sleep as number of seconds to sleep if real_sleep is false DESCRIPTION sleep <seconds> real_sleep real_sleep <seconds> The difference between the sleep and real_sleep commands is that sleep uses the delay from the --sleep command-line option if there is one. (If the --sleep option is not given, the sleep command uses the delay specified by its argument.) The real_sleep command always uses the delay specified by its argument. The logic is that sometimes delays are cpu-dependent, and --sleep can be used to set this delay. real_sleep is used for cpu-independent delays. */ int do_sleep(struct st_query *query, my_bool real_sleep) Loading @@ -1646,18 +1647,19 @@ int do_sleep(struct st_query *query, my_bool real_sleep) char *p= query->first_argument; char *sleep_start, *sleep_end= query->end; double sleep_val; char *cmd = (real_sleep ? "real_sleep" : "sleep"); while (my_isspace(charset_info, *p)) p++; if (!*p) die("Missing argument to sleep"); die("Missing argument to %s", cmd); sleep_start= p; /* Check that arg starts with a digit, not handled by my_strtod */ if (!my_isdigit(charset_info, *sleep_start)) die("Invalid argument to sleep \"%s\"", query->first_argument); die("Invalid argument to %s \"%s\"", cmd, query->first_argument); sleep_val= my_strtod(sleep_start, &sleep_end, &error); if (error) die("Invalid argument to sleep \"%s\"", query->first_argument); die("Invalid argument to %s \"%s\"", cmd, query->first_argument); /* Fixed sleep time selected by --sleep option */ if (opt_sleep && !real_sleep) Loading Loading @@ -2099,7 +2101,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user, /* Connect to a server and handle connection errors in case when they occur. Connect to a server and handle connection errors in case they occur. SYNOPSIS connect_n_handle_errors() Loading Loading @@ -2534,7 +2536,7 @@ my_bool end_of_query(int c) Normally that means it will read lines until it reaches the "delimiter" that marks end of query. Default delimiter is ';' The function should be smart enough not to detect delimiter's found inside strings sorrounded with '"' and '\'' escaped strings. found inside strings surrounded with '"' and '\'' escaped strings. If the first line in a query starts with '#' or '-' this line is treated as a comment. A comment is always terminated when end of line '\n' is Loading Loading @@ -2819,7 +2821,7 @@ static struct my_option my_long_options[] = {"compress", 'C', "Use the compressed server/client protocol.", (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statment", {"cursor-protocol", OPT_CURSOR_PROTOCOL, "Use cursors for prepared statements.", (gptr*) &cursor_protocol, (gptr*) &cursor_protocol, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"database", 'D', "Database to use.", (gptr*) &db, (gptr*) &db, 0, Loading Loading @@ -2861,7 +2863,7 @@ static struct my_option my_long_options[] = {"result-file", 'R', "Read/Store result from/in this file.", (gptr*) &result_file, (gptr*) &result_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"server-arg", 'A', "Send enbedded server this as a paramenter.", {"server-arg", 'A', "Send option value to embedded server as a parameter.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"server-file", 'F', "Read embedded server arguments from file.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, Loading Loading @@ -4315,7 +4317,7 @@ void get_query_type(struct st_query* q) q->type=(enum enum_commands) type; /* Found command */ /* If queries are disabled, only recognize --enable-queries and --disable-queries --enable_parsing and --disable_parsing */ if (parsing_disabled && q->type != Q_ENABLE_PARSING && q->type != Q_DISABLE_PARSING) Loading Loading @@ -4813,8 +4815,8 @@ int main(int argc, char **argv) /* my_stat() successful on result file. Check if we have not run a single query, but we do have a result file that contains data. Note that we don't care, if my_stat() fails. For example for non-existing or non-readable file we assume it's fine to have Note that we don't care, if my_stat() fails. For example, for a non-existing or non-readable file, we assume it's fine to have no query output from the test file, e.g. regarded as no error. */ die("No queries executed but result file found!"); Loading
mysql-test/README +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ conflict with it. All tests must pass. If one or more of them fail on your system, please read the following manual section of how to report the problem: http://dev.mysql.com/doc/mysql/en/MySQL_test_suite.html http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html You can create your own test cases. To create a test case: Loading
mysql-test/mysql-test-run.sh +2 −2 Original line number Diff line number Diff line Loading @@ -894,7 +894,7 @@ show_failed_diff () $DIFF -c $result_file $reject_file echo "-------------------------------------------------------" echo "Please follow the instructions outlined at" echo "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html" echo "http://dev.mysql.com/doc/mysql/en/reporting-mysqltest-bugs.html" echo "to find the reason to this problem and how to report this." echo "" fi Loading Loading @@ -990,7 +990,7 @@ report_stats () { $ECHO "The log files in $MY_LOG_DIR may give you some hint" $ECHO "of what went wrong." $ECHO "If you want to report this error, please read first the documentation at" $ECHO "http://www.mysql.com/doc/en/MySQL_test_suite.html" $ECHO "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html" fi if [ $USE_RUNNING_SERVER -eq 0 ] Loading
mysql-test/r/mysqltest.result +2 −0 Original line number Diff line number Diff line Loading @@ -297,7 +297,9 @@ here is the sourced script In loop here is the sourced script mysqltest: At line 1: Missing argument to sleep mysqltest: At line 1: Missing argument to real_sleep mysqltest: At line 1: Invalid argument to sleep "abc" mysqltest: At line 1: Invalid argument to real_sleep "abc" 1 2 101 Loading
mysql-test/t/mysqltest.test +4 −0 Original line number Diff line number Diff line Loading @@ -667,10 +667,14 @@ real_sleep 1; # Missing parameter --error 1 --exec echo "sleep ;" | $MYSQL_TEST 2>&1 --error 1 --exec echo "real_sleep ;" | $MYSQL_TEST 2>&1 # Illegal parameter --error 1 --exec echo "sleep abc;" | $MYSQL_TEST 2>&1 --error 1 --exec echo "real_sleep abc;" | $MYSQL_TEST 2>&1 # ---------------------------------------------------------------------------- # Test inc Loading