summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorBjorn Munch <Bjorn.Munch@sun.com>2010-02-11 14:33:21 +0100
committerBjorn Munch <Bjorn.Munch@sun.com>2010-02-11 14:33:21 +0100
commite6c93a4ef1d0f02f5074ba408a2f50102ad95c57 (patch)
tree1b834c7967ce15582e252bb02727962f569c84dc /client
parent66f33d13b83892993db02c1841ce22b403c4d953 (diff)
parent242f4dda3ae110ac51664b6ee49a2c9435cb6167 (diff)
downloadmariadb-git-e6c93a4ef1d0f02f5074ba408a2f50102ad95c57.tar.gz
upmerge 31602,47389,50618
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 80e7521c6ae..686dee131b0 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -489,6 +489,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();
@@ -1035,7 +1037,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'",
@@ -4173,10 +4175,19 @@ void do_let(struct st_command *command)
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)
@@ -4185,11 +4196,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)
@@ -4198,7 +4211,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;
}