Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor test apps to use unit-test framework #4014

Open
wants to merge 72 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
cdd4380
Initial work on unittest framework, tested
bennylp Jun 8, 2024
eaef323
Finished reorganizing pjlib-test to use unit-test framework
bennylp Jun 11, 2024
93f2848
Fix big problem where performance improvement is not observed with th…
bennylp Jun 12, 2024
51d6d93
Tidying up global vars in pjlib-test. Add test options: stop on error…
bennylp Jun 13, 2024
9383baa
Change the PJ_TEST_XX() signature to be more generic and does not for…
bennylp Jun 13, 2024
1d842db
Modifications to some existing tests to use unit-test test macros
bennylp Jun 13, 2024
d8bd130
Updated VS projects with argparse.h and unittest.h
bennylp Jun 14, 2024
c8f93dd
Fix warnings on Windows
bennylp Jun 19, 2024
56d221a
Disable parallel unit-testing for ioqueue stress test on Windows beca…
bennylp Jun 19, 2024
cbefbdf
Non-parallel test case will now run exclusively (previously it did no…
bennylp Jun 20, 2024
19f9f17
Add pjlib-test/test_util.h for common utilities for parsing, configur…
bennylp Jun 20, 2024
b2e3108
Dirty hack to fix error message being displayed when user selected es…
bennylp Jun 20, 2024
13db0c6
Replace PJ_TEST_PARALLEL with PJ_TEST_EXCLUSIVE
bennylp Jun 21, 2024
6bfb5d2
Ported pjnath-test to use unit-testing framework, with limited speed-…
bennylp Jun 21, 2024
2b735d0
Large modifications in pjnath-test to speed-up test. It is fast now (…
bennylp Jun 21, 2024
b8594fe
Ported pjmedia-test to use unit-test
bennylp Jun 22, 2024
af408ea
Porting of pjsip test to unit testing framework. Not much of speed im…
bennylp Jun 25, 2024
4f5d62c
Merged changes from master
bennylp Jun 26, 2024
2e5fa0e
Modifications in pj_argparse API (changed get() to get_bool() and add…
bennylp Jun 26, 2024
d4b267e
Refactor tsx_uas_test() to allow parallel testing
bennylp Jun 26, 2024
f7f7392
Parallelize tsx_uac_test()
bennylp Jun 27, 2024
64d5a61
Further effort to parallize tests in pjsip-test. Discoverd major issu…
bennylp Jun 27, 2024
2b90407
Showing PJLIB config is optional with cmd line option
bennylp Jun 30, 2024
9caadb2
Bug fixing failed pjsip tests when running in parallel mode
bennylp Jun 30, 2024
e886488
Finished paralleizing all pjsip tests except one
bennylp Jul 1, 2024
47d94bb
Continuing correcting errors
bennylp Jul 2, 2024
ed3ac46
Add test shuffle feature
bennylp Jul 2, 2024
97b99c1
Merge #4006 and fix transport_loop_test error
bennylp Jul 2, 2024
46ef3e6
Modify CI workflows to use standard arguments: -w 3 --shuffle. These …
bennylp Jul 3, 2024
b012957
Updated due to change in argparse API signature (swap arg order)
bennylp Jul 10, 2024
37272e8
Merged changes from master (unit test, argparse, etc.)
bennylp Jul 10, 2024
7117775
Removed unittest.md (it was draft for the PR)
bennylp Jul 11, 2024
cfe3a3a
Fix the use of GitHub repository vars
bennylp Jul 11, 2024
3682785
Merge branch 'master' into unittest-framework
bennylp Jul 12, 2024
e1b1e45
Tidying up minor conflicting merge in VC projects and pjlib.h
bennylp Jul 12, 2024
0246ac9
Attempt to fix assertion failure when tdata is being accessed after r…
bennylp Jul 13, 2024
d6b892f
Fixing failure in transport_loop_test(), first in loop_resolve_error(…
bennylp Jul 13, 2024
bd96226
Attempt to fix unresolved winmm.lib API (e.g. timeKillEvent, timeGetT…
bennylp Jul 16, 2024
c930d4c
Split exclusive part of transport_loop_test
bennylp Jul 16, 2024
bc8f174
CI mods: split steps, envs, shorten job names
bennylp Jul 17, 2024
49b3b5c
Fix failed tsx_basic_test
bennylp Jul 17, 2024
5148484
Restore previously shortened job names
bennylp Jul 18, 2024
cf5d2cc
Replace assertion with PJ_TEST_XX in resolver_test
bennylp Jul 18, 2024
4cfff2f
Add --stdout-buf and --stderr-buf options in test apps to control std…
bennylp Jul 18, 2024
72d425e
Fix missing sipp exe on Windows CI
bennylp Jul 18, 2024
311edb9
Fix wrong CI args on Mac. Use -j for faster make
bennylp Jul 18, 2024
78c9adf
Replace pj_rand() with own rand in unittest because rand() yields dif…
bennylp Jul 19, 2024
b08343b
Fix swig make error on Linux and runall.py error reading log file on …
bennylp Jul 19, 2024
7b86a22
Attempt to fix test repeatability by 1) delete all calls to pj_srand(…
bennylp Jul 19, 2024
7dc7ee9
Merge branch 'master' into unittest-framework
bennylp Dec 17, 2024
d0a68f2
Fixed inexistant function
bennylp Dec 17, 2024
988f65d
Relaxing the strictness of the test since sometimes it raises error
bennylp Dec 17, 2024
6e9e4b2
Set regc_test() exclusive because it crashes sometimes, probably conc…
bennylp Dec 17, 2024
6dbb1ba
Modified thread counter to unsigned long (from pj_uint32_t) since the…
bennylp Dec 18, 2024
0f3941c
Fixed port double destruction in mips_test() and include benchmark te…
bennylp Dec 18, 2024
b2a5134
Use any port since sometimes test fails with address in use error
bennylp Dec 18, 2024
420595f
Merge branch 'master' into unittest-framework
bennylp Dec 18, 2024
aea2049
Merge branch 'mips_test' into unittest-framework
bennylp Dec 18, 2024
b69ac09
Merge branch 'master' into unittest-framework
bennylp Dec 18, 2024
d8f0280
Fix conflicted return value in udp_ioqueue_test() and let it immediat…
bennylp Dec 18, 2024
cb5f7f8
Restore sleep(0) in thread test since without it the test may occasio…
bennylp Dec 18, 2024
6d185a6
Various attempt to fix fluke error in resolve_test.c: 1) servers use …
bennylp Dec 19, 2024
01712f1
Merge branch 'master' into unittest-framework
bennylp Dec 19, 2024
97b0949
More relaxed packet count tests in resolver_test
bennylp Dec 19, 2024
d283d3b
Use any port instead of hardcoded one in udp ioqueue unregister_test …
bennylp Dec 19, 2024
cb2074d
Merge branch 'master' into unittest-framework
bennylp Dec 19, 2024
734312f
Rollback previous changes in resolver_test that relaxed packet count …
bennylp Dec 20, 2024
3203ce8
Protect access to pool from worker thread with mutex in resolver_test
bennylp Dec 20, 2024
aea63e2
Faster resolver_test time by reducing timeout
bennylp Dec 20, 2024
1506d37
Merge branch 'unittest-framework' of https://github.com/pjsip/pjproje…
bennylp Dec 20, 2024
58602a4
Use high number port to make it less prone to bind error
bennylp Dec 20, 2024
dadf081
Remove hardcoded port number, replace with bind to any
bennylp Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix warnings on Windows
  • Loading branch information
bennylp committed Jun 19, 2024
commit c8f93dd06204fb9401479bf65990f181010bb252
9 changes: 5 additions & 4 deletions pjlib/src/pj/unittest.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ PJ_DEF(void) pj_test_run(pj_test_runner *runner, pj_test_suite *suite)

/* Initialize suite and test cases */
runner->suite = suite;
runner->ntests = pj_list_size(&suite->tests);
runner->ntests = (unsigned)pj_list_size(&suite->tests);
runner->nruns = 0;

for (tc=suite->tests.next; tc!=&suite->tests;
Expand Down Expand Up @@ -183,7 +183,7 @@ PJ_DEF(void) pj_test_get_stat( const pj_test_suite *suite, pj_test_stat *stat)

pj_bzero(stat, sizeof(*stat));
stat->duration = pj_elapsed_time(&suite->start_time, &suite->end_time);
stat->ntests = pj_list_size(&suite->tests);
stat->ntests = (unsigned)pj_list_size(&suite->tests);

for (tc=suite->tests.next; tc!=&suite->tests; tc=tc->next) {
if (tc->result != PJ_EPENDING) {
Expand Down Expand Up @@ -405,7 +405,7 @@ static int get_completion_line( const pj_test_case *tc, const char *end_line,
tc->obj_name, res_buf, end_line);

if (log_len < 1 || log_len >= sizeof(log_buf))
log_len = pj_ansi_strlen(log_buf);
log_len = (int)pj_ansi_strlen(log_buf);

return log_len;
}
Expand Down Expand Up @@ -473,7 +473,7 @@ static void basic_on_test_complete(pj_test_runner *runner, pj_test_case *tc)
len = pj_ansi_snprintf( line, sizeof(line), "[%2d/%d] ",
runner->nruns, runner->ntests);
if (len < 1 || len >= sizeof(line))
len = pj_ansi_strlen(line);
len = (int)pj_ansi_strlen(line);

len += get_completion_line(tc, "", line+len, sizeof(line)-len);
tc->runner->orig_log_writer(3, line, len);
Expand All @@ -483,6 +483,7 @@ static void basic_on_test_complete(pj_test_runner *runner, pj_test_case *tc)
static void basic_runner_destroy(pj_test_runner *runner)
{
/* Nothing to do for basic runner */
PJ_UNUSED_ARG(runner);
}

/* Initialize a basic runner. */
Expand Down