From 9d07ffc4ccfc97c0f9e09deea861761f2ed53bd6 Mon Sep 17 00:00:00 2001 From: Miro Stauder Date: Thu, 27 Jul 2023 20:46:51 +0000 Subject: [PATCH] fix warnings --- test/tap/tests/admin_show_create_table-t.cpp | 2 +- test/tap/tests/mysql-init_connect-1-t.cpp | 2 +- test/tap/tests/mysql-init_connect-2-t.cpp | 2 +- test/tap/tests/mysql_stmt_send_long_data_large-t.cpp | 4 ++-- ...reg_test_1574-mariadb_read_stmt_execute_response-t.cpp | 4 ++-- test/tap/tests/reg_test_1574-stmt_metadata-t.cpp | 2 +- .../test-throttle_max_bytes_per_second_to_client-t.cpp | 2 +- test/tap/tests/test_backend_conn_ping-t.cpp | 2 +- test/tap/tests/test_digest_umap_aux-t.cpp | 2 +- test/tap/tests/test_ps_hg_routing-t.cpp | 4 ++-- test/tap/tests/test_unshun_algorithm-t.cpp | 8 ++++---- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/test/tap/tests/admin_show_create_table-t.cpp b/test/tap/tests/admin_show_create_table-t.cpp index 74afc428b..7647e5989 100644 --- a/test/tap/tests/admin_show_create_table-t.cpp +++ b/test/tap/tests/admin_show_create_table-t.cpp @@ -84,7 +84,7 @@ int main() { ok(c != NULL && proxysql_admin->net.compress == 1 && rows==1, "cipher %s and compression (%d) used while reading %lu row(s) from %s", c, proxysql_admin->net.compress, rows, it->c_str()); MYSQL_ROW row; while ((row = mysql_fetch_row(proxy_res))) { - diag(row[1]); + diag("%s", row[1]); } mysql_free_result(proxy_res); } diff --git a/test/tap/tests/mysql-init_connect-1-t.cpp b/test/tap/tests/mysql-init_connect-1-t.cpp index f9317da78..b0643b14a 100644 --- a/test/tap/tests/mysql-init_connect-1-t.cpp +++ b/test/tap/tests/mysql-init_connect-1-t.cpp @@ -108,7 +108,7 @@ int main(int argc, char** argv) { mysql_close(mysql); unsigned long long end = monotonic_time(); unsigned long time_diff_ms = (end-begin)/1000; - ok(time_diff_ms>2900 && time_diff_ms < 3200 , "Total query execution time should be around 3 seconds. Actual : %llums", time_diff_ms); + ok(time_diff_ms>2900 && time_diff_ms < 3200 , "Total query execution time should be around 3 seconds. Actual : %lums", time_diff_ms); } diag("Setting mysql-init_connect to Syntax Error"); diff --git a/test/tap/tests/mysql-init_connect-2-t.cpp b/test/tap/tests/mysql-init_connect-2-t.cpp index 3f3979783..cc9aeea1e 100644 --- a/test/tap/tests/mysql-init_connect-2-t.cpp +++ b/test/tap/tests/mysql-init_connect-2-t.cpp @@ -118,7 +118,7 @@ int main(int argc, char** argv) { mysql_close(mysql); unsigned long long end = monotonic_time(); unsigned long time_diff_ms = (end-begin)/1000; - ok(time_diff_ms>2900 && time_diff_ms < 3200 , "Total query execution time should be around 3 seconds. Actual : %llums", time_diff_ms); + ok(time_diff_ms>2900 && time_diff_ms < 3200 , "Total query execution time should be around 3 seconds. Actual : %lums", time_diff_ms); } diag("Setting mysql_hostgroup_attributes.init_connect to Syntax Error"); diff --git a/test/tap/tests/mysql_stmt_send_long_data_large-t.cpp b/test/tap/tests/mysql_stmt_send_long_data_large-t.cpp index fc9c1d4e6..15486cfa6 100644 --- a/test/tap/tests/mysql_stmt_send_long_data_large-t.cpp +++ b/test/tap/tests/mysql_stmt_send_long_data_large-t.cpp @@ -256,8 +256,8 @@ int main(int argc, char** argv) { diag("Expected: id=%d, k=%d, c=%s, pad=%s", idx, k, p2.c_str(), p3.c_str()); diag("Retrieved: id=%d, k=%d, c=%s, pad=%s", id, k_i, str_data_c, str_data_pad); } else { - diag("Expected: id=%d, k=%d, c=, pad=%s", idx, k, p2.length(), p3.c_str()); - diag("Retrieved: id=%d, k=%d, c=, pad=%s", id, k_i, strlen(str_data_c), str_data_pad); + diag("Expected: id=%d, k=%d, c=, pad=%s", idx, k, p2.length(), p3.c_str()); + diag("Retrieved: id=%d, k=%d, c=, pad=%s", id, k_i, strlen(str_data_c), str_data_pad); } int dm = 0; if (idx==id && k == k_i && strcmp(p2.c_str(),str_data_c)==0 && strcmp(p3.c_str(),str_data_pad)==0) { diff --git a/test/tap/tests/reg_test_1574-mariadb_read_stmt_execute_response-t.cpp b/test/tap/tests/reg_test_1574-mariadb_read_stmt_execute_response-t.cpp index f683bfef3..a803d0d2d 100644 --- a/test/tap/tests/reg_test_1574-mariadb_read_stmt_execute_response-t.cpp +++ b/test/tap/tests/reg_test_1574-mariadb_read_stmt_execute_response-t.cpp @@ -115,9 +115,9 @@ int main(int argc, char** argv) { int field_count = mysql_stmt_field_count(stmt); if (i % 2 == 0) { - ok(field_count == 3, "Field count should be '3' in case of 'i % 2' being '0'"); + ok(field_count == 3, "Field count should be '3' in case of 'i %% 2' being '0'"); } else { - ok(field_count == 1, "Field count should be '1' in case of 'i % 2' being '1'"); + ok(field_count == 1, "Field count should be '1' in case of 'i %% 2' being '1'"); } if (mysql_stmt_close(stmt)) diff --git a/test/tap/tests/reg_test_1574-stmt_metadata-t.cpp b/test/tap/tests/reg_test_1574-stmt_metadata-t.cpp index 5f8743d9e..742ee3aed 100644 --- a/test/tap/tests/reg_test_1574-stmt_metadata-t.cpp +++ b/test/tap/tests/reg_test_1574-stmt_metadata-t.cpp @@ -184,7 +184,7 @@ int main(int argc, char** argv) { ok( data_match_expected, - "Prepared statement result matches expected - Exp=(id:1, c1:100, c2:'abcde'), Act=(id:%d, c1:%d, c2:'%s')", + "Prepared statement result matches expected - Exp=(id:1, c1:100, c2:'abcde'), Act=(id:%d, c1:%ld, c2:'%s')", data_id, data_c1, data_c2 diff --git a/test/tap/tests/test-throttle_max_bytes_per_second_to_client-t.cpp b/test/tap/tests/test-throttle_max_bytes_per_second_to_client-t.cpp index 649c14d9a..3382d1fa2 100644 --- a/test/tap/tests/test-throttle_max_bytes_per_second_to_client-t.cpp +++ b/test/tap/tests/test-throttle_max_bytes_per_second_to_client-t.cpp @@ -68,7 +68,7 @@ int main(int argc, char** argv) { unsigned long time_diff_ms = (end-begin)/1000; - ok(time_diff_ms>20000, "Total query execution time should be more than 20 seconds : %llums", time_diff_ms); + ok(time_diff_ms>20000, "Total query execution time should be more than 20 seconds : %lums", time_diff_ms); MYSQL_QUERY(mysqladmin, "SET mysql-throttle_max_bytes_per_second_to_client=0"); MYSQL_QUERY(mysqladmin, "load mysql variables to runtime"); diff --git a/test/tap/tests/test_backend_conn_ping-t.cpp b/test/tap/tests/test_backend_conn_ping-t.cpp index 07fe6c3c2..2eae63d0b 100644 --- a/test/tap/tests/test_backend_conn_ping-t.cpp +++ b/test/tap/tests/test_backend_conn_ping-t.cpp @@ -385,7 +385,7 @@ int wait_target_backend_conns(MYSQL* admin, uint32_t tg_backend_conns, uint32_t break; } else { waited += 1; - diag("tg_backend_conns: %d, cur_conn_num: %ld , not matching after %lu checks", tg_backend_conns, cur_conn_num, waited); + diag("tg_backend_conns: %d, cur_conn_num: %ld , not matching after %u checks", tg_backend_conns, cur_conn_num, waited); sleep(1); } } diff --git a/test/tap/tests/test_digest_umap_aux-t.cpp b/test/tap/tests/test_digest_umap_aux-t.cpp index 99ceb1692..51ac98247 100644 --- a/test/tap/tests/test_digest_umap_aux-t.cpp +++ b/test/tap/tests/test_digest_umap_aux-t.cpp @@ -280,7 +280,7 @@ int main(int argc, char** argv) { ); ok( ds_vector_after[i].count_star - ds_vector_before[i].count_star == num_dummy_queries_executed, - "Query `%s` should be executed %lld times. Act:'%lld'", + "Query `%s` should be executed %d times. Act:'%lld'", ds_vector_after[i].digest_text.c_str(), num_dummy_queries_executed, ds_vector_after[i].count_star - ds_vector_before[i].count_star ); diff --git a/test/tap/tests/test_ps_hg_routing-t.cpp b/test/tap/tests/test_ps_hg_routing-t.cpp index 1d2eefb3b..ad4da4000 100644 --- a/test/tap/tests/test_ps_hg_routing-t.cpp +++ b/test/tap/tests/test_ps_hg_routing-t.cpp @@ -59,7 +59,7 @@ int main(int argc, char** argv) { MYSQL_QUERY(mysqladmin, "delete from mysql_query_rules"); { - char * query_in = "insert into mysql_query_rules (rule_id, active, flagIN, match_digest, negate_match_pattern, re_modifiers, destination_hostgroup, comment, apply) values (100, 1, 0, \"^SELECT.*FOR UPDATE$\", 0, \"CASELESS\", 0, \"\"\"hello\"\" 'world'\", 1)"; + const char * query_in = "insert into mysql_query_rules (rule_id, active, flagIN, match_digest, negate_match_pattern, re_modifiers, destination_hostgroup, comment, apply) values (100, 1, 0, \"^SELECT.*FOR UPDATE$\", 0, \"CASELESS\", 0, \"\"\"hello\"\" 'world'\", 1)"; char query_out[1024]; mysql_real_escape_string(mysqladmin, query_out, query_in, strlen(query_in)); diag("Running query: %s", query_out); @@ -137,7 +137,7 @@ int main(int argc, char** argv) { } while (!mysql_stmt_fetch(stmt)) { - ok(strcmp((char*)bind[0].buffer, "aaaaaa") == 0, "Read value that was updated. Expected [aaaaaa]. Actual [%s]", bind[0].buffer); + ok(strcmp((char*)bind[0].buffer, "aaaaaa") == 0, "Read value that was updated. Expected [aaaaaa]. Actual [%s]", (char*)bind[0].buffer); } if (mysql_stmt_close(stmt)) diff --git a/test/tap/tests/test_unshun_algorithm-t.cpp b/test/tap/tests/test_unshun_algorithm-t.cpp index 99275f008..6e57c5f8a 100644 --- a/test/tap/tests/test_unshun_algorithm-t.cpp +++ b/test/tap/tests/test_unshun_algorithm-t.cpp @@ -349,13 +349,13 @@ int test_unshun_algorithm_behavior(MYSQL* proxysql_mysql, MYSQL* proxysql_admin) int shunn_err = shunn_all_servers(proxysql_admin); if (shunn_err) { return EXIT_FAILURE; } - diag(""); // empty line + diag(" "); // empty line for (uint32_t i = 0; i < SERVERS_COUNT; i++) { wakup_target_server(proxysql_mysql, i); bool unexp_row_value = server_status_checker(proxysql_admin, "ONLINE", "ONLINE", i); ok(unexp_row_value == false, "Server from first hg was set 'ONLINE' while others remained 'ONLINE'"); - diag(""); // empty line + diag(" "); // empty line if (tests_failed()) { return exit_status(); } @@ -373,7 +373,7 @@ int test_unshun_algorithm_behavior(MYSQL* proxysql_mysql, MYSQL* proxysql_admin) for (uint32_t i = 0; i < SERVERS_COUNT; i++) { wakup_target_server(proxysql_mysql, i); } - diag(""); // empty line + diag(" "); // empty line MYSQL_QUERY(proxysql_admin, "SET mysql-unshun_algorithm=1"); diag("%s: Line:%d running admin query: SET mysql-unshun_algorithm=1", tap_curtime().c_str(), __LINE__); @@ -384,7 +384,7 @@ int test_unshun_algorithm_behavior(MYSQL* proxysql_mysql, MYSQL* proxysql_admin) bool unexp_row_value = server_status_checker(proxysql_admin, "ONLINE", "SHUNNED", i); ok(unexp_row_value == false, "Server from first hg was set 'ONLINE' while others remained 'SHUNNED'"); - diag(""); // empty line + diag(" "); // empty line if (tests_failed()) { return exit_status(); }