summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsvensson@neptunus.(none) <>2006-10-19 13:34:09 +0200
committermsvensson@neptunus.(none) <>2006-10-19 13:34:09 +0200
commit9a5b4a115100086815267c51ba12998b9e5e7d19 (patch)
tree9d934ad80fdf9957b7cf4b19b3593ac251983d0f
parentf59ac964f41eb2269c9047587fd8061a0d117960 (diff)
downloadmariadb-git-9a5b4a115100086815267c51ba12998b9e5e7d19.tar.gz
Add command "exit" to mysqltest, it will stop processing any more
commands and go directly to result file processing
-rw-r--r--client/mysqltest.c13
-rw-r--r--mysql-test/r/mysqltest.result2
-rw-r--r--mysql-test/t/mysqltest.test14
3 files changed, 26 insertions, 3 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index efb5f1915f4..5bc132a874f 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -264,7 +264,7 @@ enum enum_commands {
Q_IF,
Q_DISABLE_PARSING, Q_ENABLE_PARSING,
Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST,
- Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE,
+ Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
@@ -345,6 +345,8 @@ const char *command_names[]=
"copy_file",
"perl",
"die",
+ /* Don't execute any more commands, compare result */
+ "exit",
0
};
@@ -5429,7 +5431,7 @@ void mark_progress(struct st_command* command __attribute__((unused)),
int main(int argc, char **argv)
{
struct st_command *command;
- my_bool q_send_flag= 0;
+ my_bool q_send_flag= 0, abort_flag= 0;
uint command_executed= 0, last_command_executed= 0;
char save_file[FN_REFLEN];
MY_STAT res_info;
@@ -5549,7 +5551,7 @@ int main(int argc, char **argv)
open_file(opt_include);
}
- while (!read_command(&command))
+ while (!read_command(&command) && !abort_flag)
{
int current_line_inc = 1, processed = 0;
if (command->type == Q_UNKNOWN || command->type == Q_COMMENT_WITH_COMMAND)
@@ -5777,8 +5779,13 @@ int main(int argc, char **argv)
die("Parsing is already enabled");
break;
case Q_DIE:
+ /* Abort test with error code and error message */
die("%s", command->first_argument);
break;
+ case Q_EXIT:
+ /* Stop processing any more commands */
+ abort_flag= 1;
+ break;
case Q_RESULT:
die("result, deprecated command");
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index ed7267fb71d..a63863977b0 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -518,4 +518,6 @@ hello
mysqltest: At line 1: Max delimiter length(16) exceeded
hello
hello
+mysqltest: At line 1: test of die
+Some output
End of tests
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index d98375ca746..3c20b38722f 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -1548,5 +1548,19 @@ perl;
print "hello\n";
EOF
+# ----------------------------------------------------------------------------
+# test for die
+# ----------------------------------------------------------------------------
+
+--error 1
+--exec echo "die test of die;" | $MYSQL_TEST 2>&1
+
+
+# ----------------------------------------------------------------------------
+# test for exit
+# ----------------------------------------------------------------------------
+
+--exec echo "echo Some output; exit; echo Not this;" | $MYSQL_TEST 2>&1
+
--echo End of tests