Merge branch '2.1' into 2.2

This commit is contained in:
Markus Mäkelä
2018-01-02 09:31:07 +02:00
9 changed files with 86 additions and 25 deletions

View File

@ -15,6 +15,8 @@
#include <iostream>
#include <fstream>
#include <tr1/unordered_map>
#include <maxscale/alloc.h>
#include <maxscale/paths.h>
#include <maxscale/query_classifier.h>
#include <maxscale/log_manager.h>
#include "storagefactory.hh"
@ -126,11 +128,16 @@ int main(int argc, char* argv[])
if ((argc == 2) || (argc == 3))
{
char* libdir = MXS_STRDUP("../../../../../query_classifier/qc_sqlite/");
set_libdir(libdir);
if (mxs_log_init(NULL, ".", MXS_LOG_TARGET_DEFAULT))
{
if (qc_setup(NULL, QC_SQL_MODE_DEFAULT, NULL) && qc_process_init(QC_INIT_BOTH))
{
const char* zModule = argv[1];
libdir = MXS_STRDUP("../storage/storage_inmemory/");
set_libdir(libdir);
StorageFactory* pFactory = StorageFactory::Open(zModule);
@ -172,6 +179,9 @@ int main(int argc, char* argv[])
{
cerr << "error: Could not initialize log." << endl;
}
// TODO: Remove this once globally allocated memory is freed
MXS_FREE(libdir);
}
else
{

View File

@ -13,6 +13,8 @@
#include <maxscale/cppdefs.hh>
#include <iostream>
#include <maxscale/alloc.h>
#include <maxscale/paths.h>
#include "teststorage.hh"
#include "testerlrustorage.hh"
@ -46,7 +48,13 @@ private:
int main(int argc, char* argv[])
{
TestLRUStorage test(&cout);
char* libdir = MXS_STRDUP("../../../../../query_classifier/qc_sqlite/");
set_libdir(libdir);
return test.run(argc, argv);
TestLRUStorage test(&cout);
int rv = test.run(argc, argv);
// TODO: Remove this once globally allocated memory is freed
MXS_FREE(libdir);
return rv;
}

View File

@ -13,6 +13,8 @@
#include <maxscale/cppdefs.hh>
#include <iostream>
#include <maxscale/alloc.h>
#include <maxscale/paths.h>
#include "teststorage.hh"
#include "testerrawstorage.hh"
@ -46,7 +48,13 @@ private:
int main(int argc, char* argv[])
{
TestRawStorage test(&cout);
char* libdir = MXS_STRDUP("../../../../../query_classifier/qc_sqlite/");
set_libdir(libdir);
return test.run(argc, argv);
TestRawStorage test(&cout);
int rv = test.run(argc, argv);
// TODO: Remove this once globally allocated memory is freed
MXS_FREE(libdir);
return rv;
}