Take -Wall into use for tests
Take almost all warnings into use except `format-overflow` and `unused-function`. format-overflow needs to be handled in a separate commit.
This commit is contained in:
parent
0f0913fc99
commit
421e64ceeb
@ -21,10 +21,10 @@ set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of
|
||||
build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug
|
||||
Release RelWithDebInfo MinSizeRel.")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11 -ggdb -Werror")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -ggdb -Werror")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -ggdb -Werror")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-std=c++11 -ggdb -Werror")
|
||||
set(CMAKE_CXX_FLAGS "-std=c++11 -ggdb -Wall -Werror -Wno-format-overflow -Wno-unused-function")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -ggdb -Wall -Werror -Wno-format-overflow -Wno-unused-function")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -ggdb -Wall -Werror -Wno-format-overflow -Wno-unused-function")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-std=c++11 -ggdb -Wall -Werror -Wno-format-overflow -Wno-unused-function")
|
||||
|
||||
enable_testing()
|
||||
|
||||
|
@ -60,8 +60,6 @@ void load(long int *new_inserts, long int *new_selects, long int *selects, long
|
||||
|
||||
pthread_t thread1[threads_num];
|
||||
pthread_t thread2[threads_num];
|
||||
int iret1[threads_num];
|
||||
int iret2[threads_num];
|
||||
|
||||
Test->tprintf("COM_INSERT and COM_SELECT before executing test\n");
|
||||
|
||||
@ -72,8 +70,8 @@ void load(long int *new_inserts, long int *new_selects, long int *selects, long
|
||||
/* Create independent threads each of them will execute function */
|
||||
for (int i = 0; i < threads_num; i++)
|
||||
{
|
||||
iret1[i] = pthread_create(&thread1[i], NULL, query_thread1, &data);
|
||||
iret2[i] = pthread_create(&thread2[i], NULL, query_thread2, &data);
|
||||
pthread_create(&thread1[i], NULL, query_thread1, &data);
|
||||
pthread_create(&thread2[i], NULL, query_thread2, &data);
|
||||
}
|
||||
Test->tprintf("Threads are running %d seconds \n", run_time);
|
||||
sleep(run_time);
|
||||
|
@ -28,9 +28,8 @@ int main(int argc, char *argv[])
|
||||
Test->start_binlog(0);
|
||||
|
||||
pthread_t threads;
|
||||
int iret;
|
||||
exit_flag = 0;
|
||||
iret = pthread_create( &threads, NULL, disconnect_thread, NULL);
|
||||
pthread_create( &threads, NULL, disconnect_thread, NULL);
|
||||
|
||||
Test->repl->connect();
|
||||
for (int i = 0; i < 100000; i++)
|
||||
|
@ -132,15 +132,12 @@ int main(int argc, char *argv[])
|
||||
Test->tprintf("Starting binlog configuration\n");
|
||||
Test->start_binlog(0);
|
||||
|
||||
pthread_t disconnec_thread_t;
|
||||
int disconnect_iret;
|
||||
pthread_t transaction_thread_t;
|
||||
int transaction_iret;
|
||||
|
||||
exit_flag = 0;
|
||||
Test->tprintf("Starting query thread\n");
|
||||
|
||||
transaction_iret = pthread_create(&transaction_thread_t, NULL, transaction_thread, NULL);
|
||||
pthread_create(&transaction_thread_t, NULL, transaction_thread, NULL);
|
||||
|
||||
Test->tprintf("Sleeping\n");
|
||||
Test->stop_timeout();
|
||||
@ -229,7 +226,6 @@ const char * setup_slave_gtid =
|
||||
void select_new_master(TestConnections * test)
|
||||
{
|
||||
char log_file[256];
|
||||
char log_file_new[256];
|
||||
char log_pos[256];
|
||||
|
||||
char maxscale_log_file[256];
|
||||
|
@ -3,9 +3,9 @@
|
||||
int test_longblob(TestConnections* Test, MYSQL * conn, char * blob_name, unsigned long chunk_size, int chunks,
|
||||
int rows)
|
||||
{
|
||||
unsigned long size = chunk_size;
|
||||
int size = chunk_size;
|
||||
unsigned long * data;
|
||||
unsigned long i, j;
|
||||
int i, j;
|
||||
MYSQL_BIND param[1];
|
||||
char sql[256];
|
||||
int global_res = Test->global_result;
|
||||
@ -171,9 +171,9 @@ int check_longblob_data(TestConnections* Test, MYSQL * conn, unsigned long chunk
|
||||
{
|
||||
Test->add_result(1, "id field is wrong! Expected %d, but it is %d\n", row + 1, r_id);
|
||||
}
|
||||
for (int y = 0; y < chunk_size * chunks; y++)
|
||||
for (int y = 0; y < (int)chunk_size * chunks; y++)
|
||||
{
|
||||
if (data[y] != y)
|
||||
if ((int)data[y] != y)
|
||||
{
|
||||
Test->add_result(1, "expected %d, got %d", data[y], y);
|
||||
break;
|
||||
|
@ -12,7 +12,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
char my_ip[1024];
|
||||
char my_ip_db[1024];
|
||||
char sql[1024];
|
||||
char * first_dot;
|
||||
TestConnections * Test = new TestConnections(argc, argv);
|
||||
|
||||
|
@ -140,7 +140,6 @@ int main(int argc, char *argv[])
|
||||
char sql[100];
|
||||
|
||||
pthread_t parall_traffic1;
|
||||
int check_iret;
|
||||
|
||||
MYSQL * conn;
|
||||
MYSQL * rwsplit_conn[conn_N];
|
||||
@ -199,7 +198,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Test->tprintf("Opening more connection to ReadConn slave in parallel thread\n");
|
||||
|
||||
check_iret = pthread_create( ¶ll_traffic1, NULL, parall_traffic, NULL);
|
||||
pthread_create( ¶ll_traffic1, NULL, parall_traffic, NULL);
|
||||
|
||||
for (i = 0; i < Test->repl->N; i++)
|
||||
{
|
||||
|
@ -57,7 +57,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
pthread_t parall_traffic1[100];
|
||||
int check_iret[100];
|
||||
|
||||
Test->set_timeout(60);
|
||||
Test->repl->connect();
|
||||
@ -75,7 +74,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (int j = 0; j < 25; j++)
|
||||
{
|
||||
check_iret[j] = pthread_create(¶ll_traffic1[j], NULL, parall_traffic, NULL);
|
||||
pthread_create(¶ll_traffic1[j], NULL, parall_traffic, NULL);
|
||||
}
|
||||
|
||||
Test->tprintf("Doing change_user in the loop");
|
||||
|
@ -17,7 +17,6 @@ int main(int argc, char *argv[])
|
||||
test.set_timeout(60);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
char result[1024];
|
||||
test.add_result(test.maxscales->ssh_node_f(0, true, "maxadmin show dbusers \"RW Split Router\"|grep 'User names'"),
|
||||
"Old style objects in maxadmin commands should succeed");
|
||||
test.add_result(test.maxscales->ssh_node_f(0, true, "maxadmin show dbusers RW-Split-Router|grep 'User names'"),
|
||||
|
@ -130,13 +130,9 @@ bool cdc_com(TestConnections *Test)
|
||||
|
||||
if (nfds > 0)
|
||||
{
|
||||
// for each ready socket
|
||||
//for(int i = 0; i < nfds; i++)
|
||||
//{
|
||||
int fd = events[0].data.fd;
|
||||
char *json = read_sc(sock);
|
||||
Test->tprintf("%s", json);
|
||||
//}
|
||||
|
||||
if (ignore_first > 0)
|
||||
{
|
||||
ignore_first--; // ignoring first reads
|
||||
|
@ -30,7 +30,7 @@ int main(int argc, char *argv[])
|
||||
Test->set_timeout(60);
|
||||
Test->repl->change_master(1, 0);
|
||||
Test->tprintf("executing 3 INSERTs\n");
|
||||
for (int i = 0; i++; i < 3)
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Test->set_timeout(60);
|
||||
sprintf(sql, "INSERT INTO t1 (x1, fl) VALUES(%d, 2);", i);
|
||||
|
@ -15,7 +15,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
TestConnections * Test = new TestConnections(argc, argv);
|
||||
Test->set_timeout(20);
|
||||
int q;
|
||||
long int i1, i2;
|
||||
|
||||
long int selects[256];
|
||||
|
@ -40,7 +40,6 @@ int hash_password(TestConnections *test)
|
||||
test->maxscales->stop_maxscale(0);
|
||||
test->stop_timeout();
|
||||
|
||||
int res = 0;
|
||||
int exit_code;
|
||||
test->tprintf("Creating a new encrypted password\n");
|
||||
char *enc_pw = test->maxscales->ssh_node_output(0, "maxpasswd /var/lib/maxscale/ skysql", true, &exit_code);
|
||||
|
@ -62,7 +62,6 @@ int main(int argc, char *argv[])
|
||||
char pass_file[4096];
|
||||
char deny_file[4096];
|
||||
char rules_dir[4096];
|
||||
FILE* file;
|
||||
|
||||
sprintf(rules_dir, "%s/fw2/", test_dir);
|
||||
int N = 5;
|
||||
|
@ -33,11 +33,11 @@ int get_my_ip(char * remote_ip, char * my_ip )
|
||||
serv.sin_addr.s_addr = inet_addr( remote_ip );
|
||||
serv.sin_port = htons( dns_port );
|
||||
|
||||
int err = connect( sock , (const struct sockaddr*) &serv , sizeof(serv) );
|
||||
connect( sock , (const struct sockaddr*) &serv , sizeof(serv) );
|
||||
|
||||
struct sockaddr_in name;
|
||||
socklen_t namelen = sizeof(name);
|
||||
err = getsockname(sock, (struct sockaddr*) &name, &namelen);
|
||||
getsockname(sock, (struct sockaddr*) &name, &namelen);
|
||||
|
||||
char buffer[100];
|
||||
const char* p = inet_ntop(AF_INET, &name.sin_addr, buffer, 100);
|
||||
|
@ -390,7 +390,7 @@ int execute_query_count_rows(MYSQL* conn, const char* sql)
|
||||
{
|
||||
rval = 0;
|
||||
|
||||
for (int i = 0; i < total && i < 1024; i++)
|
||||
for (unsigned int i = 0; i < total && i < 1024; i++)
|
||||
{
|
||||
rval += num_of_rows[i];
|
||||
}
|
||||
@ -403,7 +403,6 @@ int get_conn_num(MYSQL* conn, std::string ip, std::string hostname, std::string
|
||||
{
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long long int num_fields;
|
||||
unsigned long long int rows;
|
||||
unsigned long long int i;
|
||||
unsigned int conn_num = 0;
|
||||
@ -436,7 +435,7 @@ int get_conn_num(MYSQL* conn, std::string ip, std::string hostname, std::string
|
||||
}
|
||||
else
|
||||
{
|
||||
num_fields = mysql_num_fields(res);
|
||||
mysql_num_fields(res);
|
||||
rows = mysql_num_rows(res);
|
||||
for (i = 0; i < rows; i++)
|
||||
{
|
||||
@ -472,7 +471,6 @@ int find_field(MYSQL* conn, const char* sql, const char* field_name, char* value
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
MYSQL_FIELD *field;
|
||||
unsigned long long int num_fields;
|
||||
unsigned int ret = 1;
|
||||
unsigned long long int filed_i = 0;
|
||||
unsigned long long int i = 0;
|
||||
@ -492,7 +490,7 @@ int find_field(MYSQL* conn, const char* sql, const char* field_name, char* value
|
||||
}
|
||||
else
|
||||
{
|
||||
num_fields = mysql_num_fields(res);
|
||||
mysql_num_fields(res);
|
||||
while ((field = mysql_fetch_field(res)) && ret != 0)
|
||||
{
|
||||
if (strstr(field->name, field_name) != NULL)
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
*/
|
||||
Mariadb_nodes(const char *pref, const char *test_cwd, bool verbose);
|
||||
|
||||
~Mariadb_nodes();
|
||||
virtual ~Mariadb_nodes();
|
||||
|
||||
/**
|
||||
* @brief MYSQL structs for every backend node
|
||||
|
@ -107,7 +107,7 @@ char * get_maxinfo(const char * page, TestConnections* Test)
|
||||
//Test->tprintf("Query is:\n<<START>>\n%s<<END>>\n", get);
|
||||
|
||||
//Send the query to the server
|
||||
int sent = 0;
|
||||
size_t sent = 0;
|
||||
while (sent < strlen(get))
|
||||
{
|
||||
tmpres = send(sock, get + sent, strlen(get) - sent, 0);
|
||||
@ -178,7 +178,7 @@ char * read_sc(int sock)
|
||||
int send_so(int sock, char * data)
|
||||
{
|
||||
int tmpres;
|
||||
int sent = 0;
|
||||
size_t sent = 0;
|
||||
while (sent < strlen(data))
|
||||
{
|
||||
tmpres = send(sock, data + sent, strlen(data) - sent, 0);
|
||||
|
@ -15,7 +15,7 @@ char * get_maxinfo(const char *page, TestConnections* Test);
|
||||
|
||||
char * read_sc(int sock);
|
||||
int send_so(int sock, char * data);
|
||||
static char hexconvtab[] = "0123456789abcdef";
|
||||
static char hexconvtab[] __attribute__((unused)) = "0123456789abcdef";
|
||||
static char* bin2hex(const unsigned char *old, const size_t oldlen);
|
||||
char * cdc_auth_srt(char * user, char * password);
|
||||
int setnonblocking(int sock);
|
||||
|
@ -31,7 +31,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
|
||||
char server_id[2][1024];
|
||||
test.repl->connect();
|
||||
std::string master = test.repl->get_server_id_str(0);
|
||||
std::string slave = test.repl->get_server_id_str(1);
|
||||
|
@ -35,7 +35,6 @@ void run(TestConnections& test)
|
||||
MYSQL* pMysql = mysql_init(NULL);
|
||||
test.assert(pMysql, "Could not create MYSQL handle.");
|
||||
|
||||
const char* zHost = test.maxscales->IP[0];
|
||||
const char* zUser = test.maxscales->user_name;
|
||||
const char* zPassword = test.maxscales->password;
|
||||
int port = test.maxscales->rwsplit_port[0];
|
||||
|
@ -19,11 +19,11 @@ static int test_long_data(MYSQL *conn, int sqlsize)
|
||||
|
||||
MYSQL_STMT *stmt;
|
||||
stmt = mysql_stmt_init(conn);
|
||||
int rc, int_data;
|
||||
int int_data;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_BIND my_bind[1];
|
||||
|
||||
rc = mysql_autocommit(conn, 1);
|
||||
mysql_autocommit(conn, 1);
|
||||
|
||||
if (NULL == stmt)
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ void create_data_file(char* filename, size_t size)
|
||||
while (filesize < maxsize)
|
||||
{
|
||||
char buffer[1024];
|
||||
sprintf(buffer, "%d,'%x','%x'\n", i, i << 10 + i, i << 5 + i);
|
||||
sprintf(buffer, "%d,'%x','%x'\n", i, i << (10 + i), i << (5 + i));
|
||||
int written = write(fd, buffer, strlen(buffer));
|
||||
if (written <= 0)
|
||||
{
|
||||
@ -67,8 +67,8 @@ int main(int argc, char *argv[])
|
||||
test->tprintf("Re-connect to Maxscale\n");
|
||||
test->set_timeout(20);
|
||||
test->maxscales->connect_maxscale(0);
|
||||
char query[1024];
|
||||
snprintf(query, sizeof (filename),
|
||||
char query[1024 + sizeof(filename)];
|
||||
snprintf(query, sizeof (query),
|
||||
"LOAD DATA LOCAL INFILE '%s' INTO TABLE test.dump FIELDS TERMINATED BY ','",
|
||||
filename);
|
||||
test->tprintf("Loading data\n");
|
||||
|
@ -76,10 +76,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
pthread_t thread1[threads_num];
|
||||
int iret1[threads_num];
|
||||
|
||||
pthread_t thread_master[master_load_threads_num];
|
||||
int iret_master[master_load_threads_num];
|
||||
|
||||
Test->repl->connect();
|
||||
Test->maxscales->connect_maxscale(0);
|
||||
@ -98,13 +96,13 @@ int main(int argc, char *argv[])
|
||||
/* Create independent threads each of them will create some load on Master */
|
||||
for (i = 0; i < master_load_threads_num; i++)
|
||||
{
|
||||
iret_master[i] = pthread_create(&thread_master[i], NULL, query_thread_master, &data_master[i]);
|
||||
pthread_create(&thread_master[i], NULL, query_thread_master, &data_master[i]);
|
||||
}
|
||||
|
||||
/* Create independent threads each of them will execute function */
|
||||
for (i = 0; i < threads_num; i++)
|
||||
{
|
||||
iret1[i] = pthread_create(&thread1[i], NULL, query_thread1, &data[i]);
|
||||
pthread_create(&thread1[i], NULL, query_thread1, &data[i]);
|
||||
}
|
||||
|
||||
Test->tprintf("Threads are running %d seconds \n", run_time);
|
||||
|
@ -54,7 +54,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
pthread_t thread1[threads_num];
|
||||
int iret1[threads_num];
|
||||
|
||||
//Test->repl->flush_hosts();
|
||||
Test->set_timeout(20);
|
||||
@ -98,7 +97,7 @@ int main(int argc, char *argv[])
|
||||
/* Create independent threads each of them will execute function */
|
||||
for (i = 0; i < threads_num; i++)
|
||||
{
|
||||
iret1[i] = pthread_create(&thread1[i], NULL, query_thread1, &data[i]);
|
||||
pthread_create(&thread1[i], NULL, query_thread1, &data[i]);
|
||||
}
|
||||
Test->tprintf("Threads are running %d seconds \n", run_time);
|
||||
|
||||
@ -132,7 +131,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
for (i = 0; i < threads_num; i++)
|
||||
{
|
||||
iret1[i] = pthread_create(&thread1[i], NULL, query_thread1, &data[i]);
|
||||
pthread_create(&thread1[i], NULL, query_thread1, &data[i]);
|
||||
}
|
||||
|
||||
Test->set_timeout(3 * run_time + 60);
|
||||
|
@ -25,7 +25,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Test = new TestConnections(argc, argv);
|
||||
pthread_t restart_t;
|
||||
int check_iret;
|
||||
int i, j;
|
||||
|
||||
|
||||
@ -33,7 +32,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Test->set_timeout(2000);
|
||||
|
||||
check_iret = pthread_create(&restart_t, NULL, kill_vm_thread, NULL);
|
||||
pthread_create(&restart_t, NULL, kill_vm_thread, NULL);
|
||||
|
||||
int iter = 1000;
|
||||
if (Test->smoke)
|
||||
|
@ -32,12 +32,11 @@ void sht_rst_service()
|
||||
int threads_num = 5;
|
||||
pthread_t thread1[threads_num];
|
||||
|
||||
int iret1[threads_num];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < threads_num; i++)
|
||||
{
|
||||
iret1[i] = pthread_create(&thread1[i], NULL, query_thread1, NULL);
|
||||
pthread_create(&thread1[i], NULL, query_thread1, NULL);
|
||||
}
|
||||
|
||||
Test->tprintf("Trying to shutdown and restart RW Split router in the loop\n");
|
||||
|
@ -137,14 +137,9 @@ int main(int argc, char *argv[])
|
||||
add_remove_maxadmin_user(Test);
|
||||
|
||||
Test->tprintf("trying long wierd user\n");
|
||||
char * st10 = Test->maxscales->ssh_node_output(0,
|
||||
Test->maxscales->ssh_node_output(0,
|
||||
"maxadmin enable account yygrgtrпрекури6н33имн756ККККЕН:УИГГГГ*?:*:*fj34oru34h275g23457g2v90590+u764gv56837fbv62381§SDFERGtrg45ergfergergefewfergt456ty",
|
||||
true, &exit_code);
|
||||
/*Test->tprintf("Result: %s\n", st10);
|
||||
if (strstr(st10, "has been successfully added") == NULL)
|
||||
{
|
||||
Test->add_result(1, "Wrong list of MaxAdmin users\n");
|
||||
}*/
|
||||
|
||||
Test->check_maxscale_alive(0);
|
||||
Test->maxscales->ssh_node_f(0, true, "rm -rf /var/lib/maxscale/passwd");
|
||||
|
@ -16,7 +16,7 @@ int main(int argc, char *argv[])
|
||||
sleep(1);
|
||||
|
||||
test->maxscales->connect_maxscale(0);
|
||||
test->try_query(test->maxscales->conn_rwsplit[0], "select @@server_id") == 0;
|
||||
test->try_query(test->maxscales->conn_rwsplit[0], "select @@server_id");
|
||||
config.create_ssl_listener(Config::SERVICE_RCONN_SLAVE);
|
||||
|
||||
MYSQL *conn = open_conn(test->maxscales->readconn_master_port[0], test->maxscales->IP[0],
|
||||
|
@ -185,7 +185,6 @@ void check(XTestConnections& test)
|
||||
}
|
||||
|
||||
std::string values;
|
||||
MYSQL_ROW row;
|
||||
int num_rows = mysql_num_rows(pRes);
|
||||
test.add_result(num_rows != i_end, "Query returned %d rows when %d rows were expected",
|
||||
num_rows, i_end);
|
||||
|
@ -227,7 +227,7 @@ private:
|
||||
int id = s_nRows * random_decimal_fraction();
|
||||
|
||||
ss_dassert(id >= 0);
|
||||
ss_dassert(id <= s_nRows);
|
||||
ss_dassert(id <= (int)s_nRows);
|
||||
|
||||
return id;
|
||||
}
|
||||
@ -503,8 +503,6 @@ void check_server_statuses(TestConnections& test)
|
||||
|
||||
void run(TestConnections& test)
|
||||
{
|
||||
int n_threads = Client::DEFAULT_N_CLIENTS;
|
||||
|
||||
cout << "\nConnecting to MaxScale." << endl;
|
||||
test.maxscales->connect_maxscale();
|
||||
|
||||
|
@ -66,7 +66,6 @@ static void expect(TestConnections& test, const char* zServer, const char* zStat
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
char result_tmp[bufsize];
|
||||
interactive = strcmp(argv[argc - 1], "interactive") == 0;
|
||||
Mariadb_nodes::require_gtid(true);
|
||||
TestConnections test(argc, argv);
|
||||
|
@ -230,7 +230,7 @@ private:
|
||||
int id = s_nRows * random_decimal_fraction();
|
||||
|
||||
ss_dassert(id >= 0);
|
||||
ss_dassert(id <= s_nRows);
|
||||
ss_dassert(id <= (int)s_nRows);
|
||||
|
||||
return id;
|
||||
}
|
||||
@ -559,8 +559,6 @@ void switchover(TestConnections& test, int next_master_id, int current_master_id
|
||||
|
||||
void run(TestConnections& test)
|
||||
{
|
||||
int n_threads = Client::DEFAULT_N_CLIENTS;
|
||||
|
||||
cout << "\nConnecting to MaxScale." << endl;
|
||||
test.maxscales->connect_maxscale();
|
||||
|
||||
|
@ -23,7 +23,7 @@ int main(int argc, char *argv[])
|
||||
char** local_argv = &argv[1];
|
||||
|
||||
TestConnections * Test = new TestConnections(local_argc, local_argv);
|
||||
|
||||
(void)Test;
|
||||
sleep(3);
|
||||
|
||||
return 0;
|
||||
|
@ -35,7 +35,6 @@ json_t * RDS::get_subnets_group_descr(char * json)
|
||||
{
|
||||
json_t *root;
|
||||
json_error_t error;
|
||||
char * j;
|
||||
|
||||
root = json_loads( json, 0, &error );
|
||||
if ( !root )
|
||||
@ -167,7 +166,6 @@ int RDS::destroy_subnets()
|
||||
int RDS::destroy_route_tables()
|
||||
{
|
||||
json_t *root;
|
||||
json_error_t error;
|
||||
char cmd[1024];
|
||||
char * json;
|
||||
|
||||
|
@ -79,10 +79,7 @@ int check_com_select(long int *new_selects, long int *new_inserts, long int *sel
|
||||
int check_com_insert(long int *new_selects, long int *new_inserts, long int *selects, long int *inserts,
|
||||
Mariadb_nodes * Nodes, int expected)
|
||||
{
|
||||
int i;
|
||||
int result = 0;
|
||||
int NodesNum = Nodes->N;
|
||||
|
||||
int diff_ins = new_inserts[0] - inserts[0];
|
||||
int diff_sel = new_selects[0] - selects[0];
|
||||
|
||||
|
@ -22,7 +22,6 @@ int main(int argc, char *argv[])
|
||||
MYSQL *conn[TestConnNum];
|
||||
int i;
|
||||
int conn_num;
|
||||
int res = 0;
|
||||
|
||||
MYSQL * backend_conn;
|
||||
for (i = 0; i < Test->repl->N; i++)
|
||||
|
@ -61,11 +61,11 @@ serversize_rws=1000000
|
||||
|
||||
#include "testconnections.h"
|
||||
|
||||
void check_conn_num(TestConnections* Test, int * Nc, unsigned int conn_num)
|
||||
void check_conn_num(TestConnections* Test, int * Nc)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
conn_num = get_conn_num(Test->galera->nodes[i], Test->maxscales->IP[0], Test->maxscales->hostname[0],
|
||||
int conn_num = get_conn_num(Test->galera->nodes[i], Test->maxscales->IP[0], Test->maxscales->hostname[0],
|
||||
(char *) "test");
|
||||
Test->tprintf("connections to node %d: %u (expected: %u)\n", i, conn_num, Nc[i]);
|
||||
if ((i < 4) && (Nc[i] != conn_num))
|
||||
@ -96,7 +96,6 @@ int main(int argc, char *argv[])
|
||||
Test->tprintf("Sleeping 15 seconds\n");
|
||||
sleep(15);
|
||||
|
||||
unsigned int conn_num;
|
||||
int Nc[4];
|
||||
|
||||
Nc[0] = maxscale_conn_num / 6;
|
||||
@ -105,7 +104,7 @@ int main(int argc, char *argv[])
|
||||
Nc[3] = 0;
|
||||
|
||||
Test->set_timeout(30);
|
||||
check_conn_num(Test, Nc, conn_num);
|
||||
check_conn_num(Test, Nc);
|
||||
|
||||
for (i = 0; i < maxscale_conn_num; i++)
|
||||
{
|
||||
@ -136,7 +135,7 @@ int main(int argc, char *argv[])
|
||||
Nc[0] = maxscale_conn_num;
|
||||
|
||||
Test->set_timeout(30);
|
||||
check_conn_num(Test, Nc, conn_num);
|
||||
check_conn_num(Test, Nc);
|
||||
|
||||
|
||||
for (i = 0; i < maxscale_conn_num; i++)
|
||||
|
@ -17,11 +17,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
TestConnections * Test = new TestConnections(argc, argv);
|
||||
Test->set_timeout(3000);
|
||||
int options_set = 3;
|
||||
if (Test->smoke)
|
||||
{
|
||||
options_set = 1;
|
||||
}
|
||||
|
||||
Test->repl->connect();
|
||||
execute_query(Test->repl->nodes[0], (char *) "DROP TABLE IF EXISTS t1;");
|
||||
@ -30,12 +25,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
Test->binlog_master_gtid = true;
|
||||
Test->binlog_slave_gtid = true;
|
||||
// for (int option = 0; option < options_set; option++)
|
||||
//{
|
||||
// Test->binlog_cmd_option = option;
|
||||
Test->start_binlog(0);
|
||||
test_binlog(Test);
|
||||
//}
|
||||
|
||||
Test->check_log_err(0, "SET NAMES utf8mb4", false);
|
||||
Test->check_log_err(0, "set autocommit=1", false);
|
||||
|
@ -149,7 +149,7 @@ char* allocate_insert_string(int fl, int N)
|
||||
sql_size = 16;
|
||||
}
|
||||
|
||||
if (fl >= sql_size)
|
||||
if ((size_t)fl >= sql_size)
|
||||
{
|
||||
fprintf(stderr, "Insert index %d is too large, setting it to %lu", fl, sql_size - 1);
|
||||
fl = sql_size - 1;
|
||||
@ -212,7 +212,6 @@ int check_if_t1_exists(MYSQL *conn)
|
||||
{
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long long int num_fields;
|
||||
|
||||
int t1 = 0;
|
||||
if (conn != NULL)
|
||||
@ -232,7 +231,7 @@ int check_if_t1_exists(MYSQL *conn)
|
||||
}
|
||||
else
|
||||
{
|
||||
num_fields = mysql_num_fields(res);
|
||||
mysql_num_fields(res);
|
||||
if (mysql_num_rows(res) > 0)
|
||||
{
|
||||
while ((row = mysql_fetch_row(res)) != NULL)
|
||||
|
@ -16,14 +16,13 @@ TestConnections * Test ;
|
||||
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
|
||||
int exit_flag = 0;
|
||||
int start_flag = 0;
|
||||
unsigned int old_slave;
|
||||
int old_slave;
|
||||
void *kill_vm_thread( void *ptr );
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Test = new TestConnections(argc, argv);
|
||||
pthread_t kill_vm_thread1;
|
||||
int check_iret;
|
||||
char sys1[4096];
|
||||
int port[3];
|
||||
|
||||
@ -53,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
for (int k = 0; k < 3; k++)
|
||||
{
|
||||
Test->tprintf("Trying test with port %d\n", port[k]);
|
||||
check_iret = pthread_create( &kill_vm_thread1, NULL, kill_vm_thread, NULL);
|
||||
pthread_create( &kill_vm_thread1, NULL, kill_vm_thread, NULL);
|
||||
|
||||
if (port[k] == Test->maxscales->readconn_slave_port[0] )
|
||||
{
|
||||
@ -137,7 +136,7 @@ void *kill_vm_thread( void *ptr )
|
||||
fflush(stdout);
|
||||
old_slave = 1;
|
||||
}
|
||||
char sys1[4096];
|
||||
|
||||
printf("Killing VM %s\n", Test->repl->IP[old_slave]);
|
||||
fflush(stdout);
|
||||
Test->repl->block_node(old_slave);
|
||||
|
@ -5,13 +5,13 @@ static struct
|
||||
{
|
||||
const char* test_name;
|
||||
const char* test_template;
|
||||
} cnf_templates[] = {
|
||||
} cnf_templates[] __attribute__((unused)) = {
|
||||
@CNF_TEMPLATES@ {NULL, NULL}};
|
||||
|
||||
/** The default template to use */
|
||||
static const char * default_template = "replication";
|
||||
static const char * default_template __attribute__((unused)) = "replication";
|
||||
|
||||
/** This is the working directory for all tests */
|
||||
static const char *test_dir = "@CMAKE_SOURCE_DIR@";
|
||||
static const char *test_dir __attribute__((unused)) = "@CMAKE_SOURCE_DIR@";
|
||||
|
||||
#endif
|
||||
|
@ -67,7 +67,6 @@ void TestConnections::require_galera_version(const char *version)
|
||||
TestConnections::TestConnections(int argc, char *argv[]):
|
||||
enable_timeouts(true),
|
||||
global_result(0),
|
||||
use_ipv6(false),
|
||||
use_snapshots(false),
|
||||
no_backend_log_copy(false),
|
||||
verbose(false),
|
||||
@ -79,7 +78,8 @@ TestConnections::TestConnections(int argc, char *argv[]):
|
||||
binlog_slave_gtid(false),
|
||||
no_galera(false),
|
||||
no_vm_revert(true),
|
||||
threads(4)
|
||||
threads(4),
|
||||
use_ipv6(false)
|
||||
{
|
||||
signal_set(SIGSEGV, sigfatal_handler);
|
||||
signal_set(SIGABRT, sigfatal_handler);
|
||||
@ -499,7 +499,6 @@ void TestConnections::read_env()
|
||||
|
||||
void TestConnections::print_env()
|
||||
{
|
||||
int i;
|
||||
printf("Maxscale IP\t%s\n", maxscales->IP[0]);
|
||||
printf("Maxscale User name\t%s\n", maxscales->user_name);
|
||||
printf("Maxscale Password\t%s\n", maxscales->password);
|
||||
@ -664,7 +663,7 @@ void TestConnections::init_maxscale(int m)
|
||||
|
||||
for (waits = 0; waits < 15; waits++)
|
||||
{
|
||||
if (maxscales->ssh_node(m, "/bin/sh -c \"maxadmin help > /dev/null || exit 1\"", true) == 0);
|
||||
if (maxscales->ssh_node(m, "/bin/sh -c \"maxadmin help > /dev/null || exit 1\"", true) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -1517,11 +1516,8 @@ int TestConnections::get_client_ip(int m, char * ip)
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
int ret = 1;
|
||||
unsigned long long int num_fields;
|
||||
//unsigned long long int row_i=0;
|
||||
unsigned long long int rows;
|
||||
unsigned long long int i;
|
||||
unsigned int conn_num = 0;
|
||||
|
||||
maxscales->connect_rwsplit(m);
|
||||
if (execute_query(maxscales->conn_rwsplit[m],
|
||||
@ -1540,7 +1536,6 @@ int TestConnections::get_client_ip(int m, char * ip)
|
||||
{
|
||||
printf("Error: can't execute SQL-query: show processlist\n");
|
||||
printf("%s\n\n", mysql_error(conn));
|
||||
conn_num = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1548,11 +1543,10 @@ int TestConnections::get_client_ip(int m, char * ip)
|
||||
if (res == NULL)
|
||||
{
|
||||
printf("Error: can't get the result description\n");
|
||||
conn_num = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
num_fields = mysql_num_fields(res);
|
||||
mysql_num_fields(res);
|
||||
rows = mysql_num_rows(res);
|
||||
for (i = 0; i < rows; i++)
|
||||
{
|
||||
@ -1906,8 +1900,6 @@ int TestConnections::revert_snapshot(char * snapshot_name)
|
||||
|
||||
bool TestConnections::test_bad_config(int m, const char *config)
|
||||
{
|
||||
char src[PATH_MAX];
|
||||
|
||||
process_template(m, config, "./");
|
||||
|
||||
// Set the timeout to prevent hangs with configurations that work
|
||||
|
Loading…
x
Reference in New Issue
Block a user