Merge branch '2.3' into 2.4

This commit is contained in:
Esa Korhonen
2020-03-25 11:09:41 +02:00
12 changed files with 83 additions and 40 deletions

View File

@ -25,6 +25,7 @@ add_library(maxtest SHARED
tcp_connection.cpp
test_binlog_fnc.cpp
testconnections.cpp
${CMAKE_CURRENT_BINARY_DIR}/test_info.cc
# Include the CDC connector in the core library
${CMAKE_SOURCE_DIR}/connectors/cdc-connector/cdc_connector.cpp)

View File

@ -12,7 +12,7 @@
#include "mariadb_func.h"
#include "templates.h"
#include "test_dir.hh"
#include <ctype.h>
#include <sstream>

View File

@ -0,0 +1,11 @@
#include "test_info.hh"
const TestDefinition test_definitions_arr[] =
{
@CNF_TEMPLATES@{nullptr, nullptr, nullptr}
};
const TestDefinition* test_definitions = test_definitions_arr;
const char* default_template = "replication";
const char* test_dir = "@CMAKE_CURRENT_SOURCE_DIR@";

View File

@ -20,6 +20,7 @@
#include "maxadmin_operations.h"
#include "sql_t1.h"
#include "testconnections.h"
#include "test_info.hh"
#include "labels_table.h"
#include "envv.h"
@ -288,7 +289,7 @@ TestConnections::TestConnections(int argc, char* argv[])
test_name = basename(argv[0]);
}
const char * labels_string = NULL;
const char* labels_string = "";
template_name = get_template_name(test_name, &labels_string);
tprintf("testname: '%s', template: '%s'", test_name, template_name);
labels = strstr(labels_string, "LABELS;");
@ -761,25 +762,31 @@ void TestConnections::print_env()
}
}
const char * get_template_name(char * test_name, const char ** labels)
const char* get_template_name(char* test_name, const char** labels)
{
int i = 0;
*labels = NULL;
while (cnf_templates[i].test_name && strcmp(cnf_templates[i].test_name, test_name) != 0)
const TestDefinition* found = nullptr;
for (int i = 0; test_definitions[i].name; i++)
{
i++;
auto* test = &test_definitions[i];
if (strcmp(test->name, test_name) == 0)
{
found = test;
break;
}
}
if (cnf_templates[i].test_name)
if (found)
{
*labels = (char *) cnf_templates[i].test_labels;
return cnf_templates[i].test_template;
*labels = found->labels;
return found->config_template;
}
else
{
printf("Failed to find configuration template for test '%s', using default template '%s'.\n",
test_name, default_template);
return default_template;
}
printf("Failed to find configuration template for test '%s', using default template '%s'.\n",
test_name,
default_template);
return default_template;
}
void TestConnections::process_template(int m, const char* template_name, const char* dest)