2016-09-23 05:05:22 -04:00
|
|
|
#include <gtest/gtest.h>
|
2015-11-11 09:55:07 -05:00
|
|
|
|
|
|
|
#include "Mem.h"
|
2018-02-08 10:13:18 -05:00
|
|
|
#include "UCMaps.h"
|
2016-01-28 05:32:24 -05:00
|
|
|
#include "hash.h"
|
2016-03-17 09:22:27 -04:00
|
|
|
#include "Conf.h"
|
2016-09-19 06:13:24 -04:00
|
|
|
#include "Hostdb.h"
|
2018-04-24 08:35:52 -04:00
|
|
|
#include "Domains.h"
|
2018-07-30 08:37:24 -04:00
|
|
|
#include "Log.h"
|
2015-11-11 09:55:07 -05:00
|
|
|
|
2016-09-19 06:13:24 -04:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <libgen.h>
|
|
|
|
#include <limits.h>
|
2015-11-19 08:43:52 -05:00
|
|
|
|
2016-09-19 06:13:24 -04:00
|
|
|
int main(int argc, char **argv) {
|
|
|
|
// initialize library
|
2015-11-19 08:43:52 -05:00
|
|
|
g_mem.init();
|
2016-09-19 06:13:24 -04:00
|
|
|
hashinit();
|
|
|
|
|
|
|
|
// current dir
|
|
|
|
char tmpPath[PATH_MAX];
|
|
|
|
realpath(argv[0], tmpPath);
|
|
|
|
|
|
|
|
char currentPath[PATH_MAX];
|
|
|
|
strcpy(currentPath, dirname(tmpPath));
|
|
|
|
size_t currentPathLen = strlen(currentPath);
|
|
|
|
if (currentPath[currentPathLen] != '/') {
|
|
|
|
strcat(currentPath, "/");
|
|
|
|
}
|
|
|
|
|
2017-10-18 09:56:51 -04:00
|
|
|
g_hostdb.init(-1, false, false, true, currentPath);
|
2016-09-19 06:13:24 -04:00
|
|
|
g_conf.init(NULL);
|
2015-11-19 08:43:52 -05:00
|
|
|
|
2015-11-11 09:55:07 -05:00
|
|
|
g_log.init("/dev/stdout");
|
|
|
|
|
2016-11-02 09:37:43 -04:00
|
|
|
// merge space
|
|
|
|
strcpy(g_conf.m_mergespaceLockDirectory, currentPath);
|
|
|
|
strcat(g_conf.m_mergespaceLockDirectory, "tmp/gb_merge_locks");
|
|
|
|
strcpy(g_conf.m_mergespaceDirectory, currentPath);
|
|
|
|
strcat(g_conf.m_mergespaceDirectory, "tmp/gb_merge_space");
|
|
|
|
|
|
|
|
/// @todo ALC cleanup tmp merge space
|
|
|
|
|
2018-02-08 10:13:18 -05:00
|
|
|
const char *errmsg;
|
|
|
|
if ( !UnicodeMaps::load_maps("ucdata",&errmsg) ) {
|
2015-11-19 08:43:52 -05:00
|
|
|
log("Unicode initialization failed!");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2018-04-24 08:35:52 -04:00
|
|
|
if(!initializeDomains(g_hostdb.m_dir)) {
|
|
|
|
log("Domains initialization failed!");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2015-11-11 09:55:07 -05:00
|
|
|
::testing::InitGoogleTest(&argc, argv);
|
|
|
|
|
2015-11-26 05:57:56 -05:00
|
|
|
int ret = RUN_ALL_TESTS();
|
|
|
|
|
2018-02-08 10:13:18 -05:00
|
|
|
UnicodeMaps::unload_maps();
|
2015-11-26 05:57:56 -05:00
|
|
|
|
|
|
|
return ret;
|
2015-11-11 09:55:07 -05:00
|
|
|
}
|