mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mysql.com:/home/bk/mysql-4.1
into mysql.com:/users/kboortz/daily/work/mysql-4.1-vax client/mysqltest.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged
This commit is contained in:
@ -861,10 +861,10 @@ int do_source(struct st_query* q)
|
|||||||
1 error
|
1 error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int do_exec(struct st_query* q)
|
static void do_exec(struct st_query* q)
|
||||||
{
|
{
|
||||||
int error= 0;
|
int error;
|
||||||
DYNAMIC_STRING *ds;
|
DYNAMIC_STRING *ds= NULL; /* Assign just to avoid warning */
|
||||||
DYNAMIC_STRING ds_tmp;
|
DYNAMIC_STRING ds_tmp;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
FILE *res_file;
|
FILE *res_file;
|
||||||
@ -901,7 +901,15 @@ int do_exec(struct st_query* q)
|
|||||||
|
|
||||||
while (fgets(buf, sizeof(buf), res_file))
|
while (fgets(buf, sizeof(buf), res_file))
|
||||||
replace_dynstr_append_mem(ds, buf, strlen(buf));
|
replace_dynstr_append_mem(ds, buf, strlen(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
error= pclose(res_file);
|
||||||
|
|
||||||
|
if (error != 0)
|
||||||
|
die("command \"%s\" failed", cmd);
|
||||||
|
|
||||||
|
if (!disable_result_log)
|
||||||
|
{
|
||||||
if (glob_replace)
|
if (glob_replace)
|
||||||
free_replace();
|
free_replace();
|
||||||
|
|
||||||
@ -919,9 +927,6 @@ int do_exec(struct st_query* q)
|
|||||||
if (ds == &ds_tmp)
|
if (ds == &ds_tmp)
|
||||||
dynstr_free(&ds_tmp);
|
dynstr_free(&ds_tmp);
|
||||||
}
|
}
|
||||||
pclose(res_file);
|
|
||||||
|
|
||||||
DBUG_RETURN(error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2846,7 +2851,7 @@ int main(int argc, char **argv)
|
|||||||
(void) mysql_ping(&cur_con->mysql);
|
(void) mysql_ping(&cur_con->mysql);
|
||||||
break;
|
break;
|
||||||
case Q_EXEC:
|
case Q_EXEC:
|
||||||
(void) do_exec(q);
|
do_exec(q);
|
||||||
break;
|
break;
|
||||||
case Q_START_TIMER:
|
case Q_START_TIMER:
|
||||||
/* Overwrite possible earlier start of timer */
|
/* Overwrite possible earlier start of timer */
|
||||||
|
@ -208,6 +208,7 @@ MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log
|
|||||||
MYSQL_MANAGER_USER=root
|
MYSQL_MANAGER_USER=root
|
||||||
NO_SLAVE=0
|
NO_SLAVE=0
|
||||||
USER_TEST=
|
USER_TEST=
|
||||||
|
FAILED_CASES=
|
||||||
|
|
||||||
EXTRA_MASTER_OPT=""
|
EXTRA_MASTER_OPT=""
|
||||||
EXTRA_MYSQL_TEST_OPT=""
|
EXTRA_MYSQL_TEST_OPT=""
|
||||||
@ -1475,7 +1476,7 @@ run_testcase ()
|
|||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
FAILED_CASES="$FAILED_CASES $tname"
|
||||||
if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \
|
if [ -z "$DO_GDB" ] && [ -z "$USE_RUNNING_SERVER" ] && \
|
||||||
[ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
|
[ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
|
||||||
then
|
then
|
||||||
@ -1673,4 +1674,10 @@ $ECHO
|
|||||||
[ "$DO_GCOV" ] && gcov_collect # collect coverage information
|
[ "$DO_GCOV" ] && gcov_collect # collect coverage information
|
||||||
[ "$DO_GPROF" ] && gprof_collect # collect coverage information
|
[ "$DO_GPROF" ] && gprof_collect # collect coverage information
|
||||||
|
|
||||||
exit 0
|
if [ $TOT_FAIL -ne 0 ]; then
|
||||||
|
$ECHO "mysql-test-run: *** Failing the test(s):$FAILED_CASES"
|
||||||
|
$ECHO
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
2
mysql-test/t/client_test.test
Normal file
2
mysql-test/t/client_test.test
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
-- disable_result_log
|
||||||
|
--exec ../tests/client_test --testcase --user=root --socket=var/tmp/master.sock --port=$MYSQL_TCP_PORT
|
@ -27,11 +27,19 @@
|
|||||||
#include <my_getopt.h>
|
#include <my_getopt.h>
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#ifdef HAVE_SYS_PARAM_H
|
||||||
|
/* Include to get MAXPATHLEN */
|
||||||
|
#include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAXPATHLEN
|
||||||
|
#define MAXPATHLEN 256
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
|
#define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
|
||||||
|
|
||||||
/* set default options */
|
/* set default options */
|
||||||
|
static int opt_testcase = 0;
|
||||||
static char *opt_db= 0;
|
static char *opt_db= 0;
|
||||||
static char *opt_user= 0;
|
static char *opt_user= 0;
|
||||||
static char *opt_password= 0;
|
static char *opt_password= 0;
|
||||||
@ -183,7 +191,7 @@ static void client_connect()
|
|||||||
if (!(mysql= mysql_init(NULL)))
|
if (!(mysql= mysql_init(NULL)))
|
||||||
{
|
{
|
||||||
myerror("mysql_init() failed");
|
myerror("mysql_init() failed");
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mysql_real_connect(mysql, opt_host, opt_user,
|
if (!(mysql_real_connect(mysql, opt_host, opt_user,
|
||||||
@ -193,7 +201,7 @@ static void client_connect()
|
|||||||
myerror("connection failed");
|
myerror("connection failed");
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
fprintf(stdout, "\n Check the connection options using --help or -?\n");
|
fprintf(stdout, "\n Check the connection options using --help or -?\n");
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stdout, " OK");
|
fprintf(stdout, " OK");
|
||||||
@ -4071,14 +4079,14 @@ static void test_stmt_close()
|
|||||||
if (!(lmysql= mysql_init(NULL)))
|
if (!(lmysql= mysql_init(NULL)))
|
||||||
{
|
{
|
||||||
myerror("mysql_init() failed");
|
myerror("mysql_init() failed");
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!(mysql_real_connect(lmysql, opt_host, opt_user,
|
if (!(mysql_real_connect(lmysql, opt_host, opt_user,
|
||||||
opt_password, current_db, opt_port,
|
opt_password, current_db, opt_port,
|
||||||
opt_unix_socket, 0)))
|
opt_unix_socket, 0)))
|
||||||
{
|
{
|
||||||
myerror("connection failed");
|
myerror("connection failed");
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
fprintf(stdout, " OK");
|
fprintf(stdout, " OK");
|
||||||
|
|
||||||
@ -4688,7 +4696,7 @@ static void test_manual_sample()
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "\n drop table failed");
|
fprintf(stderr, "\n drop table failed");
|
||||||
fprintf(stderr, "\n %s", mysql_error(mysql));
|
fprintf(stderr, "\n %s", mysql_error(mysql));
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (mysql_query(mysql, "CREATE TABLE test_table(col1 int, col2 varchar(50), \
|
if (mysql_query(mysql, "CREATE TABLE test_table(col1 int, col2 varchar(50), \
|
||||||
col3 smallint, \
|
col3 smallint, \
|
||||||
@ -4696,7 +4704,7 @@ static void test_manual_sample()
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "\n create table failed");
|
fprintf(stderr, "\n create table failed");
|
||||||
fprintf(stderr, "\n %s", mysql_error(mysql));
|
fprintf(stderr, "\n %s", mysql_error(mysql));
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare a insert query with 3 parameters */
|
/* Prepare a insert query with 3 parameters */
|
||||||
@ -4705,7 +4713,7 @@ static void test_manual_sample()
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "\n prepare, insert failed");
|
fprintf(stderr, "\n prepare, insert failed");
|
||||||
fprintf(stderr, "\n %s", mysql_error(mysql));
|
fprintf(stderr, "\n %s", mysql_error(mysql));
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
fprintf(stdout, "\n prepare, insert successful");
|
fprintf(stdout, "\n prepare, insert successful");
|
||||||
|
|
||||||
@ -4716,7 +4724,7 @@ static void test_manual_sample()
|
|||||||
if (param_count != 3) /* validate parameter count */
|
if (param_count != 3) /* validate parameter count */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\n invalid parameter count returned by MySQL");
|
fprintf(stderr, "\n invalid parameter count returned by MySQL");
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bind the data for the parameters */
|
/* Bind the data for the parameters */
|
||||||
@ -4747,7 +4755,7 @@ static void test_manual_sample()
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "\n param bind failed");
|
fprintf(stderr, "\n param bind failed");
|
||||||
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
|
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Specify the data */
|
/* Specify the data */
|
||||||
@ -4762,7 +4770,7 @@ static void test_manual_sample()
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "\n execute 1 failed");
|
fprintf(stderr, "\n execute 1 failed");
|
||||||
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
|
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the total rows affected */
|
/* Get the total rows affected */
|
||||||
@ -4772,7 +4780,7 @@ static void test_manual_sample()
|
|||||||
if (affected_rows != 1) /* validate affected rows */
|
if (affected_rows != 1) /* validate affected rows */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\n invalid affected rows by MySQL");
|
fprintf(stderr, "\n invalid affected rows by MySQL");
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-execute the insert, by changing the values */
|
/* Re-execute the insert, by changing the values */
|
||||||
@ -4786,7 +4794,7 @@ static void test_manual_sample()
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "\n execute 2 failed");
|
fprintf(stderr, "\n execute 2 failed");
|
||||||
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
|
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the total rows affected */
|
/* Get the total rows affected */
|
||||||
@ -4796,7 +4804,7 @@ static void test_manual_sample()
|
|||||||
if (affected_rows != 1) /* validate affected rows */
|
if (affected_rows != 1) /* validate affected rows */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\n invalid affected rows by MySQL");
|
fprintf(stderr, "\n invalid affected rows by MySQL");
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close the statement */
|
/* Close the statement */
|
||||||
@ -4804,7 +4812,7 @@ static void test_manual_sample()
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "\n failed while closing the statement");
|
fprintf(stderr, "\n failed while closing the statement");
|
||||||
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
|
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
assert(2 == my_stmt_result("SELECT * FROM test_table"));
|
assert(2 == my_stmt_result("SELECT * FROM test_table"));
|
||||||
|
|
||||||
@ -4813,7 +4821,7 @@ static void test_manual_sample()
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "\n drop table failed");
|
fprintf(stderr, "\n drop table failed");
|
||||||
fprintf(stderr, "\n %s", mysql_error(mysql));
|
fprintf(stderr, "\n %s", mysql_error(mysql));
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
fprintf(stdout, "Success !!!");
|
fprintf(stdout, "Success !!!");
|
||||||
}
|
}
|
||||||
@ -4865,7 +4873,7 @@ static void test_prepare_alter()
|
|||||||
check_execute(stmt, rc);
|
check_execute(stmt, rc);
|
||||||
|
|
||||||
if (thread_query((char *)"ALTER TABLE test_prep_alter change id id_new varchar(20)"))
|
if (thread_query((char *)"ALTER TABLE test_prep_alter change id id_new varchar(20)"))
|
||||||
exit(0);
|
exit(1);
|
||||||
|
|
||||||
is_null= 1;
|
is_null= 1;
|
||||||
rc= mysql_stmt_execute(stmt);
|
rc= mysql_stmt_execute(stmt);
|
||||||
@ -6486,7 +6494,7 @@ static void test_prepare_grant()
|
|||||||
ER_UNKNOWN_COM_ERROR= 1047
|
ER_UNKNOWN_COM_ERROR= 1047
|
||||||
*/
|
*/
|
||||||
if (mysql_errno(mysql) != 1047)
|
if (mysql_errno(mysql) != 1047)
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -6497,7 +6505,7 @@ static void test_prepare_grant()
|
|||||||
if (!(lmysql= mysql_init(NULL)))
|
if (!(lmysql= mysql_init(NULL)))
|
||||||
{
|
{
|
||||||
myerror("mysql_init() failed");
|
myerror("mysql_init() failed");
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!(mysql_real_connect(lmysql, opt_host, "test_grant",
|
if (!(mysql_real_connect(lmysql, opt_host, "test_grant",
|
||||||
"", current_db, opt_port,
|
"", current_db, opt_port,
|
||||||
@ -6505,7 +6513,7 @@ static void test_prepare_grant()
|
|||||||
{
|
{
|
||||||
myerror("connection failed");
|
myerror("connection failed");
|
||||||
mysql_close(lmysql);
|
mysql_close(lmysql);
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
fprintf(stdout, " OK");
|
fprintf(stdout, " OK");
|
||||||
|
|
||||||
@ -6559,8 +6567,8 @@ static void test_frm_bug()
|
|||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
FILE *test_file;
|
FILE *test_file;
|
||||||
char data_dir[NAME_LEN];
|
char data_dir[MAXPATHLEN];
|
||||||
char test_frm[255];
|
char test_frm[MAXPATHLEN];
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
myheader("test_frm_bug");
|
myheader("test_frm_bug");
|
||||||
@ -6581,7 +6589,7 @@ static void test_frm_bug()
|
|||||||
|
|
||||||
bind[0].buffer_type= MYSQL_TYPE_STRING;
|
bind[0].buffer_type= MYSQL_TYPE_STRING;
|
||||||
bind[0].buffer= data_dir;
|
bind[0].buffer= data_dir;
|
||||||
bind[0].buffer_length= NAME_LEN;
|
bind[0].buffer_length= MAXPATHLEN;
|
||||||
bind[0].is_null= 0;
|
bind[0].is_null= 0;
|
||||||
bind[0].length= 0;
|
bind[0].length= 0;
|
||||||
bind[1]= bind[0];
|
bind[1]= bind[0];
|
||||||
@ -6605,7 +6613,7 @@ static void test_frm_bug()
|
|||||||
{
|
{
|
||||||
fprintf(stdout, "\n ERROR: my_fopen failed for '%s'", test_frm);
|
fprintf(stdout, "\n ERROR: my_fopen failed for '%s'", test_frm);
|
||||||
fprintf(stdout, "\n test cancelled");
|
fprintf(stdout, "\n test cancelled");
|
||||||
return;
|
exit(1);
|
||||||
}
|
}
|
||||||
fprintf(test_file, "this is a junk file for test");
|
fprintf(test_file, "this is a junk file for test");
|
||||||
|
|
||||||
@ -6894,7 +6902,7 @@ static void test_drop_temp()
|
|||||||
ER_UNKNOWN_COM_ERROR= 1047
|
ER_UNKNOWN_COM_ERROR= 1047
|
||||||
*/
|
*/
|
||||||
if (mysql_errno(mysql) != 1047)
|
if (mysql_errno(mysql) != 1047)
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -6904,7 +6912,7 @@ static void test_drop_temp()
|
|||||||
if (!(lmysql= mysql_init(NULL)))
|
if (!(lmysql= mysql_init(NULL)))
|
||||||
{
|
{
|
||||||
myerror("mysql_init() failed");
|
myerror("mysql_init() failed");
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc= mysql_query(mysql, "flush privileges");
|
rc= mysql_query(mysql, "flush privileges");
|
||||||
@ -6917,7 +6925,7 @@ static void test_drop_temp()
|
|||||||
mysql= lmysql;
|
mysql= lmysql;
|
||||||
myerror("connection failed");
|
myerror("connection failed");
|
||||||
mysql_close(lmysql);
|
mysql_close(lmysql);
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
fprintf(stdout, " OK");
|
fprintf(stdout, " OK");
|
||||||
|
|
||||||
@ -10447,6 +10455,8 @@ static struct my_option client_test_long_options[] =
|
|||||||
(char **) &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(char **) &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"socket", 'S', "Socket file to use for connection", (char **) &opt_unix_socket,
|
{"socket", 'S', "Socket file to use for connection", (char **) &opt_unix_socket,
|
||||||
(char **) &opt_unix_socket, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(char **) &opt_unix_socket, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
{"testcase", 'c', "May disable some code when runs as mysql-test-run testcase.",
|
||||||
|
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"count", 't', "Number of times test to be executed", (char **) &opt_count,
|
{"count", 't', "Number of times test to be executed", (char **) &opt_count,
|
||||||
(char **) &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
|
(char **) &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
|
||||||
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
||||||
@ -10490,6 +10500,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||||||
case '#':
|
case '#':
|
||||||
DBUG_PUSH(argument ? argument : default_dbug_option);
|
DBUG_PUSH(argument ? argument : default_dbug_option);
|
||||||
break;
|
break;
|
||||||
|
case 'c':
|
||||||
|
opt_testcase = 1;
|
||||||
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
if (argument)
|
if (argument)
|
||||||
{
|
{
|
||||||
@ -10740,6 +10753,5 @@ int main(int argc, char **argv)
|
|||||||
print_test_output();
|
print_test_output();
|
||||||
my_end(0);
|
my_end(0);
|
||||||
|
|
||||||
return(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user