You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
testing various correction
travis: use connector-test-machine test script that permit to run the following tests : * MariaDB all supported version * Maxscale * MySQL * SkySQL If CONNECTOR_TEST_SECRET_KEY is not provided (PR) only MariaDB and MySQL community will be test Pull request testing correction appveyor correction using archive if not latest server release
This commit is contained in:
@@ -572,7 +572,11 @@ static int test_bug30472(MYSQL *mysql)
|
||||
FAIL_UNLESS(strncmp(character_set_name_2, "utf8", 4) == 0, "cs_name != utf8");
|
||||
FAIL_UNLESS(strncmp(character_set_client_2, "utf8", 4) == 0, "cs_client != utf8");
|
||||
FAIL_UNLESS(strncmp(character_set_results_2, "utf8", 4) == 0, "cs_result != ut8");
|
||||
FAIL_UNLESS(strcmp(collation_connnection_2, "utf8_general_ci") == 0, "collation != utf8_general_ci");
|
||||
if (mariadb_connection(mysql) && mysql_get_server_version(mysql) < 100600) {
|
||||
FAIL_UNLESS(strcmp(collation_connnection_2, "utf8_general_ci") == 0, "collation != utf8_general_ci");
|
||||
} else {
|
||||
FAIL_UNLESS(strcmp(collation_connnection_2, "utf8mb3_general_ci") == 0, "collation != utf8_general_ci");
|
||||
}
|
||||
|
||||
diag("%s %s", character_set_name_1, character_set_name_2);
|
||||
FAIL_UNLESS(strcmp(character_set_name_1, character_set_name_2) != 0, "cs_name1 = cs_name2");
|
||||
@@ -622,11 +626,16 @@ static int test_bug30472(MYSQL *mysql)
|
||||
collation_connnection_4);
|
||||
|
||||
/* Check that we have UTF8 on the server and on the client. */
|
||||
|
||||
FAIL_UNLESS(strcmp(character_set_name_4, "utf8") == 0, "cs_name != utf8");
|
||||
FAIL_UNLESS(strcmp(character_set_client_4, "utf8") == 0, "cs_client != utf8");
|
||||
FAIL_UNLESS(strcmp(character_set_results_4, "utf8") == 0, "cs_result != utf8");
|
||||
FAIL_UNLESS(strcmp(collation_connnection_4, "utf8_general_ci") == 0, "collation_connection != utf8_general_ci");
|
||||
if (mariadb_connection(mysql) && mysql_get_server_version(mysql) < 100600) {
|
||||
FAIL_UNLESS(strcmp(character_set_client_4, "utf8") == 0, "cs_client != utf8");
|
||||
FAIL_UNLESS(strcmp(character_set_results_4, "utf8") == 0, "cs_result != utf8");
|
||||
FAIL_UNLESS(strcmp(collation_connnection_4, "utf8_general_ci") == 0, "collation_connection != utf8_general_ci");
|
||||
} else {
|
||||
FAIL_UNLESS(strcmp(character_set_client_4, "utf8mb3") == 0, "cs_client != utf8");
|
||||
FAIL_UNLESS(strcmp(character_set_results_4, "utf8mb3") == 0, "cs_result != utf8");
|
||||
FAIL_UNLESS(strcmp(collation_connnection_4, "utf8mb3_general_ci") == 0, "collation_connection != utf8_general_ci");
|
||||
}
|
||||
|
||||
/* That's it. Cleanup. */
|
||||
|
||||
@@ -647,8 +656,12 @@ static int test_bug_54100(MYSQL *mysql)
|
||||
while ((row= mysql_fetch_row(result)))
|
||||
{
|
||||
/* ignore ucs2 */
|
||||
if (strcmp(row[0], "ucs2") && strcmp(row[0], "utf16le") && strcmp(row[0], "utf8mb4") &&
|
||||
strcmp(row[0], "utf16") && strcmp(row[0], "utf32")) {
|
||||
if (strcmp(row[0], "ucs2")
|
||||
&& strcmp(row[0], "utf16le")
|
||||
&& (strcmp(row[0], "utf8mb4") && mariadb_connection(mysql) && mysql_get_server_version(mysql) < 100600)
|
||||
&& (strcmp(row[0], "utf8") && mariadb_connection(mysql) && mysql_get_server_version(mysql) >= 100600)
|
||||
&& strcmp(row[0], "utf16")
|
||||
&& strcmp(row[0], "utf32")) {
|
||||
rc= mysql_set_character_set(mysql, row[0]);
|
||||
check_mysql_rc(rc, mysql);
|
||||
}
|
||||
@@ -777,6 +790,7 @@ static int charset_auto(MYSQL *my __attribute__((unused)))
|
||||
/* check if all server character sets are supported */
|
||||
static int test_conc223(MYSQL *mysql)
|
||||
{
|
||||
SKIP_MYSQL(mysql);
|
||||
int rc;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
|
@@ -980,9 +980,14 @@ static int test_sess_track_db(MYSQL *mysql)
|
||||
do {
|
||||
printf("# SESSION_TRACK_VARIABLES: %*.*s\n", (int)len, (int)len, data);
|
||||
} while (!mysql_session_track_get_next(mysql, SESSION_TRACK_SYSTEM_VARIABLES, &data, &len));
|
||||
diag("charset: %s", mysql->charset->csname);
|
||||
FAIL_IF(strncmp(mysql->charset->csname, "utf8", 4), "Expected charset 'utf8'");
|
||||
|
||||
diag("charset: %s", mysql->charset->csname);
|
||||
if (mariadb_connection(mysql) && mysql_get_server_version(mysql) >= 100600) {
|
||||
diag("skipping since utf8mb3 isn't handled in 3.1");
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
FAIL_IF(strcmp(mysql->charset->csname, "utf8"), "Expected charset 'utf8'");
|
||||
rc= mysql_query(mysql, "SET NAMES latin1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
FAIL_IF(strcmp(mysql->charset->csname, "latin1"), "Expected charset 'latin1'");
|
||||
@@ -1633,6 +1638,9 @@ static int test_conc351(MYSQL *unused __attribute__((unused)))
|
||||
diag("Server doesn't support session tracking (cap=%lu)", mysql->server_capabilities);
|
||||
return SKIP;
|
||||
}
|
||||
rc= mysql_query(mysql, "USE mysql");
|
||||
check_mysql_rc(rc, mysql);
|
||||
FAIL_IF(strcmp(mysql->db, "mysql"), "Expected new schema 'mysql'");
|
||||
|
||||
FAIL_IF(mysql_session_track_get_first(mysql, SESSION_TRACK_SCHEMA, &data, &len), "expected session track schema");
|
||||
|
||||
@@ -1712,8 +1720,11 @@ static int test_conc366(MYSQL *mysql)
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
|
||||
sprintf(query, "CREATE OR REPLACE USER 'ede'@'%s' IDENTIFIED VIA ed25519 USING 'vubFBzIrapbfHct1/J72dnUryz5VS7lA6XHH8sIx4TI'", this_host);
|
||||
if (mysql_get_server_version(mysql) < 100400) {
|
||||
sprintf(query, "CREATE OR REPLACE USER 'ede'@'%s' IDENTIFIED VIA ed25519 USING '6aW9C7ENlasUfymtfMvMZZtnkCVlcb1ssxOLJ0kj/AA'", this_host);
|
||||
} else {
|
||||
sprintf(query, "CREATE OR REPLACE USER 'ede'@'%s' IDENTIFIED VIA ed25519 USING PASSWORD('MySup8%rPassw@ord')", this_host);
|
||||
}
|
||||
rc= mysql_query(mysql, query);
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
@@ -1724,7 +1735,7 @@ static int test_conc366(MYSQL *mysql)
|
||||
my= mysql_init(NULL);
|
||||
if (plugindir)
|
||||
mysql_options(my, MYSQL_PLUGIN_DIR, plugindir);
|
||||
if (!my_test_connect(my, hostname, "ede", "foo", schema, port, socketname, 0))
|
||||
if (!my_test_connect(my, hostname, "ede", "MySup8%rPassw@ord", schema, port, socketname, 0))
|
||||
{
|
||||
diag("Error: %s", mysql_error(my));
|
||||
return FAIL;
|
||||
@@ -1743,6 +1754,7 @@ static int test_conc366(MYSQL *mysql)
|
||||
|
||||
static int test_conc392(MYSQL *mysql)
|
||||
{
|
||||
SKIP_MYSQL(mysql);
|
||||
int rc;
|
||||
const char *data;
|
||||
size_t len;
|
||||
|
@@ -283,6 +283,7 @@ static int test_cursors_with_union(MYSQL *mysql)
|
||||
|
||||
static int test_cursors_with_procedure(MYSQL *mysql)
|
||||
{
|
||||
SKIP_MYSQL(mysql);
|
||||
const char *queries[]=
|
||||
{
|
||||
"SELECT * FROM t1 procedure analyse()"
|
||||
@@ -1493,19 +1494,16 @@ static int test_bug38486(MYSQL *mysql)
|
||||
int rc;
|
||||
unsigned long type= CURSOR_TYPE_READ_ONLY;
|
||||
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type);
|
||||
check_stmt_rc(rc, stmt);
|
||||
stmt_text= "CREATE TABLE t1 (a INT)";
|
||||
rc= mysql_stmt_prepare(stmt, SL(stmt_text));
|
||||
check_stmt_rc(rc, stmt);
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
mysql_stmt_close(stmt);
|
||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t10");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "CREATE TABLE t10 (a INT)");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type);
|
||||
check_stmt_rc(rc, stmt);
|
||||
stmt_text= "INSERT INTO t1 VALUES (1)";
|
||||
stmt_text= "INSERT INTO t10 VALUES (1)";
|
||||
rc= mysql_stmt_prepare(stmt, SL(stmt_text));
|
||||
check_stmt_rc(rc, stmt);
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
|
@@ -28,6 +28,9 @@ static int execute_direct(MYSQL *mysql)
|
||||
rc= mariadb_stmt_execute_direct(stmt, "CREATE TABLE t1 (a int)", -1);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
rc= mysql_query(mysql, "FLUSH TABLES");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
memset(&bind, 0, sizeof(MYSQL_BIND));
|
||||
|
||||
bind.buffer= &i;
|
||||
@@ -43,6 +46,9 @@ static int execute_direct(MYSQL *mysql)
|
||||
rc= mariadb_stmt_execute_direct(stmt, "INSERT INTO t1 VALUES (?)", -1);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
rc= mysql_query(mysql, "START TRANSACTION");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
for (i=1; i < 1000; i++)
|
||||
{
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
@@ -58,6 +64,8 @@ static int execute_direct(MYSQL *mysql)
|
||||
FAIL_IF(mysql_num_rows(res) != 1000, "Expected 1000 rows");
|
||||
|
||||
mysql_free_result(res);
|
||||
rc= mysql_query(mysql, "COMMIT");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "DROP TABLE t1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
@@ -475,6 +475,9 @@ static int test_wl4166_2(MYSQL *mysql)
|
||||
"alter table t1 change column c_int c_int varchar(11)");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "FLUSH TABLES");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
@@ -509,6 +512,9 @@ static int test_wl4166_2(MYSQL *mysql)
|
||||
rc= mysql_query(mysql, "alter table t1 add column d_int int");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "FLUSH TABLES");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
FAIL_IF(!rc, "Error expected");
|
||||
|
||||
@@ -769,11 +775,26 @@ static int test_wl4284_1(MYSQL *mysql)
|
||||
static int test_bug49694(MYSQL *mysql)
|
||||
{
|
||||
int rc;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
int i;
|
||||
FILE *fp;
|
||||
|
||||
diag("Load local infile server : %ld", (mysql->server_capabilities & CLIENT_LOCAL_FILES));
|
||||
diag("Load local infile client : %ld", (mysql->client_flag & CLIENT_LOCAL_FILES));
|
||||
|
||||
SKIP_LOAD_INFILE_DISABLE;
|
||||
SKIP_SKYSQL;
|
||||
|
||||
rc= mysql_query(mysql, "select @@LOCAL_INFILE");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_store_result(mysql);
|
||||
row= mysql_fetch_row(res);
|
||||
if (atol(row[0]) == 0) {
|
||||
diag("Load local infile disable");
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS enclist");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
@@ -803,6 +824,7 @@ static int test_bug49694(MYSQL *mysql)
|
||||
|
||||
rc= mysql_query(mysql, "DROP TABLE enclist");
|
||||
check_mysql_rc(rc, mysql);
|
||||
mysql_free_result(res);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -810,12 +832,23 @@ static int test_conc49(MYSQL *mysql)
|
||||
{
|
||||
int rc;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
int i;
|
||||
FILE *fp;
|
||||
|
||||
SKIP_LOAD_INFILE_DISABLE;
|
||||
SKIP_SKYSQL;
|
||||
|
||||
rc= mysql_query(mysql, "select @@LOCAL_INFILE");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_store_result(mysql);
|
||||
row= mysql_fetch_row(res);
|
||||
if (atol(row[0]) == 0) {
|
||||
diag("Load local infile disable");
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
fp= fopen("./sample.csv", "w");
|
||||
for (i=1; i < 4; i++)
|
||||
fprintf(fp, "\"%d\", \"%d\", \"%d\"\r\n", i, i, i);
|
||||
@@ -848,6 +881,9 @@ static int test_ldi_path(MYSQL *mysql)
|
||||
rc= mysql_query(mysql, "CREATE TABLE t1 (a int)");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "FLUSH TABLES");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
#ifdef _WIN32
|
||||
rc= mysql_query(mysql, "LOAD DATA LOCAL INFILE 'X:/non_existing_path/data.csv' INTO TABLE t1 "
|
||||
"FIELDS TERMINATED BY '.' LINES TERMINATED BY '\r\n'");
|
||||
@@ -1028,6 +1064,8 @@ static int test_remote1(MYSQL *mysql)
|
||||
{
|
||||
int rc;
|
||||
SKIP_SKYSQL;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
remote_plugin= (void *)mysql_client_find_plugin(mysql, "remote_io", MARIADB_CLIENT_REMOTEIO_PLUGIN);
|
||||
if (!remote_plugin)
|
||||
@@ -1037,6 +1075,18 @@ static int test_remote1(MYSQL *mysql)
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
SKIP_LOAD_INFILE_DISABLE;
|
||||
|
||||
rc= mysql_query(mysql, "select @@LOCAL_INFILE");
|
||||
check_mysql_rc(rc, mysql);
|
||||
res= mysql_store_result(mysql);
|
||||
row= mysql_fetch_row(res);
|
||||
if (atol(row[0]) == 0) {
|
||||
diag("Load local infile disable");
|
||||
return SKIP;
|
||||
}
|
||||
mysql_free_result(res);
|
||||
|
||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
|
@@ -73,7 +73,7 @@ if (IS_SKYSQL(hostname)) \
|
||||
#define SKIP_NOTLS
|
||||
#endif
|
||||
|
||||
#define IS_MAXSCALE() (getenv("MAXSCALE_TEST_DISABLE")!=NULL)
|
||||
#define IS_MAXSCALE() (getenv("srv")!=NULL && (strcmp(getenv("srv"), "maxscale") == 0 || strcmp(getenv("srv"), "skysql-ha") == 0))
|
||||
#define SKIP_MAXSCALE \
|
||||
if (IS_MAXSCALE()) \
|
||||
{ \
|
||||
@@ -496,6 +496,8 @@ MYSQL *test_connect(struct my_tests_st *test)
|
||||
}
|
||||
mysql_options(mysql, MYSQL_REPORT_DATA_TRUNCATION, &truncation_report);
|
||||
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, &timeout);
|
||||
if (plugindir)
|
||||
mysql_options(mysql, MYSQL_PLUGIN_DIR, plugindir);
|
||||
|
||||
/* option handling */
|
||||
if (test && test->options) {
|
||||
@@ -554,7 +556,7 @@ static int reset_connection(MYSQL *mysql) {
|
||||
void get_envvars() {
|
||||
char *envvar;
|
||||
|
||||
if (getenv("MYSQL_TEST_TRAVIS"))
|
||||
if (getenv("TRAVIS_JOB_ID"))
|
||||
travis_test= 1;
|
||||
|
||||
if (!hostname && (envvar= getenv("MYSQL_TEST_HOST")))
|
||||
|
@@ -674,6 +674,7 @@ static int test_bug1500(MYSQL *mysql)
|
||||
|
||||
static int test_bug15510(MYSQL *mysql)
|
||||
{
|
||||
SKIP_MYSQL(mysql);
|
||||
MYSQL_STMT *stmt;
|
||||
int rc;
|
||||
const char *query= "select 1 from dual where 1/0";
|
||||
@@ -2070,7 +2071,7 @@ static int test_bug36004(MYSQL *mysql)
|
||||
int rc, warning_count= 0;
|
||||
MYSQL_STMT *stmt;
|
||||
SKIP_MAXSCALE;
|
||||
|
||||
SKIP_MYSQL(mysql); // don't send expected warnings
|
||||
|
||||
if (mysql_get_server_version(mysql) < 60000) {
|
||||
diag("Test requires MySQL Server version 6.0 or above");
|
||||
|
@@ -426,8 +426,7 @@ static int test_view_insert_fields(MYSQL *mysql)
|
||||
"F7F8 double NOT NULL default '0',"
|
||||
"F8F8 double NOT NULL default '0',"
|
||||
"F9D8 decimal(8,2) NOT NULL default '0.00',"
|
||||
"PRIMARY KEY (K1C4,K2C4,K3C4,K4N4)) "
|
||||
"CHARSET=latin1 COLLATE latin1_bin");
|
||||
"PRIMARY KEY (K1C4,K2C4,K3C4,K4N4))");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql,
|
||||
"CREATE VIEW v1 AS select sql_no_cache "
|
||||
|
Reference in New Issue
Block a user