Commit e4fe90bf authored by unknown's avatar unknown

Merge neptunus.(none):/home/msvensson/mysql/mysql-4.1

into  neptunus.(none):/home/msvensson/mysql/fix_mysqltest/my41-fix_mysqltest


client/mysqltest.c:
  Manual merge
mysql-test/mysql-test-run.pl:
  patch alredy commited
parents ab7ec7ee b9ace625
...@@ -585,7 +585,8 @@ static void die(const char *fmt, ...) ...@@ -585,7 +585,8 @@ static void die(const char *fmt, ...)
if (cur_file && cur_file != file_stack) if (cur_file && cur_file != file_stack)
fprintf(stderr, "In included file \"%s\": ", fprintf(stderr, "In included file \"%s\": ",
cur_file->file_name); 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); vfprintf(stderr, fmt, args);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fflush(stderr); fflush(stderr);
...@@ -618,7 +619,9 @@ static void verbose_msg(const char *fmt, ...) ...@@ -618,7 +619,9 @@ static void verbose_msg(const char *fmt, ...)
va_start(args, 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); vfprintf(stderr, fmt, args);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
va_end(args); va_end(args);
...@@ -1068,8 +1071,8 @@ static void do_exec(struct st_query *query) ...@@ -1068,8 +1071,8 @@ static void do_exec(struct st_query *query)
(query->expected_errno[i].code.errnum == status)) (query->expected_errno[i].code.errnum == status))
{ {
ok= 1; ok= 1;
verbose_msg("command \"%s\" failed with expected error: %d", DBUG_PRINT("info", ("command \"%s\" failed with expected error: %d",
cmd, status); cmd, status));
} }
} }
if (!ok) if (!ok)
...@@ -1354,9 +1357,7 @@ int do_sync_with_master2(long offset) ...@@ -1354,9 +1357,7 @@ int do_sync_with_master2(long offset)
int rpl_parse; int rpl_parse;
if (!master_pos.file[0]) if (!master_pos.file[0])
{ die("Calling 'sync_with_master' without calling 'save_master_pos'");
die("Line %u: Calling 'sync_with_master' without calling 'save_master_pos'", start_lineno);
}
rpl_parse= mysql_rpl_parse_enabled(mysql); rpl_parse= mysql_rpl_parse_enabled(mysql);
mysql_disable_rpl_parse(mysql); mysql_disable_rpl_parse(mysql);
...@@ -1366,14 +1367,13 @@ int do_sync_with_master2(long offset) ...@@ -1366,14 +1367,13 @@ int do_sync_with_master2(long offset)
wait_for_position: wait_for_position:
if (mysql_query(mysql, query_buf)) if (mysql_query(mysql, query_buf))
die("line %u: failed in %s: %d: %s", start_lineno, query_buf, die("failed in %s: %d: %s", query_buf, mysql_errno(mysql),
mysql_errno(mysql), mysql_error(mysql)); mysql_error(mysql));
if (!(last_result= res= mysql_store_result(mysql))) if (!(last_result= res= mysql_store_result(mysql)))
die("line %u: mysql_store_result() returned NULL for '%s'", start_lineno, die("mysql_store_result() returned NULL for '%s'", query_buf);
query_buf);
if (!(row= mysql_fetch_row(res))) 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]) if (!row[0])
{ {
/* /*
...@@ -1381,10 +1381,7 @@ int do_sync_with_master2(long offset) ...@@ -1381,10 +1381,7 @@ int do_sync_with_master2(long offset)
SLAVE has been issued ? SLAVE has been issued ?
*/ */
if (tries++ == 3) if (tries++ == 3)
{ die("could not sync with master ('%s' returned NULL)", query_buf);
die("line %u: could not sync with master ('%s' returned NULL)",
start_lineno, query_buf);
}
sleep(1); /* So at most we will wait 3 seconds and make 4 tries */ sleep(1); /* So at most we will wait 3 seconds and make 4 tries */
mysql_free_result(res); mysql_free_result(res);
goto wait_for_position; goto wait_for_position;
...@@ -1430,10 +1427,9 @@ int do_save_master_pos() ...@@ -1430,10 +1427,9 @@ int do_save_master_pos()
mysql_errno(mysql), mysql_error(mysql)); mysql_errno(mysql), mysql_error(mysql));
if (!(last_result =res = mysql_store_result(mysql))) if (!(last_result =res = mysql_store_result(mysql)))
die("line %u: mysql_store_result() retuned NULL for '%s'", start_lineno, die("mysql_store_result() retuned NULL for '%s'", query);
query);
if (!(row = mysql_fetch_row(res))) 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); strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1);
master_pos.pos = strtoul(row[1], (char**) 0, 10); master_pos.pos = strtoul(row[1], (char**) 0, 10);
mysql_free_result(res); last_result=0; mysql_free_result(res); last_result=0;
...@@ -2571,7 +2567,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -2571,7 +2567,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
fn_format(buff, argument, "", "", 4); fn_format(buff, argument, "", "", 4);
DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0); DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0);
if (!(cur_file->file= 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); die("Could not open %s: errno = %d", buff, errno);
cur_file->file_name= my_strdup(buff, MYF(MY_FAE)); cur_file->file_name= my_strdup(buff, MYF(MY_FAE));
break; break;
...@@ -2677,7 +2673,7 @@ void str_to_file(const char *fname, char *str, int size) ...@@ -2677,7 +2673,7 @@ void str_to_file(const char *fname, char *str, int size)
fname=buff; fname=buff;
} }
fn_format(buff,fname,"","",4); fn_format(buff,fname,"","",4);
if ((fd = my_open(buff, O_WRONLY | O_CREAT | O_TRUNC, if ((fd = my_open(buff, O_WRONLY | O_CREAT | O_TRUNC,
MYF(MY_WME | MY_FFNF))) < 0) MYF(MY_WME | MY_FFNF))) < 0)
die("Could not open %s: errno = %d", buff, errno); die("Could not open %s: errno = %d", buff, errno);
...@@ -4074,12 +4070,20 @@ int main(int argc, char **argv) ...@@ -4074,12 +4070,20 @@ int main(int argc, char **argv)
if (res_info.st_size) if (res_info.st_size)
error|= (RESULT_CONTENT_MISMATCH | RESULT_LENGTH_MISMATCH); error|= (RESULT_CONTENT_MISMATCH | RESULT_LENGTH_MISMATCH);
} }
if (result_file && ds_res.length && !error) if (ds_res.length && !error)
{ {
if (!record) if (result_file)
error |= check_result(&ds_res, result_file, q->require_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 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); dynstr_free(&ds_res);
......
...@@ -2197,7 +2197,7 @@ sub run_mysqltest ($) { ...@@ -2197,7 +2197,7 @@ sub run_mysqltest ($) {
$ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args); $ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args);
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Add args that should not go into the MYSQL_TEST environment var # Add arguments that should not go into the MYSQL_TEST env var
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
mtr_add_arg($args, "-R"); mtr_add_arg($args, "-R");
......
...@@ -179,6 +179,7 @@ source database ...@@ -179,6 +179,7 @@ source database
echo message echo message echo message echo message
mysqltest: At line 1: Empty variable mysqltest: At line 1: Empty variable
mysqltest: At line 1: command "false" failed
mysqltest: At line 1: Missing argument in exec mysqltest: At line 1: Missing argument in exec
MySQL MySQL
"MySQL" "MySQL"
...@@ -300,6 +301,7 @@ mysqltest: At line 1: First argument to dec must be a variable (start with $) ...@@ -300,6 +301,7 @@ mysqltest: At line 1: First argument to dec must be a variable (start with $)
mysqltest: At line 1: End of line junk detected: "1000" mysqltest: At line 1: End of line junk detected: "1000"
mysqltest: At line 1: Missing arguments to system, nothing to do! mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: Missing arguments to system, nothing to do! mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: system command 'false' failed
test test
test2 test2
test3 test3
...@@ -343,6 +345,10 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 ...@@ -343,6 +345,10 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1
mysqltest: At line 1: Invalid integer argument "10!" mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: End of line junk detected: "!" mysqltest: At line 1: End of line junk detected: "!"
mysqltest: At line 1: Invalid integer argument "a" mysqltest: At line 1: Invalid integer argument "a"
Output from mysqltest-x.inc
Output from mysqltest-x.inc
Output from mysqltest-x.inc
mysqltest: Could not open ./non_existing_file.inc: errno = 2
failing_statement; failing_statement;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1
failing_statement; failing_statement;
......
...@@ -426,9 +426,8 @@ echo ; ...@@ -426,9 +426,8 @@ echo ;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Illegal use of exec # Illegal use of exec
# Disabled, some shells prints the failed command regardless of pipes --error 1
#--error 1 --exec echo "--exec false" | $MYSQL_TEST 2>&1
#--exec echo "--exec ';' 2> /dev/null" | $MYSQL_TEST 2>&1
--error 1 --error 1
--exec echo "--exec " | $MYSQL_TEST 2>&1 --exec echo "--exec " | $MYSQL_TEST 2>&1
...@@ -675,9 +674,8 @@ system echo "hej" > /dev/null; ...@@ -675,9 +674,8 @@ system echo "hej" > /dev/null;
--exec echo "system;" | $MYSQL_TEST 2>&1 --exec echo "system;" | $MYSQL_TEST 2>&1
--error 1 --error 1
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1 --exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
# Disabled, some shells prints the failed command regardless of pipes --error 1
#--error 1 --exec echo "system false;" | $MYSQL_TEST 2>&1
#--exec echo "system NonExistsinfComamdn 2> /dev/null;" | $MYSQL_TEST 2>&1
--disable_abort_on_error --disable_abort_on_error
system NonExistsinfComamdn; system NonExistsinfComamdn;
...@@ -812,11 +810,11 @@ select "a" as col1, "c" as col2; ...@@ -812,11 +810,11 @@ select "a" as col1, "c" as col2;
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# -x <file_name>, use the file specified after -x as the test file # -x <file_name>, use the file specified after -x as the test file
#--exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1 --exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc
#--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1 --exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc
#--exec $MYSQL_TEST --result_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc 2>&1 --exec $MYSQL_TEST --test_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc
#--error 1 --error 1
#--exec $MYSQL_TEST -x non_existing_file.inc 2>&1 --exec $MYSQL_TEST -x non_existing_file.inc 2>&1
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
......
...@@ -127,11 +127,23 @@ my_bool my_init(void) ...@@ -127,11 +127,23 @@ my_bool my_init(void)
void my_end(int infoflag) void my_end(int infoflag)
{ {
FILE *info_file; /*
if (!(info_file=DBUG_FILE)) this code is suboptimal to workaround a bug in
info_file=stderr; Sun CC: Sun C++ 5.6 2004/06/02 for x86, and should not be
DBUG_PRINT("info",("Shutting down")); optimized until this compiler is not in use anymore
if (infoflag & MY_CHECK_ERROR || info_file != stderr) */
FILE *info_file= DBUG_FILE;
my_bool print_info= (info_file != stderr);
DBUG_ENTER("my_end");
if (!info_file)
{
info_file= stderr;
print_info= 0;
}
DBUG_PRINT("info",("Shutting down: print_info: %d", print_info));
if ((infoflag & MY_CHECK_ERROR) || print_info)
{ /* Test if some file is left open */ { /* Test if some file is left open */
if (my_file_opened | my_stream_opened) if (my_file_opened | my_stream_opened)
{ {
...@@ -141,7 +153,8 @@ void my_end(int infoflag) ...@@ -141,7 +153,8 @@ void my_end(int infoflag)
} }
} }
my_once_free(); my_once_free();
if (infoflag & MY_GIVE_INFO || info_file != stderr)
if ((infoflag & MY_GIVE_INFO) || print_info)
{ {
#ifdef HAVE_GETRUSAGE #ifdef HAVE_GETRUSAGE
struct rusage rus; struct rusage rus;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment