Commit 2251593a authored by wax@mysql.com's avatar wax@mysql.com

Merge mysql.com:/home/wax/mysql/mysql-4.1

into mysql.com:/home/wax/mysql/mysql-4.1test2
parents bc317a19 6ba40427
......@@ -816,15 +816,14 @@ Package=<4>
###############################################################################
Project: "mysqltest"=.\client\mysqltest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project: "mysqltest"=.\client\mysqltest.dsp - Package Owner=<4>
Package=<5>
{{{ }}}
Package=<4>
{{{ Begin Project Dependency
Project_Dep_Name libmysql
End Project Dependency
Begin Project Dependency
......@@ -835,24 +834,28 @@ Package=<4>
End Project Dependency
}}}
###############################################################################
Project: "mysql_test_run_new"=".\mysql-test\mysql_test_run_new.dsp" - Package Owner=<4>
############################################################################### Project: "client_test"=.\tests\client_test.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ###############################################################################
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project: "mysql_test_run_new"=".\mysql-test\mysql_test_run_new.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{ Begin Project Dependency
Project_Dep_Name mysqltest
End Project Dependency
Begin Project Dependency
Project_Dep_Name mysqladmin
End Project Dependency
Begin Project Dependency
Project_Dep_Name client_test
End Project Dependency
}}}
###############################################################################
Global:
......
# Microsoft Developer Studio Project File - Name="client_test" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=client_test - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "client_test.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "client_test.mak" CFG="client_test - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "client_test - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE "client_test - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "client_test - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/client_test.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /c /GX
# ADD CPP /nologo /MTd /I "../include" /I "../" /Z7 /W3 /Od /G6 /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /Fp".\Debug/client_test.pch" /Fo".\Debug/" /Fd".\Debug/" /GZ /c /GX
# ADD BASE MTL /nologo /tlb".\Debug\client_test.tlb" /win32
# ADD MTL /nologo /tlb".\Debug\client_test.tlb" /win32
# ADD BASE RSC /l 1033
# ADD RSC /l 1033
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\tests\client_test.exe" /incremental:yes /libpath:"..\lib_debug\" /debug /pdb:".\Debug\client_test.pdb" /pdbtype:sept /map:".\Debug\client_test.map" /subsystem:console
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib mysqlclient.lib wsock32.lib mysys.lib regex.lib /nologo /out:"..\tests\client_test.exe" /incremental:yes /libpath:"..\lib_debug\" /debug /pdb:".\Debug\client_test.pdb" /pdbtype:sept /map:".\Debug\client_test.map" /subsystem:console
!ELSEIF "$(CFG)" == "client_test - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/client_test.pch" /Fo".\Release/" /Fd".\Release/" /c /GX
# ADD CPP /nologo /MTd /I "../include" /I "../" /W3 /Ob1 /G6 /D "DBUG_OFF" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "MYSQL_CLIENT" /D "__WIN__" /D "_WIN32" /GF /Gy /Fp".\Release/client_test.pch" /Fo".\Release/" /Fd".\Release/" /c /GX
# ADD BASE MTL /nologo /tlb".\Release\client_test.tlb" /win32
# ADD MTL /nologo /tlb".\Release\client_test.tlb" /win32
# ADD BASE RSC /l 1033
# ADD RSC /l 1033
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\tests\client_test.exe" /incremental:no /pdb:".\Release\client_test.pdb" /pdbtype:sept /subsystem:console
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib odbc32.lib odbccp32.lib Ws2_32.lib /nologo /out:"..\tests\client_test.exe" /incremental:no /pdb:".\Release\client_test.pdb" /pdbtype:sept /subsystem:console
!ENDIF
# Begin Target
# Name "client_test - Win32 Debug"
# Name "client_test - Win32 Release"
# Begin Source File
SOURCE=mysql_client_test.c
# End Source File
# End Target
# End Project
......@@ -96,6 +96,8 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY Host (Host,Db,User),"
"KEY User (User))"
"engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Database privileges';\n");
if (test)
......@@ -126,10 +128,12 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY Host (Host,Db))"
"comment='Host privileges;"
" Merged with database privileges';\n");
"engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Host privileges; Merged with database privileges';\n");
}
if (test_sys_file(mdata,"mysql/user.frm"))
{
#ifdef __WIN__
......@@ -184,7 +188,10 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"max_updates int(11) unsigned DEFAULT 0 NOT NULL,"
"max_connections int(11) unsigned DEFAULT 0 NOT NULL,"
"PRIMARY KEY Host (Host,User)"
") comment='Users and global privileges';\n");
") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Users and global privileges';\n");
if (test)
{
......@@ -238,7 +245,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"dl char(128) DEFAULT '' NOT NULL,"
"type enum ('function','aggregate') NOT NULL,"
"PRIMARY KEY (name)"
") comment='User defined functions';\n");
") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='User defined functions';\n");
}
if (test_sys_file(mdata,"mysql/tables_priv.frm"))
......@@ -258,7 +267,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
" DEFAULT '' NOT NULL,"
"PRIMARY KEY (Host,Db,User,Table_name),"
"KEY Grantor (Grantor)"
") comment='Table privileges';\n");
") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Table privileges';\n");
}
if (test_sys_file(mdata,"mysql/columns_priv.frm"))
......@@ -274,7 +285,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Column_priv set('Select','Insert','Update','References')"
" DEFAULT '' NOT NULL,"
"PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
") comment='Column privileges';\n");
") engine=MyISAM "
"CHARACTER SET utf8 COLLATE utf8_bin "
"comment='Column privileges';\n");
}
if (test_sys_file(mdata,"mysql/help_topic.frm"))
......@@ -289,7 +302,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"url varchar(128) not null,"
"primary key (help_topic_id),"
"unique index (name)"
") comment='help topics';\n");
") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='help topics';\n");
}
if (test_sys_file(mdata,"mysql/help_category.frm"))
......@@ -302,7 +317,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"url varchar(128) not null,"
"primary key (help_category_id),"
"unique index (name)"
") comment='help categories';\n");
") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='help categories';\n");
}
if (test_sys_file(mdata,"mysql/help_keyword.frm"))
......@@ -313,7 +330,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"name varchar(64) not null,"
"primary key (help_keyword_id),"
"unique index (name)"
") comment='help keywords';\n");
") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='help keywords';\n");
}
if (test_sys_file(mdata,"mysql/help_relation.frm"))
......@@ -323,7 +342,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"help_topic_id int unsigned not null references help_topic,"
"help_keyword_id int unsigned not null references help_keyword,"
"primary key (help_keyword_id, help_topic_id)"
") comment='keyword-topic relation';\n");
") engine=MyISAM "
"CHARACTER SET utf8 "
"comment='keyword-topic relation';\n");
}
if (test_sys_file(mdata,"mysql/time_zone_name.frm"))
......@@ -333,7 +354,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Name char(64) NOT NULL,"
"Time_zone_id int unsigned NOT NULL,"
"PRIMARY KEY Name (Name)"
") DEFAULT CHARACTER SET latin1 "
") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zone names';\n");
if (test)
......@@ -341,7 +362,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
fprintf(out,
"INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES"
"('MET', 1), ('UTC', 2), ('Universal', 2), "
"('Europe/Moscow',3), ('leap/Europe/Moscow',4);\n");
"('Europe/Moscow',3), ('leap/Europe/Moscow',4),"
"('Japan', 5);\n");
}
}
......@@ -353,13 +376,13 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Time_zone_id int unsigned NOT NULL auto_increment,"
"Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,"
"PRIMARY KEY TzId (Time_zone_id)"
") DEFAULT CHARACTER SET latin1 "
") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zones';\n");
if (test)
{
fprintf(out,"INSERT INTO time_zone (Time_zone_id, Use_leap_seconds)"
"VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y');\n");
"VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N');\n");
}
}
......@@ -371,7 +394,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Transition_time bigint signed NOT NULL,"
"Transition_type_id int unsigned NOT NULL,"
"PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)"
") DEFAULT CHARACTER SET latin1 "
") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zone transitions';\n");
if (test)
......@@ -576,7 +599,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
",(4, 2045689222, 8) ,(4, 2058390022, 9)"
",(4, 2077138822, 8) ,(4, 2090444422, 9)"
",(4, 2108588422, 8) ,(4, 2121894022, 9)"
",(4, 2140038022, 8);\n");
",(4, 2140038022, 8), (5, -1009875600, 1);\n");
}
}
......@@ -590,7 +615,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Is_DST tinyint unsigned DEFAULT 0 NOT NULL,"
"Abbreviation char(8) DEFAULT '' NOT NULL,"
"PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)"
") DEFAULT CHARACTER SET latin1 "
") engine=MyISAM CHARACTER SET utf8 "
"comment='Time zone transition types';\n");
if (test)
......@@ -612,7 +637,9 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
",(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD')"
",(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET')"
",(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD')"
",(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET');\n");
",(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET')"
",(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST');\n");
}
}
......@@ -623,7 +650,7 @@ bool create_system_files(const char *mdata,const char *output_file, bool test)
"Transition_time bigint signed NOT NULL,"
"Correction int signed NOT NULL,"
"PRIMARY KEY TranTime (Transition_time)"
") DEFAULT CHARACTER SET latin1 "
") engine=MyISAM CHARACTER SET utf8 "
"comment='Leap seconds information for time zones';\n");
if (test)
......
......@@ -122,7 +122,7 @@ void add_arg(arg_list_t *al, const char *format, ...)
al->argv[al->argc]= malloc(strlen(temp)+1);
ASSERT(al->argv[al->argc] != NULL);
strcpy(al->argv[al->argc], temp);
++(al->argc);
}
else
......@@ -800,12 +800,7 @@ int removef(const char *format, ...)
#ifndef STRUCT_DIRENT_HAS_D_TYPE
struct stat st;
if (lstat(entry->d_name, &st) == -1)
{
return 1;
}
if (!S_ISDIR(st.st_mode) && !fnmatch(p, entry->d_name,0))
if (lstat(entry->d_name, &st) == -1 && !fnmatch(p, entry->d_name,0))
#else
if (!S_ISDIR(entry->d_type) && !fnmatch(p, entry->d_name,0))
#endif
......
......@@ -132,7 +132,13 @@ static char skip_test[FN_REFLEN]=
" repair ,"
" rpl_trunc_binlog ,"
" mysqldump ,"
" rpl000001 ";
" rpl000001 ,"
" derived ,"
" group_by ,"
" select ,"
" rpl000015 ,"
" subselect ";
#endif
static char ignore_test[FN_REFLEN]= "";
......@@ -143,6 +149,8 @@ static char mysql_tmp_dir[FN_REFLEN];
static char result_dir[FN_REFLEN];
static char master_dir[FN_REFLEN];
static char slave_dir[FN_REFLEN];
static char slave1_dir[FN_REFLEN];
static char slave2_dir[FN_REFLEN];
static char lang_dir[FN_REFLEN];
static char char_dir[FN_REFLEN];
......@@ -190,6 +198,8 @@ int restarts= 0;
FILE *log_fd= NULL;
static char argument[FN_REFLEN];
/******************************************************************************
functions
......@@ -221,7 +231,7 @@ void log_info(const char *, ...);
void log_error(const char *, ...);
void log_errno(const char *, ...);
void die(const char *);
char *str_tok(char *string, const char *delim);
char *str_tok(char* dest, char *string, const char *delim);
#ifndef __WIN__
void run_init_script(const char *script_name);
#endif
......@@ -289,11 +299,15 @@ void install_db(char *datadir)
add_arg(&al, "--basedir=%s", base_dir);
add_arg(&al, "--datadir=%s", datadir);
add_arg(&al, "--skip-innodb");
add_arg(&al, "--skip-ndbcluster");
add_arg(&al, "--skip-bdb");
#ifndef __NETWARE__
add_arg(&al, "--character-sets-dir=%s", char_dir);
add_arg(&al, "--language=%s", lang_dir);
#endif
// added
add_arg(&al, "--default-character-set=latin1");
add_arg(&al, "--innodb_data_file_path=ibdata1:50M");
/* spawn */
if ((err= spawn(mysqld_file, &al, TRUE, input, output, error, NULL)) != 0)
......@@ -335,12 +349,27 @@ void mysql_install_db()
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/master-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave-data/mysql", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave1-data/mysql", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave1-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave2-data/mysql", mysql_test_dir);
mkdir(temp, S_IRWXU);
snprintf(temp, FN_REFLEN, "%s/var/slave2-data/test", mysql_test_dir);
mkdir(temp, S_IRWXU);
#else
mkdir(temp);
/* create subdirectories */
......@@ -368,6 +397,8 @@ void mysql_install_db()
install_db(master_dir);
mlog("Creating test databases for slave... \n");
install_db(slave_dir);
install_db(slave1_dir);
install_db(slave2_dir);
}
/******************************************************************************
......@@ -384,7 +415,6 @@ void start_master()
int err;
char master_out[FN_REFLEN];
char master_err[FN_REFLEN];
/* char temp[FN_REFLEN]; */
char temp2[FN_REFLEN];
/* remove old berkeley db log files that can confuse the server */
......@@ -463,6 +493,11 @@ void start_master()
add_arg(&al, "--character-sets-dir=%s", char_dir);
add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
add_arg(&al, "--language=%s", lang_dir);
add_arg(&al, "--rpl-recovery-rank=1");
add_arg(&al, "--init-rpl-role=master");
add_arg(&al, "--default-character-set=latin1");
// add_arg(&al, "--innodb_data_file_path=ibdata1:50M");
#ifdef DEBUG /* only for debug builds */
add_arg(&al, "--debug");
#endif
......@@ -491,13 +526,13 @@ void start_master()
{
char *p;
p= (char *)str_tok(master_opt, " \t");
p= (char *)str_tok(argument, master_opt, " \t");
if (!strstr(master_opt, "timezone"))
{
while (p)
{
add_arg(&al, "%s", p);
p= (char *)str_tok(NULL, " \t");
p= (char *)str_tok(argument, NULL, " \t");
}
}
}
......@@ -624,10 +659,10 @@ void start_slave()
add_arg(&al, "--log-bin=slave-bin");
add_arg(&al, "--relay_log=slave-relay-bin");
add_arg(&al, "--basedir=%s", base_dir);
add_arg(&al, "--port=%u", slave_port);
#if !defined(__NETWARE__) && !defined(__WIN__)
add_arg(&al, "--socket=%s",slave_socket);
#endif
add_arg(&al, "--port=%u", slave_port);
add_arg(&al, "--datadir=%s", slave_dir);
#ifndef __WIN__
add_arg(&al, "--pid-file=%s", slave_pid);
......@@ -651,10 +686,15 @@ void start_slave()
add_arg(&al, "--master-retry-count=10");
add_arg(&al, "-O");
add_arg(&al, "slave_net_timeout=10");
add_arg(&al, "--log-slave-updates");
add_arg(&al, "--log=%s/var/log/slave.log", mysql_test_dir);
add_arg(&al, "--default-character-set=latin1");
add_arg(&al, "--skip-ndbcluster");
#ifdef DEBUG /* only for debug builds */
add_arg(&al, "--debug");
#endif
#endif
if (use_openssl)
{
add_arg(&al, "--ssl-ca=%s", ca_cert);
......@@ -667,12 +707,12 @@ void start_slave()
{
char *p;
p= (char *)str_tok(slave_master_info, " \t");
p= (char *)str_tok(argument, slave_master_info, " \t");
while (p)
{
add_arg(&al, "%s", p);
p= (char *)str_tok(NULL, " \t");
p= (char *)str_tok(argument, NULL, " \t");
}
}
else
......@@ -700,13 +740,13 @@ void start_slave()
{
char *p;
p= (char *)str_tok(slave_opt, " \t");
p= (char *)str_tok(argument, slave_opt, " \t");
while (p)
{
add_arg(&al, "%s", p);
p= (char *)str_tok(NULL, " \t");
}
p= (char *)str_tok(argument, NULL, " \t");
}
}
/* remove the pid file if it exists */
......@@ -753,9 +793,12 @@ void start_slave()
void mysql_start()
{
/* log_info("Starting the MySQL server(s): %u", ++restarts); */
printf("loading master...\r");
start_master();
printf("loading slave...\r");
start_slave();
/* activate the test screen */
......@@ -853,6 +896,7 @@ void mysql_restart()
mysql_stop();
mlog(DASH);
sleep(1);
mysql_start();
}
......@@ -912,7 +956,7 @@ int read_option(char *opt_file, char *opt)
if ((p= strstr(opt, "\\\\")) != NULL)
{
/* bmove is guranteed to work byte by byte */
bmove(p, p+1, strlen(p+1));
bmove(p, p+1, strlen(p)+1);
}
}
else
......@@ -1045,9 +1089,6 @@ void run_test(char *test)
if (!master_running) mysql_start();
else if (restart) mysql_restart();
/* let the system stabalize */
sleep(1);
/* show test */
mlog("%-46s ", test);
......@@ -1066,10 +1107,12 @@ void run_test(char *test)
add_arg(&al, "--silent");
add_arg(&al, "--basedir=%s/", mysql_test_dir);
add_arg(&al, "--host=127.0.0.1");
add_arg(&al, "--skip-safemalloc");
add_arg(&al, "-v");
add_arg(&al, "-R");
add_arg(&al, "%s", result_file);
if (use_openssl)
{
add_arg(&al, "--ssl-ca=%s", ca_cert);
......@@ -1079,7 +1122,6 @@ void run_test(char *test)
/* spawn */
err= spawn(mysqltest_file, &al, TRUE, test_file, out_file, err_file, NULL);
/* free args */
free_args(&al);
......@@ -1259,7 +1301,9 @@ void die(const char *msg)
void setup(char *file __attribute__((unused)))
{
char temp[FN_REFLEN];
#if defined(__WIN__) || defined(__NETWARE__)
char file_path[FN_REFLEN*2];
#endif
char *p;
int position;
......@@ -1361,6 +1405,8 @@ void setup(char *file __attribute__((unused)))
snprintf(result_dir, FN_REFLEN, "%s/r", mysql_test_dir);
snprintf(master_dir, FN_REFLEN, "%s/var/master-data", mysql_test_dir);
snprintf(slave_dir, FN_REFLEN, "%s/var/slave-data", mysql_test_dir);
snprintf(slave1_dir, FN_REFLEN, "%s/var/slave1-data", mysql_test_dir);
snprintf(slave2_dir, FN_REFLEN, "%s/var/slave2-data", mysql_test_dir);
snprintf(lang_dir, FN_REFLEN, "%s/sql/share/english", base_dir);
snprintf(char_dir, FN_REFLEN, "%s/sql/share/charsets", base_dir);
......@@ -1413,30 +1459,108 @@ void setup(char *file __attribute__((unused)))
snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL_DUMP=%s/mysqldump.exe --no-defaults -u root --port=%u",
"MYSQL_DUMP=%s/mysqldump.exe --no-defaults -uroot --port=%u",
bin_dir, master_port);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s",
"MYSQL_BINLOG=%s/mysqlbinlog.exe --no-defaults --local-load=%s",
bin_dir, mysql_tmp_dir);
_putenv(file_path);
#else
snprintf(file_path,FN_REFLEN,"MYSQL_TEST_DIR=%s",mysql_test_dir);
putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL_DUMP=%s/mysqldump --no-defaults -u root --port=%u --socket=%s",
bin_dir, master_port, master_socket);
putenv(file_path);
"TESTS_BINDIR=%s/tests", base_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL_BINLOG=%s/mysqlbinlog --no-defaults --local-load=%s",
bin_dir, mysql_tmp_dir);
putenv(file_path);
"CHARSETSDIR=%s/sql/share/charsets", base_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL=%s/mysql --port=%u ",
bin_dir, master_port);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults "
"--host=localhost --port=%u "
"--basedir=%s --bindir=%s --verbose",
base_dir,master_port, base_dir, bin_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"NDB_TOOLS_DIR=%s/ndb/tools", base_dir);
_putenv(file_path);
snprintf(file_path, FN_REFLEN*2,
"CLIENT_BINDIR=%s", bin_dir);
_putenv(file_path);
#else
{
static char env_MYSQL_TEST_DIR[FN_REFLEN*2];
static char env_MYSQL_DUMP[FN_REFLEN*2];
static char env_MYSQL_BINLOG[FN_REFLEN*2];
static char env_MASTER_MYSOCK[FN_REFLEN*2];
static char env_TESTS_BINDIR[FN_REFLEN*2];
static char env_CHARSETSDIR[FN_REFLEN*2];
static char env_MYSQL[FN_REFLEN*2];
static char env_MYSQL_FIX_SYSTEM_TABLES[FN_REFLEN*2];
static char env_NDB_TOOLS_DIR[FN_REFLEN*2];
static char env_CLIENT_BINDIR[FN_REFLEN*2];
snprintf(env_MYSQL_TEST_DIR,FN_REFLEN*2,
"MYSQL_TEST_DIR=%s",mysql_test_dir);
putenv(env_MYSQL_TEST_DIR);
snprintf(env_MYSQL_DUMP, FN_REFLEN*2,"MYSQL_DUMP=%s/mysqldump --no-defaults "
"-uroot --port=%u --socket=%s ",
bin_dir, master_port, master_socket);
putenv(env_MYSQL_DUMP);
snprintf(env_MYSQL_BINLOG, FN_REFLEN*2,
"MYSQL_BINLOG=%s/mysqlbinlog --no-defaults --local-load=%s -uroot ",
bin_dir, mysql_tmp_dir);
putenv(env_MYSQL_BINLOG);
snprintf(env_MASTER_MYSOCK, FN_REFLEN*2,
"MASTER_MYSOCK=%s", master_socket);
putenv(env_MASTER_MYSOCK);
snprintf(env_TESTS_BINDIR, FN_REFLEN*2,
"TESTS_BINDIR=%s/tests", base_dir);
putenv(env_TESTS_BINDIR);
snprintf(env_CHARSETSDIR, FN_REFLEN*2,
"CHARSETSDIR=%s/sql/share/charsets", base_dir);
putenv(env_CHARSETSDIR);
snprintf(env_MYSQL, FN_REFLEN*2,
"MYSQL=%s/mysql --port=%u --socket=%s -uroot ",
bin_dir, master_port, master_socket);
putenv(env_MYSQL);
snprintf(env_MYSQL_FIX_SYSTEM_TABLES, FN_REFLEN*2,
"MYSQL_FIX_SYSTEM_TABLES=%s/scripts/mysql_fix_privilege_tables --no-defaults "
"--host=localhost --port=%u --socket=%s "
"--basedir=%s --bindir=%s --verbose -uroot ",
base_dir,master_port, master_socket, base_dir, bin_dir);
putenv(env_MYSQL_FIX_SYSTEM_TABLES);
snprintf(env_NDB_TOOLS_DIR, FN_REFLEN*2,
"NDB_TOOLS_DIR=%s/ndb/tools", base_dir);
putenv(env_NDB_TOOLS_DIR);
snprintf(env_CLIENT_BINDIR, FN_REFLEN*2,
"CLIENT_BINDIR=%s", bin_dir);
putenv(env_CLIENT_BINDIR);
}
#endif
#ifndef __WIN__
putenv((char *)"MASTER_MYPORT=9306");
putenv((char *)"SLAVE_MYPORT=9307");
putenv((char *)"MYSQL_TCP_PORT=3306");
#else
_putenv("MASTER_MYPORT=9306");
_putenv("SLAVE_MYPORT=9307");
......@@ -1484,7 +1608,8 @@ int main(int argc, char **argv)
{
char *temp, *token;
temp= strdup(strchr(argv[1],'=') + 1);
for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ","))
for (token=str_tok(argument, temp, ","); token != NULL;
token=str_tok(argument, NULL, ","))
{
if (strlen(ignore_test) + strlen(token) + 2 <= FN_REFLEN-1)
sprintf(ignore_test+strlen(ignore_test), " %s ", token);
......@@ -1671,105 +1796,70 @@ Arguments:
Output:
return the null terminated token of NULL.
*/
char *str_tok(char *string, const char *delim)
char *str_tok(char* dest, char *string, const char *delim)
{
char *token; /* current token received from strtok */
char *qt_token; /* token delimeted by the matching pair of quote */
/*
if there are any quote chars found in the token then this variable
will hold the concatenated string to return to the caller
*/
char *ptr_token=NULL;
/* pointer to the quote character in the token from strtok */
char *ptr_quote=NULL;
char *token;
char *ptr_end_token= NULL;
char *ptr_quote= NULL;
char *ptr_token= NULL;
int count_quotes= 0;
/* See if the delimeter contains any quote character */
*dest = '\0';
if (strchr(delim,'\'') || strchr(delim,'\"'))
return NULL;
/* repeate till we are getting some token from strtok */
while ((token= (char*)strtok(string, delim) ) != NULL)
token= (char*)strtok(string, delim);
if (token)
{
/*
make the input string NULL so that next time onward strtok can
be called with NULL input string.
*/
string= NULL;
/* We don't need to remove any quote character for Windows version */
#ifndef __WIN__
/* check if the current token contain double quote character*/
if ((ptr_quote= (char*)strchr(token,'\"')) != NULL)
{
/*
get the matching the matching double quote in the remaining
input string
*/
qt_token= (char*)strtok(NULL,"\"");
}
/* check if the current token contain single quote character*/
else if ((ptr_quote= (char*)strchr(token,'\'')) != NULL)
/* double quote is found */
if (strchr(token,'\"'))
{
/*
get the matching the matching single quote in the remaining
input string
*/
qt_token= (char*)strtok(NULL,"\'");
}
do
{
if (count_quotes & 1)
{
if (*dest == '\0')
sprintf(dest,"%s", ptr_token);
else
sprintf(dest,"%s %s", dest, ptr_token);
ptr_token= (char*)strtok(NULL, delim);
if (!ptr_token)
break;
}
else
{
ptr_token= token;
}
if (ptr_quote = strchr(ptr_token,'\"'))
{
ptr_end_token= ptr_token + strlen(ptr_token);
do
{
#ifndef __WIN__
bmove(ptr_quote, ptr_quote+1, ptr_end_token - ptr_quote);
#endif
/*
if the current token does not contains any quote character then
return to the caller.
*/
if (ptr_quote == NULL)
{
/*
if there is any earlier token i.e. ptr_token then append the
current token in it and return it else return the current
token directly
*/
return ptr_token ? strcat(ptr_token,token) : token;
}
/*
remove the quote character i.e. make NULL so that the token will
be devided in two part and later both part can be concatenated
and hence quote will be removed
*/
*ptr_quote= 0;
/* check if ptr_token has been initialized or not */
if (ptr_token == NULL)
{
/* initialize the ptr_token with current token */
ptr_token= token;
/* copy entire string between matching pair of quote*/
sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token);
count_quotes++;
} while (ptr_quote != NULL && (ptr_quote = strchr(ptr_quote+1,'\"')));
}
/* there are unpair quotes we have to search next quote*/
} while (count_quotes & 1);
if (ptr_token != NULL)
{
if (*dest == '\0')
sprintf(dest,"%s", ptr_token);
else
sprintf(dest,"%s %s",dest,ptr_token);
}
}
else
{
/*
copy the current token and entire string between matching pair
of quote
*/
if (qt_token == NULL)
{
sprintf(ptr_token+strlen(ptr_token),"%s%s", token, ptr_quote+1);
}
else
{
sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1,
qt_token );
}
sprintf(dest,"%s",token);
}
}
/* return the concatenated token */
return ptr_token;
return token ? dest : NULL;
}
#ifndef __WIN__
/*
Synopsis:
This function run scripts files on Linux and Netware
......
......@@ -317,7 +317,7 @@ prepare stmt4 from ' show engine bdb logs ';
execute stmt4;
--enable_result_log
prepare stmt4 from ' show full processlist ';
--replace_column 1 number 6 time
--replace_column 1 number 6 time 3 localhost
execute stmt4;
prepare stmt4 from ' show grants for user ';
--error 1295
......
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