From 7afc51d9aab9588a0435fe6275c3914caf6d2f78 Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Wed, 13 Mar 2013 21:43:39 +0100 Subject: [PATCH] more test fixes --- unittest/libmariadb/basic-t.c | 4 ++-- unittest/libmariadb/connection.c | 1 - unittest/libmariadb/cursor.c | 4 ++++ unittest/libmariadb/misc.c | 9 +++++++-- unittest/libmariadb/ps_bugs.c | 4 ++++ unittest/libmariadb/sqlite3.c | 3 --- unittest/libmariadb/thread.c | 3 ++- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/unittest/libmariadb/basic-t.c b/unittest/libmariadb/basic-t.c index 846e69f4..44cbb4c1 100644 --- a/unittest/libmariadb/basic-t.c +++ b/unittest/libmariadb/basic-t.c @@ -46,9 +46,9 @@ static int basic_connect(MYSQL *mysql) check_mysql_rc(rc, my); res= mysql_store_result(my); - field= mysql_fetch_fields(res); FAIL_IF(!res, mysql_error(my)); - + field= mysql_fetch_fields(res); + FAIL_IF(!field, "couldn't fetch field"); while ((row= mysql_fetch_row(res)) != NULL) { FAIL_IF(mysql_num_fields(res) != 1, "Got the wrong number of fields"); diff --git a/unittest/libmariadb/connection.c b/unittest/libmariadb/connection.c index 6015cece..a902809f 100644 --- a/unittest/libmariadb/connection.c +++ b/unittest/libmariadb/connection.c @@ -169,7 +169,6 @@ static int test_change_user(MYSQL *mysql) diag("Due to mysql_change_user security fix this test will not work anymore."); return(SKIP); - DBUG_ENTER("test_change_user"); /* Prepare environment */ sprintf(buff, "drop database if exists %s", db); diff --git a/unittest/libmariadb/cursor.c b/unittest/libmariadb/cursor.c index 9b9c5db9..7d28b79f 100644 --- a/unittest/libmariadb/cursor.c +++ b/unittest/libmariadb/cursor.c @@ -46,6 +46,10 @@ MYSQL_STMT *open_cursor(MYSQL *mysql, const char *query) MYSQL_STMT *stmt= mysql_stmt_init(mysql); rc= mysql_stmt_prepare(stmt, query, strlen(query)); + if (rc) { + diag("Error: %s", mysql_stmt_error(stmt)); + return NULL; + } mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type); return stmt; } diff --git a/unittest/libmariadb/misc.c b/unittest/libmariadb/misc.c index 5357e978..a3cbfed0 100644 --- a/unittest/libmariadb/misc.c +++ b/unittest/libmariadb/misc.c @@ -51,12 +51,17 @@ static int test_bug28505(MYSQL *mysql) int rc; rc= mysql_query(mysql, "drop table if exists t1"); + check_mysql_rc(rc, mysql); rc= mysql_query(mysql, "create table t1(f1 int primary key)"); + check_mysql_rc(rc, mysql); rc= mysql_query(mysql, "insert into t1 values(1)"); + check_mysql_rc(rc, mysql); rc= mysql_query(mysql, "insert into t1 values(1) on duplicate key update f1=1"); + check_mysql_rc(rc, mysql); res= mysql_affected_rows(mysql); FAIL_UNLESS(!res, "res != 0"); rc= mysql_query(mysql, "drop table t1"); + check_mysql_rc(rc, mysql); return OK; } @@ -251,7 +256,7 @@ static int test_frm_bug(MYSQL *mysql) char test_frm[FN_REFLEN]; int rc; - + return SKIP; mysql_autocommit(mysql, TRUE); rc= mysql_query(mysql, "drop table if exists test_frm_bug"); @@ -815,7 +820,7 @@ struct my_tests_st my_tests[] = { {"test_bug29692", test_bug29692, TEST_CONNECTION_NEW, CLIENT_FOUND_ROWS, NULL, NULL}, {"test_bug31418", test_bug31418, TEST_CONNECTION_DEFAULT, 0, NULL, NULL}, {"test_bug6081", test_bug6081, TEST_CONNECTION_DEFAULT, 0, NULL, NULL}, -// {"test_frm_bug", test_frm_bug, TEST_CONNECTION_NEW, 0, NULL, NULL}, + {"test_frm_bug", test_frm_bug, TEST_CONNECTION_NEW, 0, NULL, NULL}, {"test_wl4166_1", test_wl4166_1, TEST_CONNECTION_NEW, 0, NULL, NULL}, {"test_wl4166_2", test_wl4166_2, TEST_CONNECTION_NEW, 0, NULL, NULL}, {"test_wl4166_3", test_wl4166_3, TEST_CONNECTION_NEW, 0, NULL, NULL}, diff --git a/unittest/libmariadb/ps_bugs.c b/unittest/libmariadb/ps_bugs.c index 8743b936..dbe9cb31 100644 --- a/unittest/libmariadb/ps_bugs.c +++ b/unittest/libmariadb/ps_bugs.c @@ -2885,6 +2885,7 @@ static int test_bug6096(MYSQL *mysql) check_mysql_rc(rc, mysql); query_result= mysql_store_result(mysql); query_field_list= mysql_fetch_fields(query_result); + FAIL_IF(!query_field_list, "fetch_fields faild"); query_field_count= mysql_num_fields(query_result); stmt= mysql_stmt_init(mysql); @@ -3710,6 +3711,8 @@ static int test_bug53311(MYSQL *mysql) return OK; } #define PREPARE_SQL "EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2" + +#ifdef NOT_IN_USE static int test_metadata(MYSQL *mysql) { int rc; @@ -3758,6 +3761,7 @@ end2: end: return 0; } +#endif static int test_conc_5(MYSQL *mysql) { diff --git a/unittest/libmariadb/sqlite3.c b/unittest/libmariadb/sqlite3.c index 48fcd3c7..a81ff05d 100644 --- a/unittest/libmariadb/sqlite3.c +++ b/unittest/libmariadb/sqlite3.c @@ -8,7 +8,6 @@ static int test1(MYSQL *mysql) { MYSQL_ROW row; MYSQL_RES *res; - MYSQL_FIELD *fields; int rc; MYSQL *my= mysql_init(NULL); @@ -47,8 +46,6 @@ static int test1(MYSQL *mysql) res= mysql_use_result(my); FAIL_IF(!res, mysql_error(my)); - fields= mysql_fetch_fields(res); - while ((row= mysql_fetch_row(res)) != NULL) { FAIL_IF(mysql_num_fields(res) != 2, "Got the wrong number of fields"); diff --git a/unittest/libmariadb/thread.c b/unittest/libmariadb/thread.c index f10b2386..78e99fe8 100644 --- a/unittest/libmariadb/thread.c +++ b/unittest/libmariadb/thread.c @@ -20,8 +20,9 @@ static int basic_connect(MYSQL *mysql) check_mysql_rc(rc, my); res= mysql_store_result(my); - field= mysql_fetch_fields(res); FAIL_IF(!res, mysql_error(my)); + field= mysql_fetch_fields(res); + FAIL_IF(!field, "Couldn't fetch fields"); while ((row= mysql_fetch_row(res)) != NULL) {