From 56f457b67f01a87c2828920040767d302f7b79cb Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 19 Sep 2005 12:24:59 +0200 Subject: Clean up printout of line numbers client/mysqltest.c: Only print line no if start_lineno > 0 Remove lineno in calls to verbose_msg and die, this is handled by the function. --- client/mysqltest.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'client/mysqltest.c') diff --git a/client/mysqltest.c b/client/mysqltest.c index 3e2cde92aa9..19c74629a55 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -610,7 +610,9 @@ static void verbose_msg(const char *fmt, ...) va_start(args, fmt); - fprintf(stderr, "mysqltest: At line %u: ", start_lineno); + fprintf(stderr, "mysqltest: "); + if (start_lineno > 0) + fprintf(stderr, "At line %u: ", start_lineno); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); va_end(args); @@ -1345,9 +1347,7 @@ int do_sync_with_master2(long offset) int rpl_parse; if (!master_pos.file[0]) - { - die("Line %u: Calling 'sync_with_master' without calling 'save_master_pos'", start_lineno); - } + die("Calling 'sync_with_master' without calling 'save_master_pos'"); rpl_parse= mysql_rpl_parse_enabled(mysql); mysql_disable_rpl_parse(mysql); @@ -1357,14 +1357,13 @@ int do_sync_with_master2(long offset) wait_for_position: if (mysql_query(mysql, query_buf)) - die("line %u: failed in %s: %d: %s", start_lineno, query_buf, - mysql_errno(mysql), mysql_error(mysql)); + die("failed in %s: %d: %s", query_buf, mysql_errno(mysql), + mysql_error(mysql)); if (!(last_result= res= mysql_store_result(mysql))) - die("line %u: mysql_store_result() returned NULL for '%s'", start_lineno, - query_buf); + die("mysql_store_result() returned NULL for '%s'", query_buf); if (!(row= mysql_fetch_row(res))) - die("line %u: empty result in %s", start_lineno, query_buf); + die("empty result in %s", query_buf); if (!row[0]) { /* @@ -1372,10 +1371,7 @@ wait_for_position: SLAVE has been issued ? */ if (tries++ == 3) - { - die("line %u: could not sync with master ('%s' returned NULL)", - start_lineno, query_buf); - } + die("could not sync with master ('%s' returned NULL)", query_buf); sleep(1); /* So at most we will wait 3 seconds and make 4 tries */ mysql_free_result(res); goto wait_for_position; @@ -1421,10 +1417,9 @@ int do_save_master_pos() mysql_errno(mysql), mysql_error(mysql)); if (!(last_result =res = mysql_store_result(mysql))) - die("line %u: mysql_store_result() retuned NULL for '%s'", start_lineno, - query); + die("mysql_store_result() retuned NULL for '%s'", query); if (!(row = mysql_fetch_row(res))) - die("line %u: empty result in show master status", start_lineno); + die("empty result in show master status"); strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1); master_pos.pos = strtoul(row[1], (char**) 0, 10); mysql_free_result(res); last_result=0; -- cgit v1.2.1 From 6bec4bc605961b7c8066a8d8e594dc60aabd5e75 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 20 Sep 2005 12:13:17 +0200 Subject: Improved output client/mysqltest.c: Don't print "At line: 0" --- client/mysqltest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'client/mysqltest.c') diff --git a/client/mysqltest.c b/client/mysqltest.c index 19c74629a55..1e04b41f35c 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -577,7 +577,8 @@ static void die(const char *fmt, ...) if (cur_file && cur_file != file_stack) fprintf(stderr, "In included file \"%s\": ", cur_file->file_name); - fprintf(stderr, "At line %u: ", start_lineno); + if (start_lineno != 0) + fprintf(stderr, "At line %u: ", start_lineno); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); fflush(stderr); -- cgit v1.2.1 From 0aee9b2c19b52be26e9a0dc67ae178ccfa70db35 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 20 Sep 2005 14:11:58 +0200 Subject: BUG#12959 mysqltest crashes if testcase passed with -x option - Enable testcases after help from Serg client/mysqltest.c: Dump output to stdout if no result file is specified Don't print verbose_msg when command fails whith expected error mysql-test/mysql-test-run.pl: Don't add all args to the MYSQL_TEST environment variable. mysql-test/r/mysqltest.result: Add test for mysqltest -x mysql-test/t/mysqltest.test: Add test for mysqltest -x --- client/mysqltest.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'client/mysqltest.c') diff --git a/client/mysqltest.c b/client/mysqltest.c index 1e04b41f35c..6963ff2f99e 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1062,8 +1062,8 @@ static void do_exec(struct st_query *query) (query->expected_errno[i].code.errnum == status)) { ok= 1; - verbose_msg("command \"%s\" failed with expected error: %d", - cmd, status); + DBUG_PRINT("info", ("command \"%s\" failed with expected error: %d", + cmd, status)); } } if (!ok) @@ -2557,7 +2557,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), fn_format(buff, argument, "", "", 4); DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0); if (!(cur_file->file= - my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(MY_WME)))) + my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0)))) die("Could not open %s: errno = %d", buff, errno); cur_file->file_name= my_strdup(buff, MYF(MY_FAE)); break; @@ -2663,7 +2663,7 @@ void str_to_file(const char *fname, char *str, int size) fname=buff; } fn_format(buff,fname,"","",4); - + if ((fd = my_open(buff, O_WRONLY | O_CREAT | O_TRUNC, MYF(MY_WME | MY_FFNF))) < 0) die("Could not open %s: errno = %d", buff, errno); @@ -4043,12 +4043,20 @@ int main(int argc, char **argv) parser.current_line += current_line_inc; } - if (result_file && ds_res.length && !error) + if (ds_res.length && !error) { - if (!record) - error |= check_result(&ds_res, result_file, q->require_file); + if (result_file) + { + if (!record) + error |= check_result(&ds_res, result_file, q->require_file); + else + str_to_file(result_file, ds_res.str, ds_res.length); + } else - str_to_file(result_file, ds_res.str, ds_res.length); + { + // Print the result to stdout + printf("%s", ds_res.str); + } } dynstr_free(&ds_res); -- cgit v1.2.1 From 3614cff71cc79b197863a968d385cb2cce1680fd Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 24 Sep 2005 02:42:38 +0200 Subject: Makefile.am: Revert to shell test script for test targets mysqltest.c: Windows pclose() returns error code in low byte mysql_config.sh: Remove -Xa -xstrconst from --cflags for Sun C++ scripts/mysql_config.sh: Remove -Xa -xstrconst from --cflags for Sun C++ client/mysqltest.c: Windows pclose() returns error code in low byte Makefile.am: Revert to shell test script for test targets --- client/mysqltest.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'client/mysqltest.c') diff --git a/client/mysqltest.c b/client/mysqltest.c index 1b8a0658cc7..a4fec7eb28c 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -64,7 +64,11 @@ #include #endif #ifndef WEXITSTATUS -# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +# ifdef __WIN__ +# define WEXITSTATUS(stat_val) (stat_val) +# else +# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +# endif #endif #define MAX_QUERY 131072 #define MAX_VAR_NAME 256 -- cgit v1.2.1