[test] Disable logs when loading and shutting down FS core

This commit is contained in:
Chris Rienzo
2020-05-16 02:40:51 +00:00
committed by Andrey Volk
parent e1f63ce5b1
commit bd46061a10
4 changed files with 34 additions and 9 deletions
+4 -2
View File
@@ -389,7 +389,8 @@ typedef enum {
SCF_CPF_SOFT_LOOKUP = (1 << 26),
SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY = (1 << 27),
SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE = (1 << 28),
SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON = (1 << 29)
SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON = (1 << 29),
SCF_LOG_DISABLE = (1 << 30)
} switch_core_flag_enum_t;
typedef uint32_t switch_core_flag_t;
@@ -1293,8 +1294,9 @@ typedef enum {
SWITCH_LOG_CRIT = 2,
SWITCH_LOG_ALERT = 1,
SWITCH_LOG_CONSOLE = 0,
SWITCH_LOG_DISABLE = -1,
SWITCH_LOG_INVALID = 64,
SWITCH_LOG_UNINIT = 1000,
SWITCH_LOG_UNINIT = 1000
} switch_log_level_t;
+16 -3
View File
@@ -290,7 +290,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
switch_memory_pool_t *fst_pool = NULL; \
int fst_timer_started = 0; \
fst_getenv_default("FST_SUPPRESS_UNUSED_STATIC_WARNING", NULL, SWITCH_FALSE); \
if (fst_init_core_and_modload(confdir, confdir, 0, flags) == SWITCH_STATUS_SUCCESS) { \
if (fst_init_core_and_modload(confdir, confdir, 0, flags | SCF_LOG_DISABLE) == SWITCH_STATUS_SUCCESS) { \
fst_core = 2; \
} else { \
fprintf(stderr, "Failed to load FS core\n"); \
@@ -327,7 +327,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
switch_memory_pool_t *fst_pool = NULL; \
int fst_timer_started = 0; \
fst_getenv_default("FST_SUPPRESS_UNUSED_STATIC_WARNING", NULL, SWITCH_FALSE); \
if (fst_init_core_and_modload(confdir, NULL, 1, 0) == SWITCH_STATUS_SUCCESS) { /* minimal load */ \
if (fst_init_core_and_modload(confdir, NULL, 1, 0 | SCF_LOG_DISABLE) == SWITCH_STATUS_SUCCESS) { /* minimal load */ \
fst_core = 1; \
} else { \
fprintf(stderr, "Failed to load FS core\n"); \
@@ -446,6 +446,8 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
#define FST_TEST_BEGIN(name) \
FCT_TEST_BGN(name) \
if (fst_core) { \
switch_log_level_t level = SWITCH_LOG_DEBUG; \
switch_core_session_ctl(SCSC_LOGLEVEL, &level); \
fst_requires(fst_pool != NULL); \
if (fst_core > 1) { \
fst_requires(fst_timer_started); \
@@ -456,7 +458,12 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
fst_requires_module(fst_test_module); \
}
#define FST_TEST_END FCT_TEST_END
#define FST_TEST_END \
if (fst_core) { \
switch_log_level_t level = SWITCH_LOG_DISABLE; \
switch_core_session_ctl(SCSC_LOGLEVEL, &level); \
} \
FCT_TEST_END
/**
@@ -483,6 +490,8 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
FCT_TEST_BGN(name) \
{ \
if (fst_core) { \
switch_log_level_t level = SWITCH_LOG_DEBUG; \
switch_core_session_ctl(SCSC_LOGLEVEL, &level); \
fst_requires(fst_pool != NULL); \
if (fst_core > 1) { \
fst_requires(fst_timer_started); \
@@ -540,6 +549,10 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
fst_session_pool = NULL; \
} \
switch_core_session_rwunlock(fst_session); \
if (fst_core) { \
switch_log_level_t level = SWITCH_LOG_DISABLE; \
switch_core_session_ctl(SCSC_LOGLEVEL, &level); \
} \
switch_sleep(1000000); \
} \
} \