From c32c55eef7241d73df738faba485acffda23061c Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 11 Aug 2009 23:41:44 +0200 Subject: Bug #44012 mtr: test cases that are not supposed to return output always fail Output would match an empty result file but we don't check Allow empty output IFF there is an empty result file. --- client/mysqltest.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'client/mysqltest.cc') diff --git a/client/mysqltest.cc b/client/mysqltest.cc index a39cabdc64d..a40ee1cd1d0 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7987,6 +7987,8 @@ int main(int argc, char **argv) if (parsing_disabled) die("Test ended with parsing disabled"); + my_bool empty_result= FALSE; + /* The whole test has been executed _sucessfully_. Time to compare result or save it to record file. @@ -8027,11 +8029,20 @@ int main(int argc, char **argv) } else { - die("The test didn't produce any output"); + /* Empty output is an error *unless* we also have an empty result file */ + if (! result_file_name || record || + compare_files (log_file.file_name(), result_file_name)) + { + die("The test didn't produce any output"); + } + else + { + empty_result= TRUE; /* Meaning empty was expected */ + } } - if (!command_executed && result_file_name) - die("No queries executed but result file found!"); + if (!command_executed && result_file_name && !empty_result) + die("No queries executed but non-empty result file found!"); verbose_msg("Test has succeeded!"); timer_output(); -- cgit v1.2.1