summaryrefslogtreecommitdiff
path: root/client/mysqltest.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/mysqltest.c')
-rw-r--r--client/mysqltest.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index ad5c3d6a5d1..a322b9119d7 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -81,12 +81,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;
@@ -98,6 +99,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;
@@ -355,7 +357,6 @@ const char *command_names[]=
"copy_file",
"perl",
"die",
-
/* Don't execute any more commands, compare result */
"exit",
"chmod",
@@ -818,7 +819,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");
@@ -858,7 +859,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");
@@ -3911,12 +3912,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,
@@ -4197,7 +4202,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);
}
@@ -4205,8 +4211,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);
}
@@ -6046,7 +6053,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)