]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Unit-tests] Improve stability of some tests. 1778/head
authorAndrey Volk <andywolk@gmail.com>
Wed, 24 Aug 2022 14:19:20 +0000 (17:19 +0300)
committerAndrey Volk <andywolk@gmail.com>
Sun, 28 Aug 2022 10:24:43 +0000 (13:24 +0300)
src/mod/applications/mod_test/test/test_tts.c
tests/unit/switch_hold.c
tests/unit/switch_ivr_originate.c
tests/unit/switch_sip.c

index e5ec1aa25458bd5a5d25d14c0cdfacc28a3f0b08..83369212d161dd462db0ac8d9407705c924a3ec6 100644 (file)
@@ -146,7 +146,7 @@ FST_TEST_BEGIN(tts_time)
     } while (status == SWITCH_STATUS_SUCCESS);
 
     fst_check(read = sample_rate / interval * 3); // samples of 3 second
-    fst_check_duration(3000, 750);
+    fst_check_duration(3000, 1000);
     switch_core_speech_close(&sh, &flags);
 }
 FST_TEST_END()
index e48865155bee0781aed141a594011ab1ba8c7d3f..50156e5efe0373051790d1c51ea710ae9da02208 100644 (file)
@@ -1,12 +1,21 @@
 #include <switch.h>
 #include <test/switch_test.h>
 
+int timeout_sec = 10;
+switch_interval_time_t delay_start_ms = 5000;
+
 FST_CORE_DB_BEGIN("./conf_test")
 {
 FST_SUITE_BEGIN(switch_hold)
 {
        FST_SETUP_BEGIN()
        {
+               /* Give mod_sofia time to spinup profile threads */
+               if (delay_start_ms) {
+                       switch_sleep(delay_start_ms * 1000);
+                       delay_start_ms = 0;
+               }
+
                fst_requires_module("mod_sofia");
                fst_requires_module("mod_commands");
        }
@@ -23,7 +32,7 @@ FST_SUITE_BEGIN(switch_hold)
                switch_status_t status;
                switch_call_cause_t cause;
 
-               status = switch_ivr_originate(NULL, &session, &cause, "{ignore_early_media=true}sofia/gateway/test_gateway/+15553332900", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
+               status = switch_ivr_originate(NULL, &session, &cause, "{ignore_early_media=true}sofia/gateway/test_gateway/+15553332900", timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
                fst_requires(session);
                fst_check(status == SWITCH_STATUS_SUCCESS);
 
index 4cf969527523bc8446a38c8f2a31b8ca47801542..5603e18f0ecfe0f049ba640f0d3b4a39c2fe73ad 100644 (file)
@@ -482,7 +482,7 @@ FST_CORE_BEGIN("./conf")
 
                        switch_dial_handle_destroy(&dh);
 
-                       fst_check_duration(3000, 500);
+                       fst_check_duration(3000, 600);
                }
                FST_TEST_END()
 
@@ -513,7 +513,7 @@ FST_CORE_BEGIN("./conf")
 
                        switch_dial_handle_destroy(&dh);
 
-                       fst_check_duration(3000, 500);
+                       fst_check_duration(3000, 600);
                }
                FST_TEST_END()
 
index bcb00eac2b6319f3ec16cd4bd18598d9865d4b84..b535823e121339b8145d57bc396fa6d081fcf7f6 100644 (file)
@@ -1,12 +1,21 @@
 #include <switch.h>
 #include <test/switch_test.h>
 
+int timeout_sec = 10;
+switch_interval_time_t delay_start_ms = 5000;
+
 FST_CORE_DB_BEGIN("./conf_sip")
 {
 FST_SUITE_BEGIN(switch_sip)
 {
        FST_SETUP_BEGIN()
        {
+               /* Give mod_sofia time to spinup profile threads */
+               if (delay_start_ms) {
+                       switch_sleep(delay_start_ms * 1000);
+                       delay_start_ms = 0;
+               }
+
                fst_requires_module("mod_sofia");
                fst_requires_module("mod_hash");
        }
@@ -24,7 +33,7 @@ FST_SUITE_BEGIN(switch_sip)
                const char *data = "eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiI;info=<https://cert.sticr.att.net:8443/certs/att/a937bb15-38b9-45f1-aac0-8cd3f8fe0648>";
                char *originate_str = switch_mprintf("{sip_h_Identity=%s}sofia/gateway/test_gateway/+15553332901", data);
 
-               switch_ivr_originate(NULL, &session, &cause, originate_str, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
+               switch_ivr_originate(NULL, &session, &cause, originate_str, timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
                switch_safe_free(originate_str);
                fst_requires(session);
 
@@ -60,7 +69,7 @@ FST_SUITE_BEGIN(switch_sip)
                const char *data = "eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiI;info=<https://cert.sticr.att.net:8443/certs/att/a937bb15-38b9-45f1-aac0-8cd3f8fe0648>;alg=ES256;ppt=shaken";
                char *originate_str = switch_mprintf("{sip_h_Identity=%s}sofia/gateway/test_gateway/+15553332901", data);
 
-               switch_ivr_originate(NULL, &session, &cause, originate_str, 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
+               switch_ivr_originate(NULL, &session, &cause, originate_str, timeout_sec, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
                switch_safe_free(originate_str);
                fst_requires(session);