]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Unit-tests] Do not initiate sqldb by default unless requested. 209/head
authorAndrey Volk <andywolk@gmail.com>
Thu, 12 Dec 2019 20:54:03 +0000 (00:54 +0400)
committerAndrey Volk <andywolk@gmail.com>
Tue, 7 Jan 2020 17:17:52 +0000 (21:17 +0400)
src/include/test/switch_test.h
tests/unit/switch_core_db.c

index 4e7fcfcd8ac65e173ebe8e2c0e2342688c1af675..215c36ca4dbcd9ca6202d52fdd6f06fc047b2ff0 100644 (file)
@@ -66,7 +66,7 @@ static char *fst_getenv_default(const char *env, char *default_value, switch_boo
 /**
  * initialize FS core from optional configuration dir
  */
-static switch_status_t fst_init_core_and_modload(const char *confdir, const char *basedir, int minimal)
+static switch_status_t fst_init_core_and_modload(const char *confdir, const char *basedir, int minimal, switch_core_flag_t flags)
 {
        switch_status_t status;
        const char *err;
@@ -113,7 +113,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
        switch_core_set_globals();
 
        if (!minimal) {
-               status = switch_core_init_and_modload(SCF_USE_SQL, SWITCH_TRUE, &err);
+               status = switch_core_init_and_modload(flags, SWITCH_TRUE, &err);
                switch_sleep(1 * 1000000);
                switch_core_set_variable("sound_prefix", "." SWITCH_PATH_SEPARATOR);
                if (status != SWITCH_STATUS_SUCCESS && err) {
@@ -256,7 +256,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
                int fst_timer_started = 0; \
                fst_getenv_default("FST_SUPPRESS_UNUSED_STATIC_WARNING", NULL, SWITCH_FALSE); \
                if (fst_core) { \
-                       fst_init_core_and_modload(NULL, NULL, 0); /* shuts up compiler */ \
+                       fst_init_core_and_modload(NULL, NULL, 0, 0); /* shuts up compiler */ \
                } \
                { \
 
@@ -274,7 +274,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
  * Define the beginning of a freeswitch core test driver.  Only one per test application allowed.
  * @param confdir directory containing freeswitch.xml configuration
  */
-#define FST_CORE_BEGIN(confdir) \
+#define FST_CORE_EX_BEGIN(confdir, flags) \
        FCT_BGN() \
        { \
                int fst_core = 0; \
@@ -283,7 +283,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) == SWITCH_STATUS_SUCCESS) { \
+               if (fst_init_core_and_modload(confdir, confdir, 0, flags) == SWITCH_STATUS_SUCCESS) { \
                        fst_core = 2; \
                } else { \
                        fprintf(stderr, "Failed to load FS core\n"); \
@@ -305,6 +305,9 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
        } \
        FCT_END()
 
+#define FST_CORE_BEGIN(confdir) FST_CORE_EX_BEGIN(confdir, 0)
+#define FST_CORE_DB_BEGIN(confdir) FST_CORE_EX_BEGIN(confdir, SCF_USE_SQL)
+
 /**
  * Minimal FS core load
  */
@@ -317,7 +320,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) == SWITCH_STATUS_SUCCESS) { /* minimal load */ \
+               if (fst_init_core_and_modload(confdir, NULL, 1, 0) == SWITCH_STATUS_SUCCESS) { /* minimal load */ \
                        fst_core = 1; \
                } else { \
                        fprintf(stderr, "Failed to load FS core\n"); \
index 50a004fed54739cf9c006c1058992baadb316d40..244ab38398d80da41db7812cdc104f62a04dbd3d 100644 (file)
@@ -34,7 +34,7 @@
 
 #include <test/switch_test.h>
 
-FST_CORE_BEGIN("./conf")
+FST_CORE_DB_BEGIN("./conf")
 {
        FST_SUITE_BEGIN(switch_core_db)
        {