privacore-open-source-searc.../test/unit/GigablastTest.cpp

63 lines
1.3 KiB
C++
Raw Permalink Normal View History

#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"
#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>
2016-09-19 06:13:24 -04:00
int main(int argc, char **argv) {
// initialize library
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, "/");
}
g_hostdb.init(-1, false, false, true, currentPath);
2016-09-19 06:13:24 -04:00
g_conf.init(NULL);
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) ) {
log("Unicode initialization failed!");
exit(1);
}
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
}