1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Merge pull request #153 from Antchel/3.1

test fixes
This commit is contained in:
Georg Richter
2022-01-23 21:08:32 +01:00
committed by GitHub
7 changed files with 16 additions and 23 deletions

View File

@@ -26,7 +26,7 @@ INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include
${CC_SOURCE_DIR}/unittest/libmariadb) ${CC_SOURCE_DIR}/unittest/libmariadb)
ADD_DEFINITIONS(-DLIBMARIADB) ADD_DEFINITIONS(-DLIBMARIADB)
SET(API_TESTS "conc336" "bulk1" "performance" "basic-t" "fetch" "charset" "logs" "cursor" "errors" "view" "ps" "ps_bugs" "sp" "result" "connection" "misc" "ps_new" "thread" "features-10_2" "bulk1") SET(API_TESTS "conc336" "bulk1" "performance" "basic-t" "fetch" "charset" "logs" "cursor" "errors" "view" "ps" "ps_bugs" "sp" "result" "connection" "misc" "ps_new" "thread" "features-10_2")
IF(WITH_DYNCOL) IF(WITH_DYNCOL)
SET(API_TESTS ${API_TESTS} "dyncol") SET(API_TESTS ${API_TESTS} "dyncol")
ENDIF() ENDIF()

View File

@@ -881,7 +881,7 @@ static int test_get_options(MYSQL *unused __attribute__((unused)))
const char *attr_val[] = {"bar1", "bar2", "bar3"}; const char *attr_val[] = {"bar1", "bar2", "bar3"};
char **key, **val; char **key, **val;
for (i=0; options_int[i]; i++) for (i=0; i < sizeof(options_int)/sizeof(int); i++)
{ {
mysql_options(mysql, options_int[i], &intval[0]); mysql_options(mysql, options_int[i], &intval[0]);
intval[1]= 0; intval[1]= 0;

View File

@@ -291,7 +291,7 @@ static int test_frm_bug(MYSQL *mysql)
rc= 0; rc= 0;
while (mysql_fetch_row(result)) while (mysql_fetch_row(result))
rc++; rc++;
FAIL_UNLESS(rc == 1, "rowcount != 0"); FAIL_UNLESS(rc == 1, "rowcount != 1");
mysql_data_seek(result, 0); mysql_data_seek(result, 0);

View File

@@ -139,9 +139,6 @@ static int test_prepare_insert_update(MYSQL *mysql)
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
check_mysql_rc(rc, mysql); check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
check_mysql_rc(rc, mysql);
for (cur_query= testcase; *cur_query; cur_query++) for (cur_query= testcase; *cur_query; cur_query++)
{ {
char query[MAX_TEST_QUERY_LENGTH]; char query[MAX_TEST_QUERY_LENGTH];
@@ -183,7 +180,7 @@ static int test_prepare_insert_update(MYSQL *mysql)
static int test_bind_date_conv(MYSQL *mysql, uint row_count) static int test_bind_date_conv(MYSQL *mysql, uint row_count)
{ {
MYSQL_STMT *stmt= 0; MYSQL_STMT *stmt= 0;
uint rc, i, count= row_count; uint rc, i, count;
MYSQL_BIND my_bind[4]; MYSQL_BIND my_bind[4];
my_bool is_null[4]= {0,0,0,0}; my_bool is_null[4]= {0,0,0,0};
MYSQL_TIME tm[4]; MYSQL_TIME tm[4];
@@ -1020,7 +1017,7 @@ static int test_select_show(MYSQL *mysql)
strcpy(query, "show columns from test_show"); strcpy(query, "show columns from test_show");
stmt= mysql_stmt_init(mysql); stmt= mysql_stmt_init(mysql);
FAIL_IF(!stmt, mysql_error(mysql)); FAIL_IF(!stmt, mysql_stmt_error(stmt));
rc= mysql_stmt_prepare(stmt, SL(query)); rc= mysql_stmt_prepare(stmt, SL(query));
check_stmt_rc(rc, stmt); check_stmt_rc(rc, stmt);
@@ -3004,7 +3001,7 @@ static int test_create_drop(MYSQL *mysql)
check_stmt_rc(rc, stmt_drop); check_stmt_rc(rc, stmt_drop);
rc= mysql_stmt_execute(stmt_create_select); rc= mysql_stmt_execute(stmt_create_select);
check_stmt_rc(rc, stmt_create); check_stmt_rc(rc, stmt_create_select);
rc= mysql_stmt_execute(stmt_select); rc= mysql_stmt_execute(stmt_select);
check_stmt_rc(rc, stmt_select); check_stmt_rc(rc, stmt_select);

View File

@@ -449,7 +449,7 @@ static int test_bug11037(MYSQL *mysql)
/* expected error */ /* expected error */
rc = mysql_stmt_fetch(stmt); rc = mysql_stmt_fetch(stmt);
FAIL_UNLESS(rc==1, "Error expedted"); FAIL_UNLESS(rc==1, "Error expected");
rc= mysql_stmt_execute(stmt); rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt); check_stmt_rc(rc, stmt);
@@ -543,7 +543,7 @@ static int test_bug12744(MYSQL *mysql)
check_mysql_rc(rc, mysql); check_mysql_rc(rc, mysql);
rc= mysql_stmt_close(stmt); rc= mysql_stmt_close(stmt);
check_mysql_rc(rc, mysql); check_stmt_rc(rc, stmt);
return OK; return OK;
} }
@@ -726,7 +726,7 @@ static int test_bug15518(MYSQL *mysql)
succeeds succeeds
*/ */
rc= mysql_stmt_prepare(stmt, "SHOW STATUS", 12); rc= mysql_stmt_prepare(stmt, "SHOW STATUS", 12);
FAIL_UNLESS(!rc || mysql_stmt_errno(stmt) || mysql_errno(mysql), "Error expected"); FAIL_UNLESS(!rc || mysql_stmt_errno(stmt) || mysql_errno(mysql), "Error not expected");
rc= mysql_stmt_close(stmt); rc= mysql_stmt_close(stmt);
check_mysql_rc(rc, mysql); check_mysql_rc(rc, mysql);
@@ -789,7 +789,7 @@ static int test_bug15613(MYSQL *mysql)
metadata= mysql_stmt_result_metadata(stmt); metadata= mysql_stmt_result_metadata(stmt);
field= mysql_fetch_fields(metadata); field= mysql_fetch_fields(metadata);
FAIL_UNLESS(field[0].length == 65535, "length != 65535"); FAIL_UNLESS(field[0].length == 65535, "length != 65535");
FAIL_UNLESS(field[1].length == 255, "length != 244"); FAIL_UNLESS(field[1].length == 255, "length != 255");
FAIL_UNLESS(field[2].length == 16777215, "length != 166777215"); FAIL_UNLESS(field[2].length == 16777215, "length != 166777215");
FAIL_UNLESS(field[3].length == 4294967295UL, "length != 4294967295UL"); FAIL_UNLESS(field[3].length == 4294967295UL, "length != 4294967295UL");
FAIL_UNLESS(field[4].length == 255, "length != 255"); FAIL_UNLESS(field[4].length == 255, "length != 255");
@@ -4322,7 +4322,7 @@ static int test_conc182(MYSQL *mysql)
check_stmt_rc(rc, stmt); check_stmt_rc(rc, stmt);
rc= mysql_stmt_close(stmt); rc= mysql_stmt_close(stmt);
check_mysql_rc(rc, mysql); check_stmt_rc(rc, stmt);
rc= mysql_query(mysql, "SELECT row_count()"); rc= mysql_query(mysql, "SELECT row_count()");
result= mysql_store_result(mysql); result= mysql_store_result(mysql);
@@ -4530,8 +4530,8 @@ static int test_conc205(MYSQL *mysql)
FAIL_IF(length[2] != 4, "Wrong fetched int length"); FAIL_IF(length[2] != 4, "Wrong fetched int length");
FAIL_IF(strncmp(data, "data2", length[0] + 1) != 0, "Wrong string value"); FAIL_IF(strncmp(data, "data2", length[0] + 1) != 0, "Wrong string value");
FAIL_IF(smint_col != -25734, "Expected 21893"); FAIL_IF(smint_col != -25734, "Expected -25734");
FAIL_IF(int_col != -1857802040, "Expected 1718038908"); FAIL_IF(int_col != -1857802040, "Expected -1857802040");
rc= mysql_stmt_fetch(stmt); rc= mysql_stmt_fetch(stmt);
FAIL_IF(rc != MYSQL_NO_DATA, "Expected MYSQL_NO_DATA"); FAIL_IF(rc != MYSQL_NO_DATA, "Expected MYSQL_NO_DATA");
@@ -4840,9 +4840,6 @@ static int test_codbc138(MYSQL *mysql)
{0,0,0, 838,59,59, 0, 1, MYSQL_TIMESTAMP_TIME}, {0,0,0, 838,59,59, 0, 1, MYSQL_TIMESTAMP_TIME},
}, },
{"SELECT '00:60:00'",
{0,0,0, 0,0,0, 0,0, MYSQL_TIMESTAMP_ERROR},
},
{"SELECT '00:60:00'", {"SELECT '00:60:00'",
{0,0,0, 0,0,0, 0,0, MYSQL_TIMESTAMP_ERROR}, {0,0,0, 0,0,0, 0,0, MYSQL_TIMESTAMP_ERROR},
}, },
@@ -4987,8 +4984,8 @@ static int test_conc_fraction(MYSQL *mysql)
rc= mysql_stmt_execute(stmt); rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt); check_stmt_rc(rc, stmt);
check_stmt_rc(rc, stmt);
rc = mysql_stmt_store_result(stmt); rc = mysql_stmt_store_result(stmt);
check_stmt_rc(rc, stmt);
memset(bind, 0, sizeof(MYSQL_BIND)); memset(bind, 0, sizeof(MYSQL_BIND));
bind[0].buffer_type= MYSQL_TYPE_DATETIME; bind[0].buffer_type= MYSQL_TYPE_DATETIME;

View File

@@ -120,7 +120,7 @@ static int test_multi_result(MYSQL *mysql)
rc= mysql_stmt_fetch(stmt); rc= mysql_stmt_fetch(stmt);
FAIL_IF(mysql_stmt_field_count(stmt) != 2, "expected 2 fields"); FAIL_IF(mysql_stmt_field_count(stmt) != 2, "expected 2 fields");
FAIL_IF(int_data[0] != 200 || int_data[1] != 300, FAIL_IF(int_data[0] != 200 || int_data[1] != 300,
"expected 100 200 300"); "expected 200 300");
FAIL_IF(mysql_stmt_next_result(stmt) != 0, "expected more results"); FAIL_IF(mysql_stmt_next_result(stmt) != 0, "expected more results");
FAIL_IF(mysql_stmt_field_count(stmt) != 0, "expected 0 fields"); FAIL_IF(mysql_stmt_field_count(stmt) != 0, "expected 0 fields");

View File

@@ -31,9 +31,8 @@ static int test_conc_173(MYSQL *unused __attribute__((unused)))
{ {
MYSQL mysql; MYSQL mysql;
int arg; int arg;
int i=0;
for (;;) for (int i = 0; i < 1000; i++)
{ {
mysql_init(&mysql); mysql_init(&mysql);
mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "client"); mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "client");