From 08b3828995d4fcfb32dbba6a92836bf38945d03a Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 30 Mar 2018 23:04:04 +0200 Subject: [PATCH] use osmo_init_logging2() with proper talloc ctx Since the logging allocations now also show up in the root context report, some tests need adjusted talloc checks. In msc_vlr_tests, also output the number of talloc blocks before tests are started to show that the number didn't change after the tests. Change-Id: Iae07ae60230c7bab28e52b5df97fa3844778158e --- src/libgsupclient/gsup_test_client.c | 5 ++- src/osmo-msc/msc_main.c | 2 +- src/utils/smpp_mirror.c | 5 ++- tests/msc_vlr/msc_vlr_test_authen_reuse.err | 17 ++++---- tests/msc_vlr/msc_vlr_test_call.err | 13 ++++--- tests/msc_vlr/msc_vlr_test_gsm_authen.err | 17 ++++---- tests/msc_vlr/msc_vlr_test_gsm_ciph.err | 19 +++++---- tests/msc_vlr/msc_vlr_test_hlr_reject.err | 21 +++++----- tests/msc_vlr/msc_vlr_test_hlr_timeout.err | 9 +++-- tests/msc_vlr/msc_vlr_test_ms_timeout.err | 11 ++++-- tests/msc_vlr/msc_vlr_test_no_authen.err | 21 +++++----- .../msc_vlr_test_reject_concurrency.err | 25 ++++++------ tests/msc_vlr/msc_vlr_test_rest.err | 13 ++++--- tests/msc_vlr/msc_vlr_test_umts_authen.err | 25 ++++++------ tests/msc_vlr/msc_vlr_tests.c | 39 ++++++++++++------- tests/smpp/smpp_test.c | 3 +- tests/sms_queue/sms_queue_test.c | 7 +++- 17 files changed, 150 insertions(+), 102 deletions(-) diff --git a/src/libgsupclient/gsup_test_client.c b/src/libgsupclient/gsup_test_client.c index 03ba68e5a..0ebcd4a3c 100644 --- a/src/libgsupclient/gsup_test_client.c +++ b/src/libgsupclient/gsup_test_client.c @@ -289,10 +289,11 @@ int main(int argc, char **argv) unsigned long long i; char *server_host = "127.0.0.1"; uint16_t server_port = OSMO_GSUP_PORT; + void *ctx = talloc_named_const(NULL, 0, "gsup_test_client"); - osmo_init_logging(&gsup_test_client_log_info); + osmo_init_logging2(ctx, &gsup_test_client_log_info); - g_gc = gsup_client_create(NULL, "GSUPTEST", server_host, server_port, + g_gc = gsup_client_create(ctx, "GSUPTEST", server_host, server_port, gsupc_read_cb, NULL); diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c index 2b1a8c753..85a8fe178 100644 --- a/src/osmo-msc/msc_main.c +++ b/src/osmo-msc/msc_main.c @@ -531,7 +531,7 @@ int main(int argc, char **argv) tall_call_ctx = talloc_named_const(tall_msc_ctx, 0, "gsm_call"); tall_trans_ctx = talloc_named_const(tall_msc_ctx, 0, "transaction"); - osmo_init_logging(&log_info); + osmo_init_logging2(tall_msc_ctx, &log_info); osmo_stats_init(tall_msc_ctx); /* For --version, vty_init() must be called before handling options */ diff --git a/src/utils/smpp_mirror.c b/src/utils/smpp_mirror.c index fa509df7f..30535535b 100644 --- a/src/utils/smpp_mirror.c +++ b/src/utils/smpp_mirror.c @@ -343,12 +343,13 @@ int main(int argc, char **argv) char *host = "localhost"; int port = 0; int rc; + void *ctx = talloc_named_const(NULL, 0, "smpp_mirror"); - msgb_talloc_ctx_init(NULL, 0); + msgb_talloc_ctx_init(ctx, 0); memset(&esme, 0, sizeof(esme)); - osmo_init_logging(&log_info); + osmo_init_logging2(ctx, &log_info); snprintf((char *) esme.system_id, sizeof(esme.system_id), "mirror"); snprintf((char *) esme.password, sizeof(esme.password), "mirror"); diff --git a/tests/msc_vlr/msc_vlr_test_authen_reuse.err b/tests/msc_vlr/msc_vlr_test_authen_reuse.err index cda2bda9e..4f8432afd 100644 --- a/tests/msc_vlr/msc_vlr_test_authen_reuse.err +++ b/tests/msc_vlr/msc_vlr_test_authen_reuse.err @@ -1,3 +1,6 @@ +full talloc report on 'msgb' (total 0 bytes in 1 blocks) +talloc_total_blocks(tall_bsc_ctx) == 12 + ===== test_auth_use_twice_geran - Location Update request causes a GSUP Send Auth Info request to HLR MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_LOC_UPD_REQUEST @@ -424,7 +427,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_auth_use_twice_geran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_auth_use_twice_utran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -884,7 +887,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_auth_use_twice_utran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_auth_use_infinitely_geran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1405,7 +1408,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_auth_use_infinitely_geran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_auth_use_infinitely_utran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1968,7 +1971,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_auth_use_infinitely_utran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_no_auth_reuse_geran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -2289,7 +2292,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_no_auth_reuse_geran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_no_auth_reuse_utran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -2632,8 +2635,8 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_no_auth_reuse_utran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 diff --git a/tests/msc_vlr/msc_vlr_test_call.err b/tests/msc_vlr/msc_vlr_test_call.err index 425762d12..1a21c6bb8 100644 --- a/tests/msc_vlr/msc_vlr_test_call.err +++ b/tests/msc_vlr/msc_vlr_test_call.err @@ -1,3 +1,6 @@ +full talloc report on 'msgb' (total 0 bytes in 1 blocks) +talloc_total_blocks(tall_bsc_ctx) == 12 + ===== test_call_mo - Total time passed: 0.000000 s - Location Update request causes a GSUP Send Auth Info request to HLR @@ -370,7 +373,7 @@ DREF freeing VLR subscr MSISDN:42342 ===== test_call_mo: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_call_mt - Total time passed: 0.000000 s @@ -752,7 +755,7 @@ DREF freeing VLR subscr MSISDN:42342 ===== test_call_mt: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_call_mo_to_unknown - Total time passed: 0.000000 s @@ -1088,7 +1091,7 @@ DREF freeing VLR subscr MSISDN:42342 ===== test_call_mo_to_unknown: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_call_mo_to_unknown_timeout - Total time passed: 0.000000 s @@ -1422,8 +1425,8 @@ DREF freeing VLR subscr MSISDN:42342 ===== test_call_mo_to_unknown_timeout: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 diff --git a/tests/msc_vlr/msc_vlr_test_gsm_authen.err b/tests/msc_vlr/msc_vlr_test_gsm_authen.err index c996f3fc8..ff9f869a1 100644 --- a/tests/msc_vlr/msc_vlr_test_gsm_authen.err +++ b/tests/msc_vlr/msc_vlr_test_gsm_authen.err @@ -1,3 +1,6 @@ +full talloc report on 'msgb' (total 0 bytes in 1 blocks) +talloc_total_blocks(tall_bsc_ctx) == 12 + ===== test_gsm_authen - Location Update request causes a GSUP Send Auth Info request to HLR MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_LOC_UPD_REQUEST @@ -445,7 +448,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_gsm_authen: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_gsm_authen_tmsi - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1098,7 +1101,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_gsm_authen_tmsi: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_gsm_authen_imei - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1318,7 +1321,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_gsm_authen_imei: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_gsm_authen_tmsi_imei - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1569,7 +1572,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_gsm_authen_tmsi_imei: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_gsm_milenage_authen - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1999,7 +2002,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_gsm_milenage_authen: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_wrong_sres_length - Total time passed: 0.000000 s @@ -2113,8 +2116,8 @@ DREF freeing VLR subscr IMSI:901700000004620 ===== test_wrong_sres_length: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 diff --git a/tests/msc_vlr/msc_vlr_test_gsm_ciph.err b/tests/msc_vlr/msc_vlr_test_gsm_ciph.err index 2d60ae9a7..b75ecc221 100644 --- a/tests/msc_vlr/msc_vlr_test_gsm_ciph.err +++ b/tests/msc_vlr/msc_vlr_test_gsm_ciph.err @@ -1,3 +1,6 @@ +full talloc report on 'msgb' (total 0 bytes in 1 blocks) +talloc_total_blocks(tall_bsc_ctx) == 12 + ===== test_ciph - Location Update request causes a GSUP Send Auth Info request to HLR MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_LOC_UPD_REQUEST @@ -493,7 +496,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_ciph: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_ciph_tmsi - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1027,7 +1030,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_ciph_tmsi: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_ciph_imei - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1251,7 +1254,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_ciph_imei: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_ciph_imeisv - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1464,7 +1467,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_ciph_imeisv: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_ciph_tmsi_imei - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1719,7 +1722,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_ciph_tmsi_imei: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_gsm_ciph_in_umts_env - Location Update request causes a GSUP Send Auth Info request to HLR @@ -2185,7 +2188,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_gsm_ciph_in_umts_env: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_a5_3_not_supported - Location Update request causes a GSUP Send Auth Info request to HLR @@ -2283,8 +2286,8 @@ DREF freeing VLR subscr IMSI:901700000004620 ===== test_a5_3_not_supported: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 diff --git a/tests/msc_vlr/msc_vlr_test_hlr_reject.err b/tests/msc_vlr/msc_vlr_test_hlr_reject.err index 5af4e64ec..8a7f90dbe 100644 --- a/tests/msc_vlr/msc_vlr_test_hlr_reject.err +++ b/tests/msc_vlr/msc_vlr_test_hlr_reject.err @@ -1,3 +1,6 @@ +full talloc report on 'msgb' (total 0 bytes in 1 blocks) +talloc_total_blocks(tall_bsc_ctx) == 12 + ===== test_hlr_rej_auth_info_unknown_imsi - Location Update request causes a GSUP Send Auth Info request to HLR MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_LOC_UPD_REQUEST @@ -72,7 +75,7 @@ DREF freeing VLR subscr IMSI:901700000004620 ===== test_hlr_rej_auth_info_unknown_imsi: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_hlr_rej_auth_info_net_fail - Location Update request causes a GSUP Send Auth Info request to HLR @@ -148,7 +151,7 @@ DREF freeing VLR subscr IMSI:901700000004620 ===== test_hlr_rej_auth_info_net_fail: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_hlr_rej_auth_info_net_fail_reuse_tuples --- @@ -451,7 +454,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_hlr_rej_auth_info_net_fail_reuse_tuples: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_hlr_rej_auth_info_net_fail_no_reuse_tuples --- @@ -679,7 +682,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_hlr_rej_auth_info_net_fail_no_reuse_tuples: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_hlr_rej_auth_info_unkown_imsi_no_reuse_tuples --- @@ -908,7 +911,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_hlr_rej_auth_info_unkown_imsi_no_reuse_tuples: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_hlr_acc_but_no_auth_tuples - Location Update request causes a GSUP Send Auth Info request to HLR @@ -983,7 +986,7 @@ DREF freeing VLR subscr IMSI:901700000004620 ===== test_hlr_acc_but_no_auth_tuples: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_hlr_rej_lu - Location Update request causes a GSUP LU request to HLR @@ -1061,7 +1064,7 @@ DREF freeing VLR subscr IMSI:901700000004620 ===== test_hlr_rej_lu: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_hlr_no_insert_data - Location Update request causes a GSUP LU request to HLR @@ -1162,8 +1165,8 @@ DREF freeing VLR subscr IMSI:901700000004620 ===== test_hlr_no_insert_data: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 diff --git a/tests/msc_vlr/msc_vlr_test_hlr_timeout.err b/tests/msc_vlr/msc_vlr_test_hlr_timeout.err index 4d1a99f1f..9409e2657 100644 --- a/tests/msc_vlr/msc_vlr_test_hlr_timeout.err +++ b/tests/msc_vlr/msc_vlr_test_hlr_timeout.err @@ -1,3 +1,6 @@ +full talloc report on 'msgb' (total 0 bytes in 1 blocks) +talloc_total_blocks(tall_bsc_ctx) == 12 + ===== test_hlr_timeout_lu_auth_info - Total time passed: 0.000000 s - Location Update request causes a GSUP Send Auth Info request to HLR @@ -80,7 +83,7 @@ DREF freeing VLR subscr IMSI:901700000004620 ===== test_hlr_timeout_lu_auth_info: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_hlr_timeout_lu_upd_loc_result - Total time passed: 0.000000 s @@ -183,8 +186,8 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_hlr_timeout_lu_upd_loc_result: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 diff --git a/tests/msc_vlr/msc_vlr_test_ms_timeout.err b/tests/msc_vlr/msc_vlr_test_ms_timeout.err index c9259a878..c5ffcf5ca 100644 --- a/tests/msc_vlr/msc_vlr_test_ms_timeout.err +++ b/tests/msc_vlr/msc_vlr_test_ms_timeout.err @@ -1,3 +1,6 @@ +full talloc report on 'msgb' (total 0 bytes in 1 blocks) +talloc_total_blocks(tall_bsc_ctx) == 12 + ===== test_ms_timeout_lu_auth_resp - Total time passed: 0.000000 s - Location Update request causes a GSUP Send Auth Info request to HLR @@ -100,7 +103,7 @@ DREF freeing VLR subscr IMSI:901700000004620 ===== test_ms_timeout_lu_auth_resp: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_ms_timeout_cm_auth_resp - Total time passed: 0.000000 s @@ -336,7 +339,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_ms_timeout_cm_auth_resp: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_ms_timeout_paging - Total time passed: 0.000000 s @@ -519,8 +522,8 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_ms_timeout_paging: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 diff --git a/tests/msc_vlr/msc_vlr_test_no_authen.err b/tests/msc_vlr/msc_vlr_test_no_authen.err index cf34f628f..2d139be63 100644 --- a/tests/msc_vlr/msc_vlr_test_no_authen.err +++ b/tests/msc_vlr/msc_vlr_test_no_authen.err @@ -1,3 +1,6 @@ +full talloc report on 'msgb' (total 0 bytes in 1 blocks) +talloc_total_blocks(tall_bsc_ctx) == 12 + ===== test_no_authen - Location Update request causes a GSUP LU request to HLR MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_LOC_UPD_REQUEST @@ -321,7 +324,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_no_authen: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_no_authen_tmsi - Location Update request causes a GSUP LU request to HLR @@ -833,7 +836,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_no_authen_tmsi: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_no_authen_imei - Location Update request causes a GSUP LU request to HLR @@ -1006,7 +1009,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_no_authen_imei: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_no_authen_tmsi_imei - Location Update request causes a GSUP LU request to HLR @@ -1204,7 +1207,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_no_authen_tmsi_imei: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_no_authen_imeisv - Location Update request causes an IMEISV ID request back to the MS @@ -1362,7 +1365,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_no_authen_imeisv: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_no_authen_imeisv_imei - Location Update request causes an IMEISV ID request back to the MS @@ -1552,7 +1555,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_no_authen_imeisv_imei: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_no_authen_imeisv_tmsi - Location Update request causes an IMEISV ID request back to the MS @@ -1908,7 +1911,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_no_authen_imeisv_tmsi: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_no_authen_imeisv_tmsi_imei - Location Update request causes an IMEISV ID request back to the MS @@ -2124,8 +2127,8 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_no_authen_imeisv_tmsi_imei: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 diff --git a/tests/msc_vlr/msc_vlr_test_reject_concurrency.err b/tests/msc_vlr/msc_vlr_test_reject_concurrency.err index e963ba632..a045e6726 100644 --- a/tests/msc_vlr/msc_vlr_test_reject_concurrency.err +++ b/tests/msc_vlr/msc_vlr_test_reject_concurrency.err @@ -1,3 +1,6 @@ +full talloc report on 'msgb' (total 0 bytes in 1 blocks) +talloc_total_blocks(tall_bsc_ctx) == 12 + ===== test_reject_2nd_conn - Location Update Request on one connection MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_LOC_UPD_REQUEST @@ -152,7 +155,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_reject_2nd_conn: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_reject_lu_during_lu - Location Update Request @@ -277,7 +280,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_reject_lu_during_lu: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_reject_cm_during_lu - Location Update Request @@ -408,7 +411,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_reject_cm_during_lu: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_reject_paging_resp_during_lu - Location Update Request @@ -534,7 +537,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_reject_paging_resp_during_lu: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_reject_lu_during_cm --- @@ -727,7 +730,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_reject_lu_during_cm: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_reject_cm_during_cm --- @@ -922,7 +925,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_reject_cm_during_cm: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_reject_paging_resp_during_cm --- @@ -1123,7 +1126,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_reject_paging_resp_during_cm: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_reject_lu_during_paging_resp --- @@ -1351,7 +1354,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_reject_lu_during_paging_resp: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_accept_cm_during_paging_resp --- @@ -1598,7 +1601,7 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_accept_cm_during_paging_resp: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_reject_paging_resp_during_paging_resp --- @@ -1825,8 +1828,8 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_reject_paging_resp_during_paging_resp: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 diff --git a/tests/msc_vlr/msc_vlr_test_rest.err b/tests/msc_vlr/msc_vlr_test_rest.err index 73a369251..274f4b8a2 100644 --- a/tests/msc_vlr/msc_vlr_test_rest.err +++ b/tests/msc_vlr/msc_vlr_test_rest.err @@ -1,3 +1,6 @@ +full talloc report on 'msgb' (total 0 bytes in 1 blocks) +talloc_total_blocks(tall_bsc_ctx) == 12 + ===== test_early_stage - NULL conn msc_subscr_conn_is_accepted() == false @@ -40,7 +43,7 @@ DMM Subscr_Conn(test){SUBSCR_CONN_S_RELEASED}: Deallocated ===== test_early_stage: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_cm_service_without_lu - CM Service Request without a prior Location Updating @@ -83,7 +86,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_cm_service_without_lu: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_two_lu - Location Update request causes a GSUP LU request to HLR @@ -340,7 +343,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_two_lu: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_lu_unknown_tmsi - Location Update request with unknown TMSI sends ID Request for IMSI @@ -489,8 +492,8 @@ DREF freeing VLR subscr MSISDN:46071 ===== test_lu_unknown_tmsi: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 diff --git a/tests/msc_vlr/msc_vlr_test_umts_authen.err b/tests/msc_vlr/msc_vlr_test_umts_authen.err index fa820f72c..e6cb9a34d 100644 --- a/tests/msc_vlr/msc_vlr_test_umts_authen.err +++ b/tests/msc_vlr/msc_vlr_test_umts_authen.err @@ -1,3 +1,6 @@ +full talloc report on 'msgb' (total 0 bytes in 1 blocks) +talloc_total_blocks(tall_bsc_ctx) == 12 + ===== test_umts_authen_geran - Location Update request causes a GSUP Send Auth Info request to HLR MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_LOC_UPD_REQUEST @@ -459,7 +462,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_umts_authen_geran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_umts_authen_utran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -954,7 +957,7 @@ DRLL Freeing subscriber connection with NULL subscriber ===== test_umts_authen_utran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_umts_authen_resync_geran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1167,7 +1170,7 @@ DREF freeing VLR subscr MSISDN:42342 ===== test_umts_authen_resync_geran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_umts_authen_resync_utran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1392,7 +1395,7 @@ DREF freeing VLR subscr MSISDN:42342 ===== test_umts_authen_resync_utran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_umts_authen_too_short_res_geran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1486,7 +1489,7 @@ DREF freeing VLR subscr IMSI:901700000010650 ===== test_umts_authen_too_short_res_geran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_umts_authen_too_short_res_utran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1580,7 +1583,7 @@ DREF freeing VLR subscr IMSI:901700000010650 ===== test_umts_authen_too_short_res_utran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_umts_authen_too_long_res_geran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1674,7 +1677,7 @@ DREF freeing VLR subscr IMSI:901700000010650 ===== test_umts_authen_too_long_res_geran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_umts_authen_too_long_res_utran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1768,7 +1771,7 @@ DREF freeing VLR subscr IMSI:901700000010650 ===== test_umts_authen_too_long_res_utran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_umts_authen_only_sres_geran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1862,7 +1865,7 @@ DREF freeing VLR subscr IMSI:901700000010650 ===== test_umts_authen_only_sres_geran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 ===== test_umts_authen_only_sres_utran - Location Update request causes a GSUP Send Auth Info request to HLR @@ -1956,8 +1959,8 @@ DREF freeing VLR subscr IMSI:901700000010650 ===== test_umts_authen_only_sres_utran: SUCCESS full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(tall_bsc_ctx) == 7 +talloc_total_blocks(tall_bsc_ctx) == 12 diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c index 709355ce8..523f74fe4 100644 --- a/tests/msc_vlr/msc_vlr_tests.c +++ b/tests/msc_vlr/msc_vlr_tests.c @@ -805,23 +805,29 @@ void fake_time_start() fake_time_passes(0, 0); } -static void check_talloc(void *msgb_ctx, void *msc_vlr_tests_ctx, int expected_blocks) +static void check_talloc(void *msgb_ctx, void *msc_vlr_tests_ctx) { + /* Verifying that the msgb context is empty */ talloc_report_full(msgb_ctx, stderr); /* Expecting these to stick around in msc_vlr_tests_ctx: -full talloc report on 'msgb' (total 0 bytes in 1 blocks) -talloc_total_blocks(msc_vlr_tests_ctx) == 7 -full talloc report on 'subscr_conn_test_ctx' (total 2642 bytes in 8 blocks) - struct gsup_client contains 248 bytes in 1 blocks (ref 0) 0x61300000dee0 - struct gsm_network contains 2023 bytes in 6 blocks (ref 0) 0x61700000fce0 - struct vlr_instance contains 160 bytes in 1 blocks (ref 0) 0x611000009a60 - no_gsup_server contains 15 bytes in 1 blocks (ref 0) 0x60b00000ade0 - ../../../src/libosmocore/src/rate_ctr.c:199 contains 1552 bytes in 1 blocks (ref 0) 0x61b00001eae0 - msgb contains 0 bytes in 1 blocks (ref 0) 0x60800000bf80 - */ + * talloc_total_blocks(tall_bsc_ctx) == 12 + * full talloc report on 'msc_vlr_tests_ctx' (total 3636 bytes in 12 blocks) + * struct gsup_client contains 248 bytes in 1 blocks (ref 0) 0x563a489c05f0 + * struct gsm_network contains 2031 bytes in 4 blocks (ref 0) 0x563a489bfbb0 + * struct vlr_instance contains 168 bytes in 1 blocks (ref 0) 0x563a489c04e0 + * no_gsup_server contains 15 bytes in 1 blocks (ref 0) 0x563a489c0460 + * ../../../src/libosmocore/src/rate_ctr.c:228 contains 1552 bytes in 1 blocks (ref 0) 0x563a489bfd40 + * logging contains 1357 bytes in 5 blocks (ref 0) 0x563a489bf440 + * struct log_target contains 228 bytes in 2 blocks (ref 0) 0x563a489bf9f0 + * struct log_category contains 68 bytes in 1 blocks (ref 0) 0x563a489bfb00 + * struct log_info contains 1128 bytes in 2 blocks (ref 0) 0x563a489bf4b0 + * struct log_info_cat contains 1088 bytes in 1 blocks (ref 0) 0x563a489bf540 + * msgb contains 0 bytes in 1 blocks (ref 0) 0x563a489bf3d0 + * (That's 12 counting the root ctx) + */ fprintf(stderr, "talloc_total_blocks(tall_bsc_ctx) == %zu\n", talloc_total_blocks(msc_vlr_tests_ctx)); - if (talloc_total_blocks(msc_vlr_tests_ctx) != expected_blocks) + if (talloc_total_blocks(msc_vlr_tests_ctx) != 12) talloc_report_full(msc_vlr_tests_ctx, stderr); fprintf(stderr, "\n"); } @@ -882,6 +888,9 @@ void *msgb_ctx = NULL; static void run_tests(int nr) { int test_nr; + + check_talloc(msgb_ctx, msc_vlr_tests_ctx); + nr--; /* arg's first test is 1, in here it's 0 */ for (test_nr = 0; msc_vlr_tests[test_nr]; test_nr++) { if (nr >= 0 && test_nr != nr) @@ -895,7 +904,7 @@ static void run_tests(int nr) if (cmdline_opts.verbose) fprintf(stderr, "(test nr %d)\n", test_nr + 1); - check_talloc(msgb_ctx, msc_vlr_tests_ctx, 7); + check_talloc(msgb_ctx, msc_vlr_tests_ctx); } } @@ -928,7 +937,7 @@ int main(int argc, char **argv) msc_vlr_tests_ctx = talloc_named_const(NULL, 0, "msc_vlr_tests_ctx"); msgb_ctx = msgb_talloc_ctx_init(msc_vlr_tests_ctx, 0); - osmo_init_logging(&info); + osmo_init_logging2(msc_vlr_tests_ctx, &info); _log_lines = cmdline_opts.verbose; @@ -969,6 +978,6 @@ int main(int argc, char **argv) printf("Done\n"); - check_talloc(msgb_ctx, msc_vlr_tests_ctx, 7); + check_talloc(msgb_ctx, msc_vlr_tests_ctx); return 0; } diff --git a/tests/smpp/smpp_test.c b/tests/smpp/smpp_test.c index 4a3af495d..1abb63b01 100644 --- a/tests/smpp/smpp_test.c +++ b/tests/smpp/smpp_test.c @@ -77,7 +77,8 @@ const struct log_info log_info = { int main(int argc, char **argv) { - osmo_init_logging(&log_info); + void *ctx = talloc_named_const(NULL, 0, "smpp_test"); + osmo_init_logging2(ctx, &log_info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); diff --git a/tests/sms_queue/sms_queue_test.c b/tests/sms_queue/sms_queue_test.c index 641cc5f4f..6ce0b88b0 100644 --- a/tests/sms_queue/sms_queue_test.c +++ b/tests/sms_queue/sms_queue_test.c @@ -198,10 +198,12 @@ static struct log_info info = { int main(int argc, char **argv) { void *msgb_ctx; + void *logging_ctx; talloc_ctx = talloc_named_const(NULL, 0, "sms_queue_test"); - msgb_ctx = msgb_talloc_ctx_init(NULL, 0); - osmo_init_logging(&info); + msgb_ctx = msgb_talloc_ctx_init(talloc_ctx, 0); + logging_ctx = talloc_named_const(talloc_ctx, 0, "logging"); + osmo_init_logging2(logging_ctx, &info); OSMO_ASSERT(osmo_stderr_target); log_set_use_color(osmo_stderr_target, 0); @@ -222,6 +224,7 @@ int main(int argc, char **argv) OSMO_ASSERT(talloc_total_blocks(msgb_ctx) == 1); OSMO_ASSERT(talloc_total_size(msgb_ctx) == 0); talloc_free(msgb_ctx); + talloc_free(logging_ctx); if (talloc_total_blocks(talloc_ctx) != 1 || talloc_total_size(talloc_ctx) != 0)