Commit 3a9f0e76 authored by unknown's avatar unknown

Merge neptunus.(none):/home/msvensson/mysql/mysqltest_replace/my50-mysqltest_replace

into  neptunus.(none):/home/msvensson/mysql/mysql-5.0


mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
client/mysqltest.c:
  Merge
mysql-test/mysql-test-run.pl:
  Merge, undo removal
mysql-test/t/mysqldump.test:
  Merge
mysql-test/t/mysqltest.test:
  Merge
parents 7e57cbec 06d4f883
......@@ -74,7 +74,6 @@
#define MAX_QUERY (256*1024)
#define MAX_VAR_NAME 256
#define MAX_COLUMNS 256
#define PAD_SIZE 128
#define MAX_CONS 128
#define MAX_INCLUDE_DEPTH 16
#define INIT_Q_LINES 1024
......@@ -275,18 +274,6 @@ typedef struct
int alloced;
} VAR;
#if defined(__NETWARE__) || defined(__WIN__)
/*
Netware doesn't proved environment variable substitution that is done
by the shell in unix environments. We do this in the following function:
*/
static char *subst_env_var(const char *cmd);
static FILE *my_popen(const char *cmd, const char *mode);
#undef popen
#define popen(A,B) my_popen((A),(B))
#endif /* __NETWARE__ */
VAR var_reg[10];
/*Perl/shell-like variable registers */
HASH var_hash;
......@@ -465,19 +452,19 @@ typedef struct st_pointer_array { /* when using array-strings */
struct st_replace;
struct st_replace *init_replace(my_string *from, my_string *to, uint count,
my_string word_end_chars);
uint replace_strings(struct st_replace *rep, my_string *start,
uint *max_length, const char *from);
void free_replace();
static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name);
static void replace_strings_append(struct st_replace *rep, DYNAMIC_STRING* ds,
const char *from, int len);
void free_pointer_array(POINTER_ARRAY *pa);
static int initialize_replace_buffer(void);
static void do_eval(DYNAMIC_STRING *query_eval, const char *query);
static void str_to_file(const char *fname, char *str, int size);
int do_server_op(struct st_query *q,const char *op);
#ifdef __WIN__
static void free_win_path_patterns();
#endif
struct st_replace *glob_replace;
static char *out_buff;
static uint out_length;
static int eval_result = 0;
/* For column replace */
......@@ -505,7 +492,7 @@ static void handle_no_error(struct st_query *q);
static void do_eval(DYNAMIC_STRING* query_eval, const char *query)
{
const char *p;
register char c;
register char c, next_c;
register int escaped = 0;
VAR* v;
DBUG_ENTER("do_eval");
......@@ -527,13 +514,19 @@ static void do_eval(DYNAMIC_STRING* query_eval, const char *query)
}
break;
case '\\':
next_c= *(p+1);
if (escaped)
{
escaped = 0;
dynstr_append_mem(query_eval, p, 1);
}
else
else if (next_c == '\\' || next_c == '$')
{
/* Set escaped only if next char is \ or $ */
escaped = 1;
}
else
dynstr_append_mem(query_eval, p, 1);
break;
default:
dynstr_append_mem(query_eval, p, 1);
......@@ -609,6 +602,9 @@ static void free_used_memory()
free_defaults(default_argv);
mysql_server_end();
free_re();
#ifdef __WIN__
free_win_path_patterns();
#endif
DBUG_VOID_RETURN;
}
......@@ -971,17 +967,7 @@ int do_require_manager(struct st_query *query __attribute__((unused)) )
}
#ifndef EMBEDDED_LIBRARY
int do_server_start(struct st_query *q)
{
return do_server_op(q, "start");
}
int do_server_stop(struct st_query *q)
{
return do_server_op(q, "stop");
}
int do_server_op(struct st_query *q, const char *op)
static int do_server_op(struct st_query *q, const char *op)
{
char *p= q->first_argument;
char com_buf[256], *com_p;
......@@ -1011,6 +997,17 @@ int do_server_op(struct st_query *q, const char *op)
q->last_argument= p;
return 0;
}
int do_server_start(struct st_query *q)
{
return do_server_op(q, "start");
}
int do_server_stop(struct st_query *q)
{
return do_server_op(q, "stop");
}
#endif
......@@ -1064,16 +1061,21 @@ int do_source(struct st_query *query)
expected error array, previously set with the --error command.
It can thus be used to execute a command that shall fail.
NOTE
Although mysqltest is executed from cygwin shell, the command will be
executed in "cmd.exe". Thus commands like "rm" etc can NOT be used, use
system for those commands.
*/
static void do_exec(struct st_query *query)
{
int error;
DYNAMIC_STRING *ds= NULL;
char buf[1024];
FILE *res_file;
char *cmd= query->first_argument;
DYNAMIC_STRING ds_cmd;
DBUG_ENTER("do_exec");
DBUG_PRINT("enter", ("cmd: '%s'", cmd));
while (*cmd && my_isspace(charset_info, *cmd))
cmd++;
......@@ -1081,24 +1083,28 @@ static void do_exec(struct st_query *query)
die("Missing argument in exec");
query->last_argument= query->end;
DBUG_PRINT("info", ("Executing '%s'", cmd));
init_dynamic_string(&ds_cmd, 0, strlen(cmd)+256, 256);
/* Eval the command, thus replacing all environment variables */
do_eval(&ds_cmd, cmd);
cmd= ds_cmd.str;
DBUG_PRINT("info", ("Executing '%s' as '%s'",
query->first_argument, cmd));
if (!(res_file= popen(cmd, "r")) && query->abort_on_error)
die("popen(\"%s\", \"r\") failed", cmd);
die("popen(\"%s\", \"r\") failed", query->first_argument);
if (disable_result_log)
{
while (fgets(buf, sizeof(buf), res_file))
{
if (disable_result_log)
{
buf[strlen(buf)-1]=0;
DBUG_PRINT("exec_result",("%s", buf));
}
}
else
{
ds= &ds_res;
while (fgets(buf, sizeof(buf), res_file))
replace_dynstr_append(ds, buf);
replace_dynstr_append(&ds_res, buf);
}
}
error= pclose(res_file);
if (error != 0)
......@@ -1107,7 +1113,7 @@ static void do_exec(struct st_query *query)
my_bool ok= 0;
if (query->abort_on_error)
die("command \"%s\" failed", cmd);
die("command \"%s\" failed", query->first_argument);
DBUG_PRINT("info",
("error: %d, status: %d", error, status));
......@@ -1122,19 +1128,19 @@ static void do_exec(struct st_query *query)
{
ok= 1;
DBUG_PRINT("info", ("command \"%s\" failed with expected error: %d",
cmd, status));
query->first_argument, status));
}
}
if (!ok)
die("command \"%s\" failed with wrong error: %d",
cmd, status);
query->first_argument, status);
}
else if (query->expected_errno[0].type == ERR_ERRNO &&
query->expected_errno[0].code.errnum != 0)
{
/* Error code we wanted was != 0, i.e. not an expected success */
die("command \"%s\" succeeded - should have failed with errno %d...",
cmd, query->expected_errno[0].code.errnum);
query->first_argument, query->expected_errno[0].code.errnum);
}
free_replace();
......@@ -1346,38 +1352,49 @@ int do_modify_var(struct st_query *query, const char *name,
}
int do_system(struct st_query *q)
/*
SYNOPSIS
do_system
command called command
DESCRIPTION
system <command>
Eval the query to expand any $variables in the command.
Execute the command withe the "system" command.
NOTE
If mysqltest is executed from cygwin shell, the command will be
executed in cygwin shell. Thus commands like "rm" etc can be used.
*/
int do_system(struct st_query *command)
{
DYNAMIC_STRING *ds;
char *p=q->first_argument;
VAR v;
var_init(&v, 0, 0, 0, 0);
eval_expr(&v, p, 0); /* NULL terminated */
ds= &ds_res;
DYNAMIC_STRING ds_cmd;
if (v.str_val_len)
{
char expr_buf[1024];
if ((uint)v.str_val_len > sizeof(expr_buf) - 1)
v.str_val_len = sizeof(expr_buf) - 1;
memcpy(expr_buf, v.str_val, v.str_val_len);
expr_buf[v.str_val_len] = 0;
DBUG_PRINT("info", ("running system command '%s'", expr_buf));
if (system(expr_buf))
if (strlen(command->first_argument) == 0)
die("Missing arguments to system, nothing to do!");
init_dynamic_string(&ds_cmd, 0, strlen(command->first_argument) + 64, 256);
/* Eval the system command, thus replacing all environment variables */
do_eval(&ds_cmd, command->first_argument);
DBUG_PRINT("info", ("running system command '%s' as '%s'",
command->first_argument, ds_cmd.str));
if (system(ds_cmd.str))
{
if (q->abort_on_error)
die("system command '%s' failed", expr_buf);
if (command->abort_on_error)
die("system command '%s' failed", command->first_argument);
/* If ! abort_on_error, log message and continue */
dynstr_append(ds, "system command '");
replace_dynstr_append(ds, expr_buf);
dynstr_append(ds, "' failed\n");
}
dynstr_append(&ds_res, "system command '");
replace_dynstr_append(&ds_res, command->first_argument);
dynstr_append(&ds_res, "' failed\n");
}
else
die("Missing arguments to system, nothing to do!");
var_free(&v);
q->last_argument= q->end;
command->last_argument= command->end;
return 0;
}
......@@ -1859,8 +1876,7 @@ static void get_replace(struct st_query *q)
if (!(glob_replace=init_replace((char**) from_array.typelib.type_names,
(char**) to_array.typelib.type_names,
(uint) from_array.typelib.count,
word_end_chars)) ||
initialize_replace_buffer())
word_end_chars)))
die("Can't initialize replace from '%s'", q->query);
free_pointer_array(&from_array);
free_pointer_array(&to_array);
......@@ -1876,7 +1892,6 @@ void free_replace()
{
my_free((char*) glob_replace,MYF(0));
glob_replace=0;
my_free(out_buff,MYF(MY_WME));
}
DBUG_VOID_RETURN;
}
......@@ -3055,24 +3070,127 @@ void dump_result_to_reject_file(const char *record_file, char *buf, int size)
}
/* Append the string to ds, with optional replace */
#ifdef __WIN__
static void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
int len)
DYNAMIC_ARRAY patterns;
/*
init_win_path_patterns
DESCRIPTION
Setup string patterns that will be used to detect filenames that
needs to be converted from Win to Unix format
*/
static void init_win_path_patterns()
{
if (glob_replace)
/* List of string patterns to match in order to find paths */
const char* paths[] = { "$MYSQL_TEST_DIR", "./test/", 0 };
int num_paths= 2;
int i;
char* p;
DBUG_ENTER("init_win_path_patterns");
my_init_dynamic_array(&patterns, sizeof(const char*), 16, 16);
/* Loop through all paths in the array */
for (i= 0; i < num_paths; i++)
{
VAR* v;
if (*(paths[i]) == '$')
{
v= var_get(paths[i], 0, 0, 0);
p= my_strdup(v->str_val, MYF(MY_FAE));
}
else
p= my_strdup(paths[i], MYF(MY_FAE));
if (insert_dynamic(&patterns, (gptr) &p))
die(NullS);
DBUG_PRINT("info", ("p: %s", p));
while (*p)
{
if (*p == '/')
*p='\\';
p++;
}
}
DBUG_VOID_RETURN;
}
static void free_win_path_patterns()
{
int i= 0;
for (i=0 ; i < patterns.elements ; i++)
{
len=(int) replace_strings(glob_replace, &out_buff, &out_length, val);
if (len == -1)
die("Out of memory in replace");
val=out_buff;
const char** pattern= dynamic_element(&patterns, i, const char**);
my_free((gptr) *pattern, MYF(0));
}
delete_dynamic(&patterns);
}
/*
fix_win_paths
DESCRIPTION
Search the string 'val' for the patterns that are known to be
strings that contain filenames. Convert all \ to / in the
filenames that are found.
Ex:
val = 'Error "c:\mysql\mysql-test\var\test\t1.frm" didn't exist'
=> $MYSQL_TEST_DIR is found by strstr
=> all \ from c:\mysql\m... until next space is converted into /
*/
static void fix_win_paths(const char* val, int len)
{
uint i;
char *p;
DBUG_ENTER("fix_win_paths");
for (i= 0; i < patterns.elements; i++)
{
const char** pattern= dynamic_element(&patterns, i, const char**);
DBUG_PRINT("info", ("pattern: %s", *pattern));
/* Search for the path in string */
while ((p= strstr(val, *pattern)))
{
DBUG_PRINT("info", ("Found %s in val p: %s", *pattern, p));
while (*p && !my_isspace(charset_info, *p))
{
if (*p == '\\')
*p= '/';
p++;
}
DBUG_PRINT("info", ("Converted \\ to /, p: %s", p));
}
}
DBUG_PRINT("exit", (" val: %s, len: %d", val, len));
DBUG_VOID_RETURN;
}
#endif
/* Append the string to ds, with optional replace */
static void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
const char *val, int len)
{
#ifdef __WIN__
fix_win_paths(val, len);
#endif
if (glob_replace)
replace_strings_append(glob_replace, ds, val, len);
else
dynstr_append_mem(ds, val, len);
}
/* Append zero-terminated string to ds, with optional replace */
static void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val)
{
replace_dynstr_append_mem(ds, val, strlen(val));
......@@ -4382,6 +4500,10 @@ int main(int argc, char **argv)
init_var_hash(&cur_con->mysql);
#ifdef __WIN__
init_win_path_patterns();
#endif
/*
Initialize $mysql_errno with -1, so we can
- distinguish it from valid values ( >= 0 ) and
......@@ -5443,60 +5565,57 @@ static uint replace_len(my_string str)
}
/* Replace strings; Return length of result string */
uint replace_strings(REPLACE *rep, my_string *start,uint *max_length,
const char *from)
/* Replace strings while appending to ds */
void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
const char *str, int len)
{
reg1 REPLACE *rep_pos;
reg2 REPLACE_STRING *rep_str;
my_string to,end,pos,new_str;
const char *start, *from;
DBUG_ENTER("replace_strings_append");
end=(to= *start) + *max_length-1;
start= from= str;
rep_pos=rep+1;
for (;;)
{
/* Loop through states */
DBUG_PRINT("info", ("Looping through states"));
while (!rep_pos->found)
{
rep_pos= rep_pos->next[(uchar) *from];
if (to == end)
{
(*max_length)+=8192;
if (!(new_str=my_realloc(*start,*max_length,MYF(MY_WME))))
return (uint) -1;
to=new_str+(to - *start);
end=(*start=new_str)+ *max_length-1;
}
*to++= *from++;
}
rep_pos= rep_pos->next[(uchar) *from++];
/* Does this state contain a string to be replaced */
if (!(rep_str = ((REPLACE_STRING*) rep_pos))->replace_string)
return (uint) (to - *start)-1;
to-=rep_str->to_offset;
for (pos=rep_str->replace_string; *pos ; pos++)
{
if (to == end)
{
(*max_length)*=2;
if (!(new_str=my_realloc(*start,*max_length,MYF(MY_WME))))
return (uint) -1;
to=new_str+(to - *start);
end=(*start=new_str)+ *max_length-1;
}
*to++= *pos;
/* No match found */
dynstr_append_mem(ds, start, from - start - 1);
DBUG_PRINT("exit", ("Found no more string to replace, appended: %s", start));
DBUG_VOID_RETURN;
}
/* Found a string that needs to be replaced */
DBUG_PRINT("info", ("found: %d, to_offset: %d, from_offset: %d, string: %s",
rep_str->found, rep_str->to_offset,
rep_str->from_offset, rep_str->replace_string));
/* Append part of original string before replace string */
dynstr_append_mem(ds, start, (from - rep_str->to_offset) - start);
/* Append replace string */
dynstr_append_mem(ds, rep_str->replace_string,
strlen(rep_str->replace_string));
if (!*(from-=rep_str->from_offset) && rep_pos->found != 2)
return (uint) (to - *start);
{
/* End of from string */
DBUG_PRINT("exit", ("Found end of from string"));
DBUG_VOID_RETURN;
}
DBUG_ASSERT(from <= str+len);
start= from;
rep_pos=rep;
}
}
static int initialize_replace_buffer(void)
{
out_length=8192;
if (!(out_buff=my_malloc(out_length,MYF(MY_WME))))
return(1);
return 0;
}
/****************************************************************************
Replace results for a column
......@@ -5555,105 +5674,6 @@ static void get_replace_column(struct st_query *q)
q->last_argument= q->end;
}
#if defined(__NETWARE__) || defined(__WIN__)
/*
Substitute environment variables with text.
SYNOPSIS
subst_env_var()
arg String that should be substitute
DESCRIPTION
This function takes a string as an input and replaces the
environment variables, that starts with '$' character, with it value.
NOTES
Return string must be freed with my_free()
RETURN
String with environment variables replaced.
*/
static char *subst_env_var(const char *str)
{
char *result;
char *pos;
result= pos= my_malloc(MAX_QUERY, MYF(MY_FAE));
while (*str)
{
/*
need this only when we want to provide the functionality of
escaping through \ 'backslash'
if ((result == pos && *str=='$') ||
(result != pos && *str=='$' && str[-1] !='\\'))
*/
if (*str == '$')
{
char env_var[256], *env_pos= env_var, *subst;
/* Search for end of environment variable */
for (str++;
*str && !isspace(*str) && *str != '\\' && *str != '/' &&
*str != '$';
str++)
*env_pos++= *str;
*env_pos= 0;
if (!(subst= getenv(env_var)))
{
my_free(result, MYF(0));
die("MYSQLTEST.NLM: Environment variable %s is not defined",
env_var);
}
/* get the string to be substitued for env_var */
pos= strmov(pos, subst);
/* Process delimiter in *str again */
}
else
*pos++= *str++;
}
*pos= 0;
return result;
}
/*
popen replacement for Netware
SYNPOSIS
my_popen()
name Command to execute (with possible env variables)
mode Mode for popen.
NOTES
Environment variable expansion does not take place for popen function
on NetWare, so we use this function to wrap around popen to do this.
For the moment we ignore 'mode' and always use 'r0'
RETURN
# >= 0 File handle
-1 Error
*/
#undef popen /* Remove wrapper */
#ifdef __WIN__
#define popen _popen /* redefine for windows */
#endif
FILE *my_popen(const char *cmd, const char *mode __attribute__((unused)))
{
char *subst_cmd;
FILE *res_file;
subst_cmd= subst_env_var(cmd);
res_file= popen(subst_cmd, "r0");
my_free(subst_cmd, MYF(0));
return res_file;
}
#endif /* __NETWARE__ or __WIN__*/
......@@ -211,7 +211,7 @@ typedef uint rf_SetTimer;
#define my_sigset(A,B) signal((A),(B))
#define finite(A) _finite(A)
#define sleep(A) Sleep((A)*1000)
#define popen(A) popen(A,B) _popen((A),(B))
#define popen(A,B) _popen((A),(B))
#define pclose(A) _pclose(A)
#ifndef __BORLANDC__
......
......@@ -159,6 +159,7 @@ our $path_slave_load_tmpdir; # What is this?!
our $path_mysqltest_log;
our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line
our $opt_vardir_trace; # unix formatted opt_vardir for trace files
our $opt_tmpdir; # A path but set directly on cmd line
our $opt_usage;
......@@ -656,7 +657,7 @@ sub command_line_setup () {
{
$opt_vardir= "$glob_mysql_test_dir/var";
}
$opt_vardir_trace= $opt_vardir;
# We make the path absolute, as the server will do a chdir() before usage
unless ( $opt_vardir =~ m,^/, or
($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
......@@ -954,7 +955,8 @@ sub executable_setup () {
if ( $glob_win32 )
{
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
"$glob_basedir/bin");
"$glob_basedir/client_debug",
"$glob_basedir/bin",);
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-max",
"$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld",
......@@ -1002,6 +1004,7 @@ sub executable_setup () {
}
$exe_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
"$path_client_bindir/mysql_client_test",
"/usr/bin/false");
}
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
......@@ -1113,9 +1116,7 @@ sub environment_setup () {
$ENV{'LC_COLLATE'}= "C";
$ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
$ENV{'MYSQL_TEST_WINDIR'}= $glob_mysql_test_dir;
$ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
$ENV{'MASTER_WINMYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_mysock'};
$ENV{'MASTER_MYPORT'}= $master->[0]->{'path_myport'};
......@@ -1138,16 +1139,6 @@ sub environment_setup () {
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
$ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid};
if ( $glob_cygwin_perl )
{
foreach my $key ('MYSQL_TEST_WINDIR','MASTER_MYSOCK')
{
$ENV{$key}= `cygpath -w $ENV{$key}`;
$ENV{$key} =~ s,\\,\\\\,g;
chomp($ENV{$key});
}
}
$ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
# We are nice and report a bit about our settings
......@@ -2279,12 +2270,12 @@ sub mysqld_arguments ($$$$$$) {
if ( $type eq 'master' )
{
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/master%s.trace",
$prefix, $opt_vardir, $sidx);
$prefix, $opt_vardir_trace, $sidx);
}
if ( $type eq 'slave' )
{
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/slave%s.trace",
$prefix, $opt_vardir, $sidx);
$prefix, $opt_vardir_trace, $sidx);
}
}
......@@ -2658,7 +2649,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlcheck .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump.trace";
}
my $cmdline_mysqldump= "$exe_mysqldump --no-defaults -uroot " .
......@@ -2667,7 +2658,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqldump .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump.trace";
}
my $cmdline_mysqlimport= "$exe_mysqlimport -uroot " .
"--port=$master->[0]->{'path_myport'} " .
......@@ -2675,7 +2666,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlimport .=
" --debug=d:t:A,$opt_vardir/log/mysqlimport.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace";
}
my $cmdline_mysqlshow= "$exe_mysqlshow -uroot " .
......@@ -2684,7 +2675,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlshow .=
" --debug=d:t:A,$opt_vardir/log/mysqlshow.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace";
}
my $cmdline_mysqlbinlog=
......@@ -2695,7 +2686,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlbinlog .=
" --debug=d:t:A,$opt_vardir/log/mysqlbinlog.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace";
}
my $cmdline_mysql=
......@@ -2827,7 +2818,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir);
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir_trace);
}
if ( $opt_ssl_supported )
......
......@@ -2330,10 +2330,10 @@ drop table t1;
set global time_zone=default;
set time_zone=default;
DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t1 test` (
`a1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t2 test` (
`a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......
......@@ -539,7 +539,7 @@ drop procedure if exists into_outfile|
create procedure into_outfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
select * into outfile "/tmp/spout" from test.t1;
select * into outfile "../tmp/spout" from test.t1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_outfile("ofile", 1)|
......@@ -549,7 +549,7 @@ drop procedure if exists into_dumpfile|
create procedure into_dumpfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
select * into dumpfile "/tmp/spdump" from test.t1 limit 1;
select * into dumpfile "../tmp/spdump" from test.t1 limit 1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_dumpfile("dfile", 1)|
......
......@@ -9,13 +9,13 @@ create table t1 (
`a>b` text
);
insert into t1 values (1, 2, 'a&b a<b a>b');
--exec $MYSQL --xml test -e 'select * from t1'
--exec $MYSQL --xml test -e "select * from t1"
--exec $MYSQL_DUMP --xml --skip-create test
--exec $MYSQL --xml test -e 'select count(*) from t1'
--exec $MYSQL --xml test -e 'select 1 < 2 from dual'
--exec $MYSQL --xml test -e 'select 1 > 2 from dual'
--exec $MYSQL --xml test -e 'select 1 & 3 from dual'
--exec $MYSQL --xml test -e 'select null from dual'
--exec $MYSQL --xml test -e "select count(*) from t1"
--exec $MYSQL --xml test -e "select 1 < 2 from dual"
--exec $MYSQL --xml test -e "select 1 > 2 from dual"
--exec $MYSQL --xml test -e "select 1 & 3 from dual"
--exec $MYSQL --xml test -e "select null from dual"
drop table t1;
......@@ -6,7 +6,6 @@
# var/log/mysql_client_test.trace
--disable_result_log
--exec echo $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
# End of 4.1 tests
......
......@@ -647,7 +647,7 @@ select '------ Testing with illegal table names ------' as test_sequence ;
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\t1" 2>&1
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\t1" 2>&1
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\\\t1" 2>&1
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t\1" 2>&1
......@@ -830,11 +830,11 @@ DROP TABLE t1, t2;
# Bugs #9136, #12917: problems with --defaults-extra-file option
#
--exec echo "[mysqltest1]" > $MYSQLTEST_VARDIR/tmp/tmp.cnf
--exec echo "port=1234" >> $MYSQLTEST_VARDIR/tmp/tmp.cnf
--system echo "[mysqltest1]" > $MYSQLTEST_VARDIR/tmp/tmp.cnf
--system echo "port=1234" >> $MYSQLTEST_VARDIR/tmp/tmp.cnf
--exec $MYSQL_MY_PRINT_DEFAULTS -c $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1
--exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1
--exec rm $MYSQLTEST_VARDIR/tmp/tmp.cnf
--system rm $MYSQLTEST_VARDIR/tmp/tmp.cnf
#
# Test of fix to BUG 12597
......@@ -950,15 +950,16 @@ set time_zone=default;
#
--disable_warnings
DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`;
--enable_warnings
CREATE TABLE `t1 test` (
`a1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t2 test` (
`a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--enable_warnings
DELIMITER //;
CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
......@@ -973,11 +974,10 @@ SELECT * FROM `t2 test`;
# quoted
--exec $MYSQL_DUMP --skip-comments --compatible=ansi --triggers test
--disable_warnings
DROP TRIGGER `test trig`;
DROP TABLE `t1 test`;
DROP TABLE `t2 test`;
--enable_warnings
#
# BUG# 12838 mysqldump -x with views exits with error
#
......
......@@ -429,7 +429,7 @@ echo ;
# Illegal use of echo
--error 1
--exec echo "echo $;" | $MYSQL_TEST 2>&1
--exec echo "echo \$;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
......@@ -516,22 +516,22 @@ echo $novar1;
--exec echo "let ;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $=hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$=hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let hi=hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $1 hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$1 hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $m hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$m hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $ hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$ hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let =hi;" | $MYSQL_TEST 2>&1
......@@ -691,7 +691,7 @@ echo $i;
--error 1
--exec echo "inc i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=100; inc \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
--exec echo "let \\\$i=100; inc \\\$i 1000; echo \\\$i;" | $MYSQL_TEST 2>&1
inc $i; inc $i; inc $i; --echo $i
echo $i;
......@@ -719,7 +719,7 @@ echo $d;
--error 1
--exec echo "dec i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=100; dec \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
--exec echo "let \\\$i=100; dec \\\$i 1000; echo \\\$i;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
......@@ -803,11 +803,11 @@ while (!$i)
--error 1
--exec echo "source include/mysqltest_while.inc;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "while \$i;" | $MYSQL_TEST 2>&1
--exec echo "while \\\$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "while (\$i;" | $MYSQL_TEST 2>&1
--exec echo "while (\\\$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=1; while (\$i) dec \$i;" | $MYSQL_TEST 2>&1
--exec echo "let \\\$i=1; while (\\\$i) dec \\\$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "};" | $MYSQL_TEST 2>&1
--error 1
......@@ -919,22 +919,22 @@ select "a" as col1, "c" as col2;
--exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect
--exec echo "let \$i=100;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "let \\\$i=100;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\\\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "{" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " connect (test_con1,localhost,root,,); " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " dec \$i; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " dec \\\$i; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "}" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "source $MYSQLTEST_VARDIR/tmp/con.sql; echo OK;" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect, exceed max number of connections
--exec echo "let \$i=200;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "let \\\$i=200;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\\\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "{" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " connect (test_con1,localhost,root,,); " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " dec \$i; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " dec \\\$i; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "}" >> $MYSQLTEST_VARDIR/tmp/con.sql
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1
......@@ -1052,7 +1052,7 @@ select "this will be executed";
#
# Test that a test file that does not generate any output fails.
#
--exec echo "let \$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
--exec echo "let \\\$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
--error 1
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql 2>&1
......
......@@ -4,7 +4,7 @@
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults -r \\n -f " " --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults -r \\\n -f " " --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --type=ndbd --host=localhost 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
......
......@@ -12,7 +12,7 @@ show slave status;
change master to master_host='127.0.0.1';
# The following needs to be cleaned up when change master is fixed
--replace_result $MASTER_MYPORT MASTER_PORT $MYSQL_TCP_PORT MASTER_PORT
--replace_result $MYSQL_TCP_PORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
--replace_result $MASTER_MYPORT MASTER_PORT
......
......@@ -702,13 +702,13 @@ drop procedure if exists into_outfile|
create procedure into_outfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
select * into outfile "/tmp/spout" from test.t1;
select * into outfile "../tmp/spout" from test.t1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
system rm -f /tmp/spout|
--system rm -f $MYSQLTEST_VARDIR/tmp/spout
call into_outfile("ofile", 1)|
system rm -f /tmp/spout|
--system rm -f $MYSQLTEST_VARDIR/tmp/spout
delete from t1|
drop procedure into_outfile|
......@@ -718,13 +718,13 @@ drop procedure if exists into_dumpfile|
create procedure into_dumpfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
select * into dumpfile "/tmp/spdump" from test.t1 limit 1;
select * into dumpfile "../tmp/spdump" from test.t1 limit 1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
system rm -f /tmp/spdump|
--system rm -f $MYSQLTEST_VARDIR/tmp/spdump
call into_dumpfile("dfile", 1)|
system rm -f /tmp/spdump|
--system rm -f $MYSQLTEST_VARDIR/tmp/spdump
delete from t1|
drop procedure into_dumpfile|
......
......@@ -77,7 +77,8 @@ type=ISAM;
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
-- exec $MYSQL_FIX_SYSTEM_TABLES --database=test
# Call the "shell script" $MYSQL_FIX_SYSTEM_TABLES using system
-- system $MYSQL_FIX_SYSTEM_TABLES --database=test > /dev/null
-- enable_query_log
-- enable_result_log
......
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