提交 2ae3b857 authored 作者: Andrey Volk's avatar Andrey Volk 提交者: Chris Rienzo

FS-11461: [core] Fix mod_av test code on Windows.

上级 0c8f5ed6
...@@ -101,6 +101,8 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir, ...@@ -101,6 +101,8 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir,
SWITCH_GLOBAL_dirs.data_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR); SWITCH_GLOBAL_dirs.data_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
SWITCH_GLOBAL_dirs.localstate_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR); SWITCH_GLOBAL_dirs.localstate_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
switch_core_set_globals();
if (!minimal) { if (!minimal) {
switch_core_init_and_modload(0, SWITCH_TRUE, &err); switch_core_init_and_modload(0, SWITCH_TRUE, &err);
switch_sleep(1 * 1000000); switch_sleep(1 * 1000000);
...@@ -281,6 +283,16 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir, ...@@ -281,6 +283,16 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir,
* @param modname name of module to load. * @param modname name of module to load.
* @param suite the name of this test suite * @param suite the name of this test suite
*/ */
#ifdef WIN32
#define FST_MODULE_BEGIN(modname,suite) \
{ \
const char *fst_test_module = #modname; \
if (fst_core && !zstr(fst_test_module)) { \
const char *err; \
switch_loadable_module_load_module((char *)"./mod", (char *)fst_test_module, SWITCH_FALSE, &err); \
} \
FCT_FIXTURE_SUITE_BGN(suite);
#else
#define FST_MODULE_BEGIN(modname,suite) \ #define FST_MODULE_BEGIN(modname,suite) \
{ \ { \
const char *fst_test_module = #modname; \ const char *fst_test_module = #modname; \
...@@ -289,10 +301,20 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir, ...@@ -289,10 +301,20 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir,
switch_loadable_module_load_module((char *)"../.libs", (char *)fst_test_module, SWITCH_FALSE, &err); \ switch_loadable_module_load_module((char *)"../.libs", (char *)fst_test_module, SWITCH_FALSE, &err); \
} \ } \
FCT_FIXTURE_SUITE_BGN(suite); FCT_FIXTURE_SUITE_BGN(suite);
#endif
/** /**
* Define the end of a FreeSWITCH module test suite. * Define the end of a FreeSWITCH module test suite.
*/ */
#ifdef WIN32
#define FST_MODULE_END() \
FCT_FIXTURE_SUITE_END(); \
if (!zstr(fst_test_module) && switch_loadable_module_exists(fst_test_module) == SWITCH_STATUS_SUCCESS) { \
const char *err; \
switch_loadable_module_unload_module((char *)"./mod", (char *)fst_test_module, SWITCH_FALSE, &err); \
} \
}
#else
#define FST_MODULE_END() \ #define FST_MODULE_END() \
FCT_FIXTURE_SUITE_END(); \ FCT_FIXTURE_SUITE_END(); \
if (!zstr(fst_test_module) && switch_loadable_module_exists(fst_test_module) == SWITCH_STATUS_SUCCESS) { \ if (!zstr(fst_test_module) && switch_loadable_module_exists(fst_test_module) == SWITCH_STATUS_SUCCESS) { \
...@@ -300,7 +322,7 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir, ...@@ -300,7 +322,7 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir,
switch_loadable_module_unload_module((char *)"../.libs", (char *)fst_test_module, SWITCH_FALSE, &err); \ switch_loadable_module_unload_module((char *)"../.libs", (char *)fst_test_module, SWITCH_FALSE, &err); \
} \ } \
} }
#endif
/** /**
* Define the beginning of a test suite not associated with a module. * Define the beginning of a test suite not associated with a module.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论