|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "ogs-core.h" |
|
|
#include "core/abts.h" |
|
|
|
|
|
extern int __ogs_s1ap_domain; |
|
|
extern int __ogs_ngap_domain; |
|
|
extern int __ogs_nas_domain; |
|
|
extern int __ogs_gtp_domain; |
|
|
extern int __ogs_sbi_domain; |
|
|
|
|
|
void ogs_sbi_message_init(int num_of_request_pool, int num_of_response_pool); |
|
|
void ogs_sbi_message_final(void); |
|
|
|
|
|
abts_suite *test_proto_message(abts_suite *suite); |
|
|
abts_suite *test_s1ap_message(abts_suite *suite); |
|
|
abts_suite *test_nas_message(abts_suite *suite); |
|
|
abts_suite *test_gtp_message(abts_suite *suite); |
|
|
abts_suite *test_ngap_message(abts_suite *suite); |
|
|
abts_suite *test_sbi_message(abts_suite *suite); |
|
|
abts_suite *test_security(abts_suite *suite); |
|
|
abts_suite *test_crash(abts_suite *suite); |
|
|
|
|
|
const struct testlist { |
|
|
abts_suite *(*func)(abts_suite *suite); |
|
|
} alltests[] = { |
|
|
{test_proto_message}, |
|
|
{test_s1ap_message}, |
|
|
{test_nas_message}, |
|
|
{test_gtp_message}, |
|
|
{test_ngap_message}, |
|
|
{test_sbi_message}, |
|
|
{test_security}, |
|
|
{test_crash}, |
|
|
{NULL}, |
|
|
}; |
|
|
|
|
|
static void terminate(void) |
|
|
{ |
|
|
ogs_sbi_message_final(); |
|
|
|
|
|
ogs_pkbuf_default_destroy(); |
|
|
|
|
|
ogs_core_terminate(); |
|
|
} |
|
|
|
|
|
int main(int argc, const char *const argv[]) |
|
|
{ |
|
|
int rv, i, opt; |
|
|
ogs_getopt_t options; |
|
|
struct { |
|
|
char *log_level; |
|
|
char *domain_mask; |
|
|
} optarg; |
|
|
const char *argv_out[argc+3]; |
|
|
|
|
|
abts_suite *suite = NULL; |
|
|
ogs_pkbuf_config_t config; |
|
|
|
|
|
rv = abts_main(argc, argv, argv_out); |
|
|
if (rv != OGS_OK) return rv; |
|
|
|
|
|
memset(&optarg, 0, sizeof(optarg)); |
|
|
ogs_getopt_init(&options, (char**)argv_out); |
|
|
|
|
|
while ((opt = ogs_getopt(&options, "e:m:")) != -1) { |
|
|
switch (opt) { |
|
|
case 'e': |
|
|
optarg.log_level = options.optarg; |
|
|
break; |
|
|
case 'm': |
|
|
optarg.domain_mask = options.optarg; |
|
|
break; |
|
|
case '?': |
|
|
default: |
|
|
fprintf(stderr, "%s: should not be reached\n", OGS_FUNC); |
|
|
return OGS_ERROR; |
|
|
} |
|
|
} |
|
|
|
|
|
ogs_core_initialize(); |
|
|
|
|
|
ogs_pkbuf_default_init(&config); |
|
|
ogs_pkbuf_default_create(&config); |
|
|
|
|
|
ogs_sbi_message_init(32, 32); |
|
|
|
|
|
ogs_log_install_domain(&__ogs_s1ap_domain, "s1ap", OGS_LOG_ERROR); |
|
|
ogs_log_install_domain(&__ogs_ngap_domain, "ngap", OGS_LOG_ERROR); |
|
|
ogs_log_install_domain(&__ogs_nas_domain, "nas", OGS_LOG_ERROR); |
|
|
ogs_log_install_domain(&__ogs_gtp_domain, "gtp", OGS_LOG_ERROR); |
|
|
ogs_log_install_domain(&__ogs_sbi_domain, "sbi", OGS_LOG_ERROR); |
|
|
|
|
|
atexit(terminate); |
|
|
|
|
|
rv = ogs_log_config_domain(optarg.domain_mask, optarg.log_level); |
|
|
if (rv != OGS_OK) return rv; |
|
|
|
|
|
for (i = 0; alltests[i].func; i++) |
|
|
suite = alltests[i].func(suite); |
|
|
|
|
|
return abts_report(suite); |
|
|
} |
|
|
|