Skip to content

Commit

Permalink
registrar: Fix missing includes; Make tests more quiet
Browse files Browse the repository at this point in the history
  • Loading branch information
liviuchircu committed Apr 27, 2020
1 parent 6d45aab commit 4943563
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
3 changes: 2 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,8 @@ int main(int argc, char** argv)
LM_NOTICE("enabling logging to standard error (found disabled)\n");
log_stderr = 1;
}
if (*log_level<L_DBG) {
if (*log_level < L_DBG && (!testing_framework ||
!strcmp(testing_module, "core"))) {
LM_NOTICE("setting logging to debug level (found on %d)\n",
*log_level);
*log_level = L_DBG;
Expand Down
4 changes: 3 additions & 1 deletion modules/registrar/test/opensips.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
log_level = 3
log_level = 2
log_stderror = yes

#memdump = 2
Expand All @@ -21,6 +21,8 @@ loadmodule "mi_fifo.so"
################################

loadmodule "tm.so"
modparam("tm", "auto_100trying", 0)

loadmodule "signaling.so"
loadmodule "registrar.so"
loadmodule "event_route.so"
Expand Down
8 changes: 1 addition & 7 deletions modules/registrar/test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ void test_lookup(void)
"gN5eDCyzuomQMyWboTVum0MY8YL_3E8vFIZUur_B71DHVgXQVD6UfZJ"
"mAq9Px0UY8YjVmo2LnmCocmFRBU0gPMV2ebheGGWCc");
str ct2 = str_init("sip:desk@127.0.0.2");
struct ct_match cmatch;
struct sip_msg msg;

ok(ul.register_udomain("location", &d) == 0, "get 'location' udomain");
Expand Down Expand Up @@ -97,15 +96,12 @@ void test_lookup(void)

ok(ul.delete_ucontact(r, c, 0) == 0, "delete ucontact");

cmatch.mode = CT_MATCH_PARAMS;
cmatch.match_params = pn_ct_params;
fill_ucontact_info(&ci);
ok(ul.insert_ucontact(r, &ct1, &ci, &c, 0) == 0, "insert ct1 (PN)");

set_ruri(&msg, &aor_ruri);
ok(lookup(&msg, d, _str(""), NULL) == 2, "lookup-5: 2 (success, PN)");

cmatch.mode = CT_MATCH_CONTACT_ONLY;
fill_ucontact_info(&ci);
ok(ul.insert_ucontact(r, &ct2, &ci, &c, 0) == 0, "insert ct2 (normal)");

Expand All @@ -117,9 +113,7 @@ void test_lookup(void)
}


int mod_tests(void)
void mod_tests(void)
{
test_lookup();

return 0;
}
6 changes: 4 additions & 2 deletions test/unit_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "../mem/test/test_malloc.h"

#include "../lib/list.h"
#include "../globals.h"
#include "../context.h"
#include "../dprint.h"
#include "../sr_module.h"
#include "../sr_module_deps.h"
Expand All @@ -41,9 +43,9 @@ void init_unit_tests(void)
solve_module_dependencies(modules);
//init_cachedb_tests();
//init_malloc_tests();
} else {
ensure_global_context();
}

ensure_global_context();
}

int run_unit_tests(void)
Expand Down
2 changes: 1 addition & 1 deletion test/unit_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* modules/<module>/test/opensips.cfg, and will be automatically used.
* TODO: expand this ^ to a "N x opensips.cfg testing files" mechanism
*/
typedef int (*mod_tests_f) (void);
typedef void (*mod_tests_f) (void);

#ifdef UNIT_TESTS
void init_unit_tests(void);
Expand Down

0 comments on commit 4943563

Please sign in to comment.