mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug #43603 mysqltest command disable_abort_on_error does not affect all built-in commands
After disable_abort_on_error, behaved as if --error was in effect Add condition before die, as after queries
This commit is contained in:
@ -1081,8 +1081,9 @@ void handle_command_error(struct st_command *command, uint error)
|
|||||||
command->first_word_len, command->query, error));
|
command->first_word_len, command->query, error));
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
die("command \"%.*s\" failed with wrong error: %d",
|
if (command->expected_errors.count > 0)
|
||||||
command->first_word_len, command->query, error);
|
die("command \"%.*s\" failed with wrong error: %d",
|
||||||
|
command->first_word_len, command->query, error);
|
||||||
}
|
}
|
||||||
else if (command->expected_errors.err[0].type == ERR_ERRNO &&
|
else if (command->expected_errors.err[0].type == ERR_ERRNO &&
|
||||||
command->expected_errors.err[0].code.errnum != 0)
|
command->expected_errors.err[0].code.errnum != 0)
|
||||||
@ -1352,14 +1353,14 @@ void log_msg(const char *fmt, ...)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void cat_file(DYNAMIC_STRING* ds, const char* filename)
|
int cat_file(DYNAMIC_STRING* ds, const char* filename)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
size_t len;
|
size_t len;
|
||||||
char buff[512];
|
char buff[512];
|
||||||
|
|
||||||
if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
|
if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
|
||||||
die("Failed to open file '%s'", filename);
|
return 1;
|
||||||
while((len= my_read(fd, (uchar*)&buff,
|
while((len= my_read(fd, (uchar*)&buff,
|
||||||
sizeof(buff), MYF(0))) > 0)
|
sizeof(buff), MYF(0))) > 0)
|
||||||
{
|
{
|
||||||
@ -1383,6 +1384,7 @@ void cat_file(DYNAMIC_STRING* ds, const char* filename)
|
|||||||
dynstr_append_mem(ds, start, p-start);
|
dynstr_append_mem(ds, start, p-start);
|
||||||
}
|
}
|
||||||
my_close(fd, MYF(0));
|
my_close(fd, MYF(0));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2722,8 +2724,9 @@ void do_exec(struct st_command *command)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynstr_free(&ds_cmd);
|
dynstr_free(&ds_cmd);
|
||||||
die("command \"%s\" failed with wrong error: %d",
|
if (command->expected_errors.count > 0)
|
||||||
command->first_argument, status);
|
die("command \"%s\" failed with wrong error: %d",
|
||||||
|
command->first_argument, status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (command->expected_errors.err[0].type == ERR_ERRNO &&
|
else if (command->expected_errors.err[0].type == ERR_ERRNO &&
|
||||||
@ -3498,6 +3501,7 @@ void do_append_file(struct st_command *command)
|
|||||||
|
|
||||||
void do_cat_file(struct st_command *command)
|
void do_cat_file(struct st_command *command)
|
||||||
{
|
{
|
||||||
|
int error;
|
||||||
static DYNAMIC_STRING ds_filename;
|
static DYNAMIC_STRING ds_filename;
|
||||||
const struct command_arg cat_file_args[] = {
|
const struct command_arg cat_file_args[] = {
|
||||||
{ "filename", ARG_STRING, TRUE, &ds_filename, "File to read from" }
|
{ "filename", ARG_STRING, TRUE, &ds_filename, "File to read from" }
|
||||||
@ -3512,8 +3516,8 @@ void do_cat_file(struct st_command *command)
|
|||||||
|
|
||||||
DBUG_PRINT("info", ("Reading from, file: %s", ds_filename.str));
|
DBUG_PRINT("info", ("Reading from, file: %s", ds_filename.str));
|
||||||
|
|
||||||
cat_file(&ds_res, ds_filename.str);
|
error= cat_file(&ds_res, ds_filename.str);
|
||||||
|
handle_command_error(command, error);
|
||||||
dynstr_free(&ds_filename);
|
dynstr_free(&ds_filename);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
@ -572,7 +572,7 @@ if things work as expected
|
|||||||
Some data
|
Some data
|
||||||
for cat_file command
|
for cat_file command
|
||||||
of mysqltest
|
of mysqltest
|
||||||
mysqltest: At line 1: Failed to open file 'non_existing_file'
|
mysqltest: At line 1: command "cat_file" failed with error 1
|
||||||
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
|
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
|
||||||
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
|
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
|
||||||
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
|
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
|
||||||
|
@ -325,6 +325,15 @@ eval select $mysql_errno as "after_!errno_masked_error" ;
|
|||||||
--error 1
|
--error 1
|
||||||
--exec echo "disable_abort_on_error; error 1000; select 3 from t1; error 1000; select 3 from t1;" | $MYSQL_TEST 2>&1
|
--exec echo "disable_abort_on_error; error 1000; select 3 from t1; error 1000; select 3 from t1;" | $MYSQL_TEST 2>&1
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Check some non-query statements that would fail
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
--exec illegal_command
|
||||||
|
--cat_file does_not_exist
|
||||||
|
--perl
|
||||||
|
exit(1);
|
||||||
|
EOF
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Switch the abort on error on and check the effect on $mysql_errno
|
# Switch the abort on error on and check the effect on $mysql_errno
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user