Replace check_log_err with log_includes/log_excludes

The latter are more explicit and easier to understand at the call site.

Also removed the redundant crash checks via the log files.
This commit is contained in:
Markus Mäkelä
2018-11-16 12:32:19 +02:00
parent bc8db6d52c
commit 4b6aab1417
38 changed files with 61 additions and 150 deletions

View File

@ -1291,77 +1291,6 @@ static int read_log(const char* name, char** err_log_content_p)
}
}
void TestConnections::check_log_err(int m, const char* err_msg, bool expected)
{
char* err_log_content;
if (verbose)
{
tprintf("Getting logs");
}
char sys1[4096];
char dest[1024];
char log_file[64];
set_timeout(500);
sprintf(dest, "maxscale_log_%03d/", m);
sprintf(&sys1[0],
"mkdir -p maxscale_log_%03d; rm -f %s*.log",
m,
dest);
system(sys1);
sprintf(sys1, "%s/*", maxscales->maxscale_log_dir[m]);
maxscales->copy_from_node(m, sys1, dest);
if (verbose)
{
tprintf("Reading maxscale.log");
}
sprintf(log_file, "maxscale_log_%03d/maxscale.log", m);
if (read_log(log_file, &err_log_content) != 0 || strlen(err_log_content) < 2)
{
if (verbose)
{
tprintf("Reading maxscale1.log");
}
sprintf(log_file, "maxscale_log_%03d/maxscale1.log", m);
free(err_log_content);
if (read_log(log_file, &err_log_content) != 0)
{
add_result(1, "Error reading log");
}
}
if (err_log_content != NULL)
{
if (expected)
{
if (strstr(err_log_content, err_msg) == NULL)
{
add_result(1, "There is NO \"%s\" error in the log", err_msg);
}
else
{
tprintf("There is a proper \"%s \" error in the log", err_msg);
}
}
else
{
if (strstr(err_log_content, err_msg) != NULL)
{
add_result(1, "There is an UNEXPECTED \"%s\" error in the log", err_msg);
}
else
{
tprintf("There are no unxpected \"%s \" errors in the log", err_msg);
}
}
free(err_log_content);
}
}
int TestConnections::find_connected_slave(int m, int* global_result)
{
int conn_num;