[Unit-tests] Report test failure details as they happen. Fix issue where fst_xcheck definition did not allow its use inside conditional statements.

This commit is contained in:
Chris Rienzo 2021-01-17 14:41:10 -05:00 committed by Andrey Volk
parent e6cd6391ff
commit 451900b353
3 changed files with 11 additions and 7 deletions

View File

@ -2858,6 +2858,10 @@ fct_standard_logger__on_chk(
/* Only record failures. */ /* Only record failures. */
if ( !fctchk__is_pass(e->chk) ) if ( !fctchk__is_pass(e->chk) )
{ {
printf("\nTEST FAIL: %s(%d): %s\n",
fctchk__file(e->chk),
fctchk__lineno(e->chk),
fctchk__msg(e->chk));
fct_logger_record_failure(e->chk, &(logger->failed_cndtns_list)); fct_logger_record_failure(e->chk, &(logger->failed_cndtns_list));
} }
} }

View File

@ -203,13 +203,13 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
* Check a test /w error message * Check a test /w error message
*/ */
#define fst_xcheck(expr, error_msg) \ #define fst_xcheck(expr, error_msg) \
fct_xchk(expr, "%s", error_msg); (fct_xchk(expr, "%s", error_msg))
/** /**
* Fail a test * Fail a test
*/ */
#define fst_fail(error_msg) \ #define fst_fail(error_msg) \
fct_xchk(0, "%s", error_msg); (fct_xchk(0, "%s", error_msg))
/** /**
* Check duration relative to test start, last marked time, or last check. * Check duration relative to test start, last marked time, or last check.
@ -236,7 +236,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
(actual), \ (actual), \
(expected), \ (expected), \
(precision) \ (precision) \
); )
/** /**
* Check if double-precision number is in range * Check if double-precision number is in range
@ -248,7 +248,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
(actual), \ (actual), \
(expected), \ (expected), \
(precision) \ (precision) \
); )
/** /**
* Run test without loading FS core * Run test without loading FS core

View File

@ -63,7 +63,7 @@ FST_TEARDOWN_END()
fst_requires(switch_rtp_ready(rtp_session)); fst_requires(switch_rtp_ready(rtp_session));
switch_rtp_activate_rtcp(rtp_session, 5, rx_port + 1, 0); switch_rtp_activate_rtcp(rtp_session, 5, rx_port + 1, 0);
switch_rtp_set_default_payload(rtp_session, TEST_PT); switch_rtp_set_default_payload(rtp_session, TEST_PT);
fst_xcheck(switch_rtp_get_default_payload(rtp_session) == TEST_PT, "get Payload Type") fst_xcheck(switch_rtp_get_default_payload(rtp_session) == TEST_PT, "get Payload Type");
switch_rtp_set_ssrc(rtp_session, 0xabcd); switch_rtp_set_ssrc(rtp_session, 0xabcd);
switch_rtp_set_remote_ssrc(rtp_session, 0xcdef); switch_rtp_set_remote_ssrc(rtp_session, 0xcdef);
fst_xcheck(switch_rtp_get_ssrc(rtp_session) == 0xabcd, "get SSRC"); fst_xcheck(switch_rtp_get_ssrc(rtp_session) == 0xabcd, "get SSRC");
@ -105,9 +105,9 @@ FST_TEARDOWN_END()
session = switch_rtp_get_core_session(rtp_session); session = switch_rtp_get_core_session(rtp_session);
fst_requires(session); fst_requires(session);
status = switch_rtp_activate_jitter_buffer(rtp_session, 1, 10, 80, 8000); status = switch_rtp_activate_jitter_buffer(rtp_session, 1, 10, 80, 8000);
fst_xcheck(status == SWITCH_STATUS_SUCCESS, "switch_rtp_activate_jitter_buffer()") fst_xcheck(status == SWITCH_STATUS_SUCCESS, "switch_rtp_activate_jitter_buffer()");
status = switch_rtp_debug_jitter_buffer(rtp_session, "debug"); status = switch_rtp_debug_jitter_buffer(rtp_session, "debug");
fst_xcheck(status == SWITCH_STATUS_SUCCESS, "switch_rtp_debug_jitter_buffer()") fst_xcheck(status == SWITCH_STATUS_SUCCESS, "switch_rtp_debug_jitter_buffer()");
fst_requires(switch_rtp_get_jitter_buffer(rtp_session)); fst_requires(switch_rtp_get_jitter_buffer(rtp_session));
status = switch_rtp_pause_jitter_buffer(rtp_session, SWITCH_TRUE); status = switch_rtp_pause_jitter_buffer(rtp_session, SWITCH_TRUE);
fst_xcheck(status == SWITCH_STATUS_SUCCESS, "switch_rtp_pause_jitter_buffer()"); fst_xcheck(status == SWITCH_STATUS_SUCCESS, "switch_rtp_pause_jitter_buffer()");