| 53 | } |
| 54 | |
| 55 | int run_unit_tests(void) |
| 56 | { |
| 57 | char *error; |
| 58 | void *mod_handle; |
| 59 | mod_tests_f mod_tests; |
| 60 | |
| 61 | /* core tests */ |
| 62 | if (!strcmp(testing_module, "core")) { |
| 63 | /* remember to update the Makefile.test OpenSIPS command-line with at |
| 64 | * least "-m2048 -M128" before stress-testing any of the allocators! */ |
| 65 | //test_malloc(); |
| 66 | test_cachedb(); |
| 67 | test_lib_csv(); |
| 68 | test_parser(); |
| 69 | test_ut(); |
| 70 | test_lib_digest_auth(); |
| 71 | test_db(); |
| 72 | |
| 73 | /* module tests */ |
| 74 | } else { |
| 75 | mod_handle = get_mod_handle(testing_module); |
| 76 | if (!mod_handle) { |
| 77 | LM_ERR("module not loaded / not found: '%s'\n", testing_module); |
| 78 | return -1; |
| 79 | } |
| 80 | |
| 81 | mod_tests = (mod_tests_f)dlsym(mod_handle, DLSYM_PREFIX "mod_tests"); |
| 82 | if ((error = (char *)dlerror())) { |
| 83 | LM_ERR("failed to locate 'mod_tests' in '%s': %s\n", |
| 84 | testing_module, error); |
| 85 | return -1; |
| 86 | } |
| 87 | |
| 88 | mod_tests(); |
| 89 | } |
| 90 | |
| 91 | done_testing(); |
| 92 | } |
no test coverage detected