Fix compiler warnings in system tests

This commit is contained in:
Timofey Turenko 2019-02-27 23:15:36 +02:00
parent cc3dbeeb6c
commit 21fc015635
4 changed files with 10 additions and 9 deletions

View File

@ -41,9 +41,9 @@ const char *rules_failure[] =
NULL
};
void truncate_maxscale_logs(TestConnections& test)
int truncate_maxscale_logs(TestConnections& test)
{
test.maxscales->ssh_node(0, "truncate -s 0 /var/log/maxscale/*", true);
return test.maxscales->ssh_node(0, "truncate -s 0 /var/log/maxscale/max*", true);
}
void create_rule(const char *rule, const char* user)
@ -63,7 +63,7 @@ int main(int argc, char** argv)
for (int i = 0; rules_failure[i]; i++)
{
/** Create rule file with syntax error */
truncate(temp_rules, 0);
test.add_result(truncate(temp_rules, 0), "Failed to truncate");
create_rule(rules_failure[i], users_ok[0]);
copy_rules(&test, (char*)temp_rules, (char*)test_dir);
@ -74,7 +74,7 @@ int main(int argc, char** argv)
* a message about the syntax error. */
test.check_maxscale_processes(0, 0);
test.check_log_err(0, "syntax error", true);
truncate_maxscale_logs(test);
test.add_result(truncate_maxscale_logs(test), "Failed to truncate Maxscale logs");
}
return test.global_result;

View File

@ -168,6 +168,7 @@ int RDS::destroy_route_tables()
json_t *root;
char cmd[1024];
char * json;
int res = 0;
sprintf(cmd, "aws ec2 describe-vpcs --vpc-ids=%s", vpc_id_intern);
if (execute_cmd(cmd, &json))
@ -196,11 +197,11 @@ int RDS::destroy_route_tables()
if (strcmp(vpc_id_intern, vpc_id) == 0)
{
sprintf(cmd, "aws ec2 delete-route-table --route-table-id %s", rt_id);
system(cmd);
res += system(cmd);
}
}
return 0;
return res;
}
int RDS::detach_and_destroy_gw()

View File

@ -146,7 +146,7 @@ int main(int argc, char *argv[])
"scp -i %s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet script_output_expected* %s@%s:%s/",
Test->maxscales->sshkey[0], Test->maxscales->access_user[0], Test->maxscales->IP[0],
Test->maxscales->access_homedir[0]);
system(str);
Test->add_result(system(str), "Error copying script to VM");
sprintf(str, "%s/script_output_expected", Test->maxscales->access_homedir[0]);
test_script_monitor(Test, Test->repl, str);

View File

@ -1964,14 +1964,14 @@ void TestConnections::check_current_connections(int m, int value)
int TestConnections::take_snapshot(char * snapshot_name)
{
char str[4096];
char str[strlen(take_snapshot_command) + strlen(snapshot_name) + 2];
sprintf(str, "%s %s", take_snapshot_command, snapshot_name);
return system(str);
}
int TestConnections::revert_snapshot(char * snapshot_name)
{
char str[4096];
char str[strlen(revert_snapshot_command) + strlen(snapshot_name) + 2];
sprintf(str, "%s %s", revert_snapshot_command, snapshot_name);
return system(str);
}