[MERGED] osmo-msc[master]: use osmo_init_logging2() with proper talloc ctx

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Apr 4 16:53:54 UTC 2018


Neels Hofmeyr has submitted this change and it was merged.

Change subject: use osmo_init_logging2() with proper talloc ctx
......................................................................


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
---
M src/libgsupclient/gsup_test_client.c
M src/osmo-msc/msc_main.c
M src/utils/smpp_mirror.c
M tests/msc_vlr/msc_vlr_test_authen_reuse.err
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_test_gsm_authen.err
M tests/msc_vlr/msc_vlr_test_gsm_ciph.err
M tests/msc_vlr/msc_vlr_test_hlr_reject.err
M tests/msc_vlr/msc_vlr_test_hlr_timeout.err
M tests/msc_vlr/msc_vlr_test_ms_timeout.err
M tests/msc_vlr/msc_vlr_test_no_authen.err
M tests/msc_vlr/msc_vlr_test_reject_concurrency.err
M tests/msc_vlr/msc_vlr_test_rest.err
M tests/msc_vlr/msc_vlr_test_umts_authen.err
M tests/msc_vlr/msc_vlr_tests.c
M tests/smpp/smpp_test.c
M tests/sms_queue/sms_queue_test.c
17 files changed, 150 insertions(+), 102 deletions(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libgsupclient/gsup_test_client.c b/src/libgsupclient/gsup_test_client.c
index 03ba68e..0ebcd4a 100644
--- a/src/libgsupclient/gsup_test_client.c
+++ b/src/libgsupclient/gsup_test_client.c
@@ -289,10 +289,11 @@
 	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 2b1a8c7..85a8fe1 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -531,7 +531,7 @@
 	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 fa509df..3053553 100644
--- a/src/utils/smpp_mirror.c
+++ b/src/utils/smpp_mirror.c
@@ -343,12 +343,13 @@
 	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 cda2bda..4f8432a 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 425762d..1a21c6b 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 c996f3f..ff9f869 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 2d60ae9..b75ecc2 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 5af4e64..8a7f90d 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 4d1a99f..9409e26 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 @@
 ===== 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 @@
 ===== 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 c9259a8..c5ffcf5 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 cf34f62..2d139be 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 e963ba6..a045e67 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 73a3692..274f4b8 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 fa820f7..e6cb9a3 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 @@
 ===== 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 709355c..523f74f 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -805,23 +805,29 @@
 	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 @@
 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 @@
 		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 @@
 
 	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 @@
 
 	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 4a3af49..1abb63b 100644
--- a/tests/smpp/smpp_test.c
+++ b/tests/smpp/smpp_test.c
@@ -77,7 +77,8 @@
 
 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 641cc5f..6ce0b88 100644
--- a/tests/sms_queue/sms_queue_test.c
+++ b/tests/sms_queue/sms_queue_test.c
@@ -198,10 +198,12 @@
 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 @@
 	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)

-- 
To view, visit https://gerrit.osmocom.org/7599
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iae07ae60230c7bab28e52b5df97fa3844778158e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list