From b31cb20bae49248e97380942aaa09998dfb71529 Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Thu, 13 Aug 2020 22:38:21 +0300 Subject: [PATCH] MXS-2900 Add parameter checking to tprintf-function --- system-test/auth_change_user_loop.cpp | 2 +- system-test/long_test.cpp | 2 +- system-test/maxtest/include/maxtest/testconnections.h | 2 +- system-test/maxtest/src/big_load.cc | 2 +- system-test/maxtest/src/blob_test.cc | 2 +- system-test/maxtest/src/testconnections.cc | 2 +- system-test/mxs1713_lots_of_databases.cpp | 2 +- system-test/mxs1926_killed_server.cpp | 2 +- system-test/mxs1929_start_from_scratch.cpp | 2 +- system-test/mxs812_1.cpp | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/system-test/auth_change_user_loop.cpp b/system-test/auth_change_user_loop.cpp index 776e4d0e5..ca2244e1f 100644 --- a/system-test/auth_change_user_loop.cpp +++ b/system-test/auth_change_user_loop.cpp @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) Test->maxscales->password, NULL); - Test->tprintf("Dropping user", Test->maxscales->user_name); + Test->tprintf("Dropping user"); Test->try_query(Test->maxscales->conn_rwsplit[0], (char*) "DROP USER user@'%%';"); Test->check_maxscale_alive(0); diff --git a/system-test/long_test.cpp b/system-test/long_test.cpp index 97447b13a..88cd5a0cf 100644 --- a/system-test/long_test.cpp +++ b/system-test/long_test.cpp @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) { data[j][i].sql = (char*) malloc((i +1) * 32 * 14 + 32); create_insert_string(data[j][i].sql, (i + 1) * 32, i); - Test->tprintf("sqL %d: %d\n", i, strlen(data[j][i].sql)); + Test->tprintf("sqL %d: %zu\n", i, strlen(data[j][i].sql)); data[j][i].exit_flag = false; data[j][i].id = i; pthread_create(&thread_id[j][i], NULL, thread[j], &data[j][i]); diff --git a/system-test/maxtest/include/maxtest/testconnections.h b/system-test/maxtest/include/maxtest/testconnections.h index 319eece87..4a2461baf 100644 --- a/system-test/maxtest/include/maxtest/testconnections.h +++ b/system-test/maxtest/include/maxtest/testconnections.h @@ -349,7 +349,7 @@ public: /** * @brief printf with automatic timestamps */ - void tprintf(const char* format, ...); + void tprintf(const char* format, ...) mxb_attribute((format(printf, 2, 3))); /** * @brief Creats t1 table, insert data into it and checks if data can be correctly read from all Maxscale diff --git a/system-test/maxtest/src/big_load.cc b/system-test/maxtest/src/big_load.cc index 859655310..5a7d1a8f9 100644 --- a/system-test/maxtest/src/big_load.cc +++ b/system-test/maxtest/src/big_load.cc @@ -102,7 +102,7 @@ void load(long int* new_inserts, Test->tprintf("COM_INSERT and COM_SELECT after executing test\n"); get_global_status_allnodes(&new_selects[0], &new_inserts[0], nodes, 0); print_delta(&new_selects[0], &new_inserts[0], &selects[0], &inserts[0], nodes->N); - Test->tprintf("First group of threads did %d queries, second - %d \n", data.i1, data.i2); + Test->tprintf("First group of threads did %ld queries, second - %ld \n", data.i1, data.i2); } nodes->close_connections(); *i1 = data.i1; diff --git a/system-test/maxtest/src/blob_test.cc b/system-test/maxtest/src/blob_test.cc index d36f3108f..33d369f25 100644 --- a/system-test/maxtest/src/blob_test.cc +++ b/system-test/maxtest/src/blob_test.cc @@ -55,7 +55,7 @@ int test_longblob(TestConnections* Test, - Test->tprintf("Sending data in %d bytes chunks, total size is %d\n", + Test->tprintf("Sending data in %lu bytes chunks, total size is %lu\n", size * sizeof(unsigned long), (size * sizeof(unsigned long)) * chunks); for (i = 0; i < chunks; i++) diff --git a/system-test/maxtest/src/testconnections.cc b/system-test/maxtest/src/testconnections.cc index 991732578..de00a7a45 100644 --- a/system-test/maxtest/src/testconnections.cc +++ b/system-test/maxtest/src/testconnections.cc @@ -626,7 +626,7 @@ void TestConnections::read_mdbci_info() } if (verbose) { - tprintf(m_network_config.c_str()); + tprintf("%s", m_network_config.c_str()); } } diff --git a/system-test/mxs1713_lots_of_databases.cpp b/system-test/mxs1713_lots_of_databases.cpp index c5cc9a6c5..5113b0c63 100644 --- a/system-test/mxs1713_lots_of_databases.cpp +++ b/system-test/mxs1713_lots_of_databases.cpp @@ -27,7 +27,7 @@ int main(int argc, char** argv) } test.tprintf("Done!"); - test.tprintf("Opening a connection with each database as the default database...", db_list.size()); + test.tprintf("Opening a connection with each database as the default database..."); std::set errors; for (auto db : db_list) diff --git a/system-test/mxs1926_killed_server.cpp b/system-test/mxs1926_killed_server.cpp index 051f00937..a17b8a6a8 100644 --- a/system-test/mxs1926_killed_server.cpp +++ b/system-test/mxs1926_killed_server.cpp @@ -55,7 +55,7 @@ void tune_rowcount(TestConnections& test) int orig = ROWCOUNT; ROWCOUNT = orig / dur.count() * 10000; - test.tprintf("Loading %d rows took %d ms, setting row count to %d", + test.tprintf("Loading %d rows took %ld ms, setting row count to %d", orig, dur.count(), ROWCOUNT.load()); diff --git a/system-test/mxs1929_start_from_scratch.cpp b/system-test/mxs1929_start_from_scratch.cpp index 6fcbe4079..f17b2ae5e 100644 --- a/system-test/mxs1929_start_from_scratch.cpp +++ b/system-test/mxs1929_start_from_scratch.cpp @@ -120,7 +120,7 @@ int main(int argc, char** argv) auto end = std::chrono::steady_clock::now(); - test.tprintf("A total of %d connections were created over %d seconds", + test.tprintf("A total of %d connections were created over %ld seconds", conns.load(), std::chrono::duration_cast(end - start).count()); diff --git a/system-test/mxs812_1.cpp b/system-test/mxs812_1.cpp index 07628a0ea..2a62cfa0f 100644 --- a/system-test/mxs812_1.cpp +++ b/system-test/mxs812_1.cpp @@ -31,7 +31,7 @@ void run_test(TestConnections& test, size_t size, int chunks) mysql_stmt_error(stmt)); std::string data(size, '.'); - test.tprintf("Sending %d x %d bytes of data", size, chunks); + test.tprintf("Sending %zu x %d bytes of data", size, chunks); for (int i = 0; i < chunks; i++) {