diff options
Diffstat (limited to 'client/mysqltest.c')
-rw-r--r-- | client/mysqltest.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index 561bc541c74..286de17a00e 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -80,12 +80,13 @@ enum { OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_CIPHER, OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL, OPT_SSL_VERIFY_SERVER_CERT, OPT_MAX_CONNECT_RETRIES, - OPT_MARK_PROGRESS, OPT_CHARSETS_DIR + OPT_MARK_PROGRESS, OPT_CHARSETS_DIR, OPT_LOG_DIR, OPT_DEBUG_INFO }; static int record= 0, opt_sleep= -1; static char *db= 0, *pass= 0; const char *user= 0, *host= 0, *unix_sock= 0, *opt_basedir= "./"; +const char *opt_logdir= ""; const char *opt_include= 0, *opt_charsets_dir; static int port= 0; static int opt_max_connect_retries; @@ -97,6 +98,7 @@ static my_bool sp_protocol= 0, sp_protocol_enabled= 0; static my_bool view_protocol= 0, view_protocol_enabled= 0; static my_bool cursor_protocol= 0, cursor_protocol_enabled= 0; static my_bool parsing_disabled= 0; +static my_bool info_flag; static my_bool display_result_vertically= FALSE, display_metadata= FALSE; static my_bool disable_query_log= 0, disable_result_log= 0; static my_bool disable_warnings= 0, disable_ps_warnings= 0; @@ -752,7 +754,7 @@ void die(const char *fmt, ...) /* Clean up and exit */ free_used_memory(); - my_end(MY_CHECK_ERROR); + my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); if (!silent) printf("not ok\n"); @@ -792,7 +794,7 @@ void abort_not_supported_test(const char *fmt, ...) /* Clean up and exit */ free_used_memory(); - my_end(MY_CHECK_ERROR); + my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); if (!silent) printf("skipped\n"); @@ -891,8 +893,8 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname) die(NullS); if (!eval_result && (uint) stat_info.st_size != ds->length) { - DBUG_PRINT("info",("Size differs: result size: %u file size: %llu", - ds->length, stat_info.st_size)); + DBUG_PRINT("info",("Size differs: result size: %u file size: %lu", + ds->length, (ulong) stat_info.st_size)); DBUG_PRINT("info",("result: '%s'", ds->str)); DBUG_RETURN(RESULT_LENGTH_MISMATCH); } @@ -3075,14 +3077,14 @@ void do_connect(struct st_command *command) else if (!strncmp(con_options, "COMPRESS", 8)) con_compress= 1; else - die("Illegal option to connect: %.*s", end - con_options, con_options); + die("Illegal option to connect: %.*s", (int) (end - con_options), con_options); /* Process next option */ con_options= end; } if (next_con == connections_end) - die("Connection limit exhausted, you can have max %d connections", - (sizeof(connections)/sizeof(struct st_connection))); + die("Connection limit exhausted, you can have max %ld connections", + (long) (sizeof(connections)/sizeof(struct st_connection))); if (find_connection_by_name(ds_connection_name.str)) die("Connection %s already exists", ds_connection_name.str); @@ -3800,12 +3802,16 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (gptr*) &info_flag, + (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", (gptr*) &host, (gptr*) &host, 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}, + {"logdir", OPT_LOG_DIR, "Directory for log files", (gptr*) &opt_logdir, + (gptr*) &opt_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"mark-progress", OPT_MARK_PROGRESS, - "Write linenumber and elapsed time to <testname>.progress ", + "Write linenumber and elapsed time to <testname>.progress", (gptr*) &opt_mark_progress, (gptr*) &opt_mark_progress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"max-connect-retries", OPT_MAX_CONNECT_RETRIES, @@ -4086,7 +4092,8 @@ void dump_result_to_reject_file(char *buf, int size) void dump_result_to_log_file(char *buf, int size) { char log_file[FN_REFLEN]; - str_to_file(fn_format(log_file, result_file_name, "", ".log", + str_to_file(fn_format(log_file, result_file_name, opt_logdir, ".log", + *opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT: MY_REPLACE_EXT), buf, size); } @@ -4094,8 +4101,9 @@ void dump_result_to_log_file(char *buf, int size) void dump_progress(void) { char log_file[FN_REFLEN]; - str_to_file(fn_format(log_file, result_file_name, "", ".progress", - MY_REPLACE_EXT), + str_to_file(fn_format(log_file, result_file_name, opt_logdir, ".progress", + *opt_logdir ? MY_REPLACE_DIR | MY_REPLACE_EXT: + MY_REPLACE_EXT), ds_progress.str, ds_progress.length); } @@ -5910,7 +5918,7 @@ int main(int argc, char **argv) timer_output(); free_used_memory(); - my_end(MY_CHECK_ERROR); + my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); /* Yes, if we got this far the test has suceeded! Sakila smiles */ if (!silent) |