From a829b45c8553765dfdd7201e1875a033a91d3a90 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 5 Apr 2018 03:02:35 +0200 Subject: use osmo_init_logging2() with proper talloc ctx Ironically, when deprecating osmo_init_logging() in I216837780e9405fdaec8059c63d10699c695b360, I forgot to change the callers within libosmocore itself, i.e. in the various regression tests. Change-Id: Ia36c248f99353d5baaa2533f46a2f60a8579bdf8 --- tests/gb/bssgp_fc_test.c | 8 +++++--- tests/gb/gprs_bssgp_test.c | 5 ++++- tests/gb/gprs_ns_test.c | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'tests/gb') diff --git a/tests/gb/bssgp_fc_test.c b/tests/gb/bssgp_fc_test.c index ac690a56..cc387771 100644 --- a/tests/gb/bssgp_fc_test.c +++ b/tests/gb/bssgp_fc_test.c @@ -17,6 +17,7 @@ static unsigned long in_ctr = 1; static struct timeval tv_start; +void *ctx = NULL; int get_centisec_diff(void) { @@ -71,7 +72,7 @@ static void test_fc(uint32_t bucket_size_max, uint32_t bucket_leak_rate, uint32_t max_queue_depth, uint32_t pdu_len, uint32_t pdu_count) { - struct bssgp_flow_control *fc = talloc_zero(NULL, struct bssgp_flow_control); + struct bssgp_flow_control *fc = talloc_zero(ctx, struct bssgp_flow_control); int i; osmo_gettimeofday_override_time = (struct timeval){ @@ -133,6 +134,7 @@ int main(int argc, char **argv) uint32_t pdu_count = 20; /* messages */ int c; void *tall_msgb_ctx; + ctx = talloc_named_const(NULL, 0, "bssgp_fc_test"); static const struct option long_options[] = { { "bucket-size-max", 1, 0, 's' }, @@ -144,11 +146,11 @@ int main(int argc, char **argv) { 0, 0, 0, 0 } }; - osmo_init_logging(&info); + osmo_init_logging2(ctx, &info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); - tall_msgb_ctx = msgb_talloc_ctx_init(NULL, 0); + tall_msgb_ctx = msgb_talloc_ctx_init(ctx, 0); while ((c = getopt_long(argc, argv, "s:r:d:l:c:", long_options, NULL)) != -1) { diff --git a/tests/gb/gprs_bssgp_test.c b/tests/gb/gprs_bssgp_test.c index c38e1801..52e986e8 100644 --- a/tests/gb/gprs_bssgp_test.c +++ b/tests/gb/gprs_bssgp_test.c @@ -294,11 +294,14 @@ static struct log_info info = {}; int main(int argc, char **argv) { struct sockaddr_in bss_peer= {0}; + void *ctx = talloc_named_const(NULL, 0, "gprs_bssgp_test"); - osmo_init_logging(&info); + osmo_init_logging2(ctx, &info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); + msgb_talloc_ctx_init(ctx, 0); + bssgp_nsi = gprs_ns_instantiate(gprs_ns_callback, NULL); bss_peer.sin_family = AF_INET; diff --git a/tests/gb/gprs_ns_test.c b/tests/gb/gprs_ns_test.c index 7e6b85cc..f70e4937 100644 --- a/tests/gb/gprs_ns_test.c +++ b/tests/gb/gprs_ns_test.c @@ -901,7 +901,8 @@ static struct log_info info = {}; int main(int argc, char **argv) { - osmo_init_logging(&info); + void *ctx = talloc_named_const(NULL, 0, "gprs_ns_test"); + osmo_init_logging2(ctx, &info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); osmo_signal_register_handler(SS_L_NS, &test_signal, NULL); -- cgit v1.2.3