Commit 9683c722 authored by unknown's avatar unknown

Merge perch.ndb.mysql.com:/home/jonas/src/mysql-4.1

into  perch.ndb.mysql.com:/home/jonas/src/mysql-4.1-push

parents b390a1a4 87950518
...@@ -97,6 +97,10 @@ ...@@ -97,6 +97,10 @@
#define DEFAULT_DELIMITER ";" #define DEFAULT_DELIMITER ";"
#define MAX_DELIMITER 16 #define MAX_DELIMITER 16
#define RESULT_OK 0
#define RESULT_CONTENT_MISMATCH 1
#define RESULT_LENGTH_MISMATCH 2
enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD, enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT, OPT_SKIP_SAFEMALLOC, OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT, OPT_SKIP_SAFEMALLOC,
OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
...@@ -650,7 +654,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname) ...@@ -650,7 +654,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
{ {
DBUG_PRINT("info",("Size differs: result size: %u file size: %u", DBUG_PRINT("info",("Size differs: result size: %u file size: %u",
ds->length, stat_info.st_size)); ds->length, stat_info.st_size));
DBUG_RETURN(2); DBUG_RETURN(RESULT_LENGTH_MISMATCH);
} }
if (!(tmp = (char*) my_malloc(stat_info.st_size + 1, MYF(MY_WME)))) if (!(tmp = (char*) my_malloc(stat_info.st_size + 1, MYF(MY_WME))))
die(NullS); die(NullS);
...@@ -667,7 +671,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname) ...@@ -667,7 +671,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
res_ptr = res_ds.str; res_ptr = res_ds.str;
if ((res_len = res_ds.length) != ds->length) if ((res_len = res_ds.length) != ds->length)
{ {
res = 2; res= RESULT_LENGTH_MISMATCH;
goto err; goto err;
} }
} }
...@@ -677,7 +681,8 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname) ...@@ -677,7 +681,8 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
res_len = stat_info.st_size; res_len = stat_info.st_size;
} }
res = (memcmp(res_ptr, ds->str, res_len)) ? 1 : 0; res= (memcmp(res_ptr, ds->str, res_len)) ?
RESULT_CONTENT_MISMATCH : RESULT_OK;
err: err:
if (res && eval_result) if (res && eval_result)
...@@ -694,21 +699,21 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname) ...@@ -694,21 +699,21 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
static int check_result(DYNAMIC_STRING* ds, const char *fname, static int check_result(DYNAMIC_STRING* ds, const char *fname,
my_bool require_option) my_bool require_option)
{ {
int error = 0; int error= RESULT_OK;
int res=dyn_string_cmp(ds, fname); int res= dyn_string_cmp(ds, fname);
if (res && require_option) if (res && require_option)
abort_not_supported_test(); abort_not_supported_test();
switch (res) { switch (res) {
case 0: case RESULT_OK:
break; /* ok */ break; /* ok */
case 2: case RESULT_LENGTH_MISMATCH:
verbose_msg("Result length mismatch"); verbose_msg("Result length mismatch");
error = 1; error= RESULT_LENGTH_MISMATCH;
break; break;
case 1: case RESULT_CONTENT_MISMATCH:
verbose_msg("Result content mismatch"); verbose_msg("Result content mismatch");
error = 1; error= RESULT_CONTENT_MISMATCH;
break; break;
default: /* impossible */ default: /* impossible */
die("Unknown error code from dyn_string_cmp()"); die("Unknown error code from dyn_string_cmp()");
...@@ -3738,8 +3743,9 @@ int main(int argc, char **argv) ...@@ -3738,8 +3743,9 @@ int main(int argc, char **argv)
{ {
int error = 0; int error = 0;
struct st_query *q; struct st_query *q;
my_bool require_file=0, q_send_flag=0; my_bool require_file=0, q_send_flag=0, query_executed= 0;
char save_file[FN_REFLEN]; char save_file[FN_REFLEN];
MY_STAT res_info;
MY_INIT(argv[0]); MY_INIT(argv[0]);
{ {
DBUG_ENTER("main"); DBUG_ENTER("main");
...@@ -3932,6 +3938,7 @@ int main(int argc, char **argv) ...@@ -3932,6 +3938,7 @@ int main(int argc, char **argv)
save_file[0]=0; save_file[0]=0;
} }
error |= run_query(&cur_con->mysql, q, flags); error |= run_query(&cur_con->mysql, q, flags);
query_executed= 1;
q->last_argument= q->end; q->last_argument= q->end;
break; break;
} }
...@@ -3952,6 +3959,7 @@ int main(int argc, char **argv) ...@@ -3952,6 +3959,7 @@ int main(int argc, char **argv)
is given on this connection. is given on this connection.
*/ */
error |= run_query(&cur_con->mysql, q, QUERY_SEND); error |= run_query(&cur_con->mysql, q, QUERY_SEND);
query_executed= 1;
q->last_argument= q->end; q->last_argument= q->end;
break; break;
case Q_RESULT: case Q_RESULT:
...@@ -3992,6 +4000,7 @@ int main(int argc, char **argv) ...@@ -3992,6 +4000,7 @@ int main(int argc, char **argv)
break; break;
case Q_EXEC: case Q_EXEC:
do_exec(q); do_exec(q);
query_executed= 1;
break; break;
case Q_START_TIMER: case Q_START_TIMER:
/* Overwrite possible earlier start of timer */ /* Overwrite possible earlier start of timer */
...@@ -4048,6 +4057,18 @@ int main(int argc, char **argv) ...@@ -4048,6 +4057,18 @@ int main(int argc, char **argv)
parser.current_line += current_line_inc; parser.current_line += current_line_inc;
} }
if (!query_executed && result_file && my_stat(result_file, &res_info, 0))
{
/*
my_stat() successful on result file. Check if we have not run a
single query, but we do have a result file that contains data.
Note that we don't care, if my_stat() fails. For example for
non-existing or non-readable file we assume it's fine to have
no query output from the test file, e.g. regarded as no error.
*/
if (res_info.st_size)
error|= (RESULT_CONTENT_MISMATCH | RESULT_LENGTH_MISMATCH);
}
if (result_file && ds_res.length && !error) if (result_file && ds_res.length && !error)
{ {
if (!record) if (!record)
......
...@@ -258,6 +258,7 @@ our $opt_user; ...@@ -258,6 +258,7 @@ our $opt_user;
our $opt_user_test; our $opt_user_test;
our $opt_valgrind; our $opt_valgrind;
our $opt_valgrind_mysqltest;
our $opt_valgrind_all; our $opt_valgrind_all;
our $opt_valgrind_options; our $opt_valgrind_options;
...@@ -512,6 +513,7 @@ sub command_line_setup () { ...@@ -512,6 +513,7 @@ sub command_line_setup () {
'gcov' => \$opt_gcov, 'gcov' => \$opt_gcov,
'gprof' => \$opt_gprof, 'gprof' => \$opt_gprof,
'valgrind:s' => \$opt_valgrind, 'valgrind:s' => \$opt_valgrind,
'valgrind-mysqltest:s' => \$opt_valgrind_mysqltest,
'valgrind-all:s' => \$opt_valgrind_all, 'valgrind-all:s' => \$opt_valgrind_all,
'valgrind-options=s' => \$opt_valgrind_options, 'valgrind-options=s' => \$opt_valgrind_options,
...@@ -696,9 +698,15 @@ sub command_line_setup () { ...@@ -696,9 +698,15 @@ sub command_line_setup () {
# "" option set with no argument # "" option set with no argument
# "somestring" option is name/path of valgrind executable # "somestring" option is name/path of valgrind executable
if ( defined $opt_valgrind_all and ! $opt_valgrind ) # Take executable path from any of them, if any
$opt_valgrind= $opt_valgrind_mysqltest if $opt_valgrind_mysqltest;
$opt_valgrind= $opt_valgrind_all if $opt_valgrind_all;
# If valgrind flag not defined, define if other valgrind flags are
unless ( defined $opt_valgrind )
{ {
$opt_valgrind= $opt_valgrind_all; $opt_valgrind= ""
if defined $opt_valgrind_mysqltest or defined $opt_valgrind_all;
} }
if ( ! $opt_testcase_timeout ) if ( ! $opt_testcase_timeout )
...@@ -2110,7 +2118,7 @@ sub run_mysqltest ($) { ...@@ -2110,7 +2118,7 @@ sub run_mysqltest ($) {
mtr_init_args(\$args); mtr_init_args(\$args);
if ( defined $opt_valgrind ) if ( defined $opt_valgrind_mysqltest )
{ {
valgrind_arguments($args, \$exe); valgrind_arguments($args, \$exe);
} }
...@@ -2208,6 +2216,8 @@ sub valgrind_arguments { ...@@ -2208,6 +2216,8 @@ sub valgrind_arguments {
mtr_add_arg($args, "--alignment=8"); mtr_add_arg($args, "--alignment=8");
mtr_add_arg($args, "--leak-check=yes"); mtr_add_arg($args, "--leak-check=yes");
mtr_add_arg($args, "--num-callers=16"); mtr_add_arg($args, "--num-callers=16");
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
if -f "$glob_mysql_test_dir/valgrind.supp";
if ( defined $opt_valgrind_all ) if ( defined $opt_valgrind_all )
{ {
...@@ -2293,10 +2303,11 @@ Options for coverage, profiling etc ...@@ -2293,10 +2303,11 @@ Options for coverage, profiling etc
gcov FIXME gcov FIXME
gprof FIXME gprof FIXME
valgrind[=exe] Run the "mysqltest" executable as well as the "mysqld" valgrind[=EXE] Run the "mysqltest" executable as well as the "mysqld"
server using valgrind, optionally specifying the server using valgrind, optionally specifying the
executable path/name executable path/name
valgrind-all FIXME valgrind-mysqltest[=EXE] In addition, run the "mysqltest" executable with valgrind
valgrind-all[=EXE] Adds verbose flag, and --show-reachable to valgrind
valgrind-options=ARGS Extra options to give valgrind valgrind-options=ARGS Extra options to give valgrind
Misc options Misc options
......
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