Fix format-overflow warnings in tests
The tests previously ignored these warnings but the change in compiler flags caused them to fail.
This commit is contained in:
parent
2045ac656b
commit
a6ab05b673
@ -66,7 +66,7 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
TestConnections* Test = new TestConnections(argc, argv);
|
||||
Test->set_timeout(30);
|
||||
char str[1024];
|
||||
char str[4096 + 1024];
|
||||
|
||||
sprintf(str,
|
||||
"php %s/bug729.php %s %d %s %s",
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#define FAILOVER_WAIT_TIME 20
|
||||
|
||||
char virtual_ip[16];
|
||||
char virtual_ip[27];
|
||||
char* print_version_string(TestConnections* Test);
|
||||
void configure_keepalived(TestConnections* Test, char* keepalived_file);
|
||||
void stop_keepalived(TestConnections* Test);
|
||||
|
@ -321,7 +321,7 @@ int Mariadb_nodes::stop_node(int node)
|
||||
|
||||
int Mariadb_nodes::start_node(int node, const char* param)
|
||||
{
|
||||
char cmd[1024];
|
||||
char cmd[PATH_MAX + 1024];
|
||||
if (v51)
|
||||
{
|
||||
sprintf(cmd, "%s %s --report-host", start_db_command[node], param);
|
||||
@ -391,8 +391,8 @@ int Mariadb_nodes::cleanup_db_nodes()
|
||||
|
||||
void Mariadb_nodes::create_users(int node)
|
||||
{
|
||||
char str[1024];
|
||||
char dtr[1024];
|
||||
char str[PATH_MAX + 1024];
|
||||
char dtr[PATH_MAX + 1024];
|
||||
// Create users for replication as well as the users that are used by the tests
|
||||
sprintf(str, "%s/create_user.sh", test_dir);
|
||||
sprintf(dtr, "%s", access_homedir[node]);
|
||||
@ -502,11 +502,13 @@ int Galera_nodes::start_galera()
|
||||
}
|
||||
}
|
||||
|
||||
char str[1024];
|
||||
char str[PATH_MAX + 1024];
|
||||
sprintf(str, "%s/create_user_galera.sh", test_dir);
|
||||
copy_to_node_legacy(str, "~/", 0);
|
||||
|
||||
ssh_node_f(0, false, "export galera_user=\"%s\"; export galera_password=\"%s\"; ./create_user_galera.sh %s",
|
||||
ssh_node_f(0,
|
||||
false,
|
||||
"export galera_user=\"%s\"; export galera_password=\"%s\"; ./create_user_galera.sh %s",
|
||||
user_name,
|
||||
password,
|
||||
socket_cmd[0]);
|
||||
@ -521,10 +523,12 @@ int Galera_nodes::start_galera()
|
||||
|
||||
int Mariadb_nodes::clean_iptables(int node)
|
||||
{
|
||||
return ssh_node_f(node, true,
|
||||
return ssh_node_f(node,
|
||||
true,
|
||||
"while [ \"$(iptables -n -L INPUT 1|grep '%d')\" != \"\" ]; do iptables -D INPUT 1; done;"
|
||||
"while [ \"$(ip6tables -n -L INPUT 1|grep '%d')\" != \"\" ]; do ip6tables -D INPUT 1; done;",
|
||||
port[node], port[node]);
|
||||
port[node],
|
||||
port[node]);
|
||||
}
|
||||
|
||||
int Mariadb_nodes::block_node(int node)
|
||||
@ -1057,7 +1061,8 @@ int Mariadb_nodes::get_version(int i)
|
||||
int local_result = 0;
|
||||
if (find_field(nodes[i], "SELECT @@version", "@@version", version[i]))
|
||||
{
|
||||
cout << "Failed to get version: " << mysql_error(nodes[i]) << ", trying ssh node and use MariaDB client" << endl;
|
||||
cout << "Failed to get version: " << mysql_error(nodes[i])
|
||||
<< ", trying ssh node and use MariaDB client" << endl;
|
||||
str = ssh_node_output(i, "mysql --batch --silent -e \"select @@version\"", true, &ec);
|
||||
if (ec)
|
||||
{
|
||||
@ -1141,14 +1146,15 @@ int Mariadb_nodes::truncate_mariadb_logs()
|
||||
int local_result = 0;
|
||||
for (int node = 0; node < N; node++)
|
||||
{
|
||||
char sys[1024];
|
||||
char sys[PATH_MAX + 1500];
|
||||
if (strcmp(IP[node], "127.0.0.1") != 0)
|
||||
{
|
||||
sprintf(sys,
|
||||
"ssh -i %s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet %s@%s 'sudo truncate /var/lib/mysql/*.err --size 0;sudo rm -f /etc/my.cnf.d/binlog_enc*\' &",
|
||||
sshkey[node],
|
||||
access_user[node],
|
||||
IP[node]);
|
||||
snprintf(sys,
|
||||
sizeof(sys),
|
||||
"ssh -i %s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet %s@%s 'sudo truncate /var/lib/mysql/*.err --size 0;sudo rm -f /etc/my.cnf.d/binlog_enc*\' &",
|
||||
sshkey[node],
|
||||
access_user[node],
|
||||
IP[node]);
|
||||
local_result += system(sys);
|
||||
}
|
||||
}
|
||||
@ -1158,7 +1164,7 @@ int Mariadb_nodes::truncate_mariadb_logs()
|
||||
int Mariadb_nodes::configure_ssl(bool require)
|
||||
{
|
||||
int local_result = 0;
|
||||
char str[1024];
|
||||
char str[PATH_MAX + 256];
|
||||
|
||||
this->ssl = 1;
|
||||
|
||||
|
@ -199,7 +199,7 @@ int main(int argc, char* argv[])
|
||||
fclose(f);
|
||||
|
||||
Test->tprintf("Copying expected script output to Maxscale machine");
|
||||
char str[2048];
|
||||
char str[4096 + 2048];
|
||||
sprintf(str,
|
||||
"scp -i %s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet script_output_expected* %s@%s:%s/",
|
||||
Test->maxscales->sshkey[0],
|
||||
|
@ -659,7 +659,7 @@ void TestConnections::process_template(int m, const char* template_name, const c
|
||||
char str[4096];
|
||||
char template_file[1024];
|
||||
|
||||
char extended_template_file[1024];
|
||||
char extended_template_file[1024 + 12];
|
||||
|
||||
sprintf(template_file, "%s/cnf/maxscale.cnf.template.%s", test_dir, template_name);
|
||||
sprintf(extended_template_file, "%s.%03d", template_file, m);
|
||||
@ -853,9 +853,9 @@ int TestConnections::copy_all_logs()
|
||||
}
|
||||
int TestConnections::copy_maxscale_logs(double timestamp)
|
||||
{
|
||||
char log_dir[1024];
|
||||
char log_dir_i[1024];
|
||||
char sys[1024];
|
||||
char log_dir[PATH_MAX + 1024];
|
||||
char log_dir_i[sizeof(log_dir) + 1024];
|
||||
char sys[sizeof(log_dir_i) + 1024];
|
||||
if (timestamp == 0)
|
||||
{
|
||||
sprintf(log_dir, "LOGS/%s", test_name);
|
||||
@ -872,21 +872,21 @@ int TestConnections::copy_maxscale_logs(double timestamp)
|
||||
if (strcmp(maxscales->IP[i], "127.0.0.1") != 0)
|
||||
{
|
||||
int rc = maxscales->ssh_node_f(i, true,
|
||||
"rm -rf %s/logs;"
|
||||
"mkdir %s/logs;"
|
||||
"cp %s/*.log %s/logs/;"
|
||||
"cp /tmp/core* %s/logs/;"
|
||||
"cp %s %s/logs/;"
|
||||
"chmod 777 -R %s/logs;"
|
||||
"ls /tmp/core* && exit 42;",
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->maxscale_log_dir[i],
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->maxscale_cnf[i],
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->access_homedir[i]);
|
||||
"rm -rf %s/logs;"
|
||||
"mkdir %s/logs;"
|
||||
"cp %s/*.log %s/logs/;"
|
||||
"cp /tmp/core* %s/logs/;"
|
||||
"cp %s %s/logs/;"
|
||||
"chmod 777 -R %s/logs;"
|
||||
"ls /tmp/core* && exit 42;",
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->maxscale_log_dir[i],
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->maxscale_cnf[i],
|
||||
maxscales->access_homedir[i],
|
||||
maxscales->access_homedir[i]);
|
||||
sprintf(sys, "%s/logs/*", maxscales->access_homedir[i]);
|
||||
maxscales->copy_from_node(i, sys, log_dir_i);
|
||||
expect(rc != 42, "Test should not generate core files");
|
||||
@ -2055,14 +2055,14 @@ void TestConnections::check_current_connections(int m, int value)
|
||||
|
||||
int TestConnections::take_snapshot(char* snapshot_name)
|
||||
{
|
||||
char str[4096];
|
||||
char str[PATH_MAX + 4096];
|
||||
sprintf(str, "%s %s", take_snapshot_command, snapshot_name);
|
||||
return call_system(str);
|
||||
}
|
||||
|
||||
int TestConnections::revert_snapshot(char* snapshot_name)
|
||||
{
|
||||
char str[4096];
|
||||
char str[PATH_MAX + 4096];
|
||||
sprintf(str, "%s %s", revert_snapshot_command, snapshot_name);
|
||||
return call_system(str);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user