MaxScale/server/core/test/test_utils.h
Markus Mäkelä 0416d66bcb Set query classifier with an absolute path in tests
Setting the query classifier with an absolute path makes it easier to
manage test setup without having to manually resolve the relative path to
the query classifier from the test source directory.
2018-01-08 09:41:24 +02:00

51 lines
1.2 KiB
C

#pragma once
#ifndef TEST_UTILS_H
#define TEST_UTILS_H
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2019-07-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
#include <maxscale/housekeeper.h>
#include <maxscale/maxscale_test.h>
#include <maxscale/log_manager.h>
#include <maxscale/config.h>
#include <maxscale/query_classifier.h>
#include <maxscale/paths.h>
#include <maxscale/alloc.h>
#include <sys/stat.h>
#include "../maxscale/poll.h"
#include "../maxscale/statistics.h"
void init_test_env(char *path)
{
config_get_global_options()->n_threads = 1;
ts_stats_init();
if (!mxs_log_init(NULL, NULL, MXS_LOG_TARGET_STDOUT))
{
exit(1);
}
dcb_global_init();
set_libdir(MXS_STRDUP(TEST_DIR "/query_classifier/qc_sqlite/"));
qc_setup(NULL, NULL);
qc_process_init(QC_INIT_BOTH);
poll_init();
hkinit();
}
#endif