summaryrefslogtreecommitdiff
path: root/client/mysqltest.c
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)[msvensson]>2005-06-21 14:19:56 +0200
committerunknown <msvensson@neptunus.(none)[msvensson]>2005-06-21 14:19:56 +0200
commitc2a84d5fd2e3d86ab5dd75b13d6dac7a8a06256f (patch)
treed8556acd4bbbf311e8d7262e930b0f9c26e72381 /client/mysqltest.c
parent29397de1e01c22f76aedb3feb556fe43c5af155f (diff)
downloadmariadb-git-c2a84d5fd2e3d86ab5dd75b13d6dac7a8a06256f.tar.gz
patch
client/mysqldump.c: Add description of quote_for_like Add quoting of \ to \\\\ in quote_for_like Add DBUG_* Rearranged code in dump_selected_tables so the first thing it will do is to check that the tables to dump are available Unless --force is used, program will exit if not all specified tables can be found Add files to dump to HASH table for easy iteration Simpler handling of ignore_table list. Add new error code used when table user selected to dump can not be found in db client/mysqltest.c: Make it possible to exec a command that fails by setting --error <errno> before the command to exec. Check that the error returned from executed program matches the expected error. Add DBUG_* printouts mysql-test/mysql-test-run.sh: export MYSQL_DUMP_DIR used in "--replace_result" mysql-test/r/mysqldump.result: Added test for illegal / nonexisting table and database names mysql-test/t/mysqldump.test: Added test for illegal / nonexisting table and database names
Diffstat (limited to 'client/mysqltest.c')
-rw-r--r--client/mysqltest.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index e60d9ecd1c5..3c238b57a07 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -781,7 +781,7 @@ int var_set(const char *var_name, const char *var_name_end,
}
else
v = var_reg + digit;
- return eval_expr(v, var_val, (const char**)&var_val_end);
+ DBUG_RETURN(eval_expr(v, var_val, (const char**)&var_val_end));
}
@@ -955,9 +955,38 @@ static void do_exec(struct st_query* q)
replace_dynstr_append_mem(ds, buf, strlen(buf));
}
error= pclose(res_file);
-
if (error != 0)
- die("command \"%s\" failed", cmd);
+ {
+ uint status= WEXITSTATUS(error);
+ if(q->abort_on_error)
+ die("At line %u: command \"%s\" failed", start_lineno, cmd);
+ else
+ {
+ DBUG_PRINT("info",
+ ("error: %d, status: %d", error, status));
+ bool ok= 0;
+ uint i;
+ for (i=0 ; (uint) i < q->expected_errors ; i++)
+ {
+ DBUG_PRINT("info", ("expected error: %d", q->expected_errno[i].code.errnum));
+ if ((q->expected_errno[i].type == ERR_ERRNO) &&
+ (q->expected_errno[i].code.errnum == status))
+ ok= 1;
+ verbose_msg("At line %u: command \"%s\" failed with expected error: %d",
+ start_lineno, cmd, status);
+ }
+ if (!ok)
+ die("At line: %u: command \"%s\" failed with wrong error: %d",
+ start_lineno, cmd, status);
+ }
+ }
+ else if (q->expected_errno[0].type == ERR_ERRNO &&
+ q->expected_errno[0].code.errnum != 0)
+ {
+ /* Error code we wanted was != 0, i.e. not an expected success */
+ die("At line: %u: command \"%s\" succeeded - should have failed with errno %d...",
+ start_lineno, cmd, q->expected_errno[0].code.errnum);
+ }
if (!disable_result_log)
{