From 42f2d61ac9d4be3ffc5ece501de8d0ac25f0ca14 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sun, 1 Apr 2018 16:54:40 +0200 Subject: use osmo_init_logging2() with proper talloc ctx There is a duality of initialization: early_init() in bts.cpp wants to init logging even before static instances get initialized. Make sure that tall_pcu_ctx is initialized during early_init() as well. There is a build context that does not seem to include bts.cpp (osmo-pcu-remote), so to be sure, init tall_pcu_ctx as NULL and both in early_init() as well as pcu_main.cpp, init both tall_pcu_ctx and logging if it is still NULL. Change-Id: I2199b62d0270bd35dec2283e8f5b364b7c63915b --- tests/alloc/AllocTest.cpp | 2 +- tests/alloc/MslotTest.cpp | 2 +- tests/bitcomp/BitcompTest.cpp | 10 +++++----- tests/codel/codel_test.c | 2 +- tests/edge/EdgeTest.cpp | 2 +- tests/emu/pcu_emu.cpp | 2 +- tests/fn/FnTest.cpp | 2 +- tests/llc/LlcTest.cpp | 2 +- tests/ms/MsTest.cpp | 2 +- tests/rlcmac/RLCMACTest.cpp | 2 +- tests/tbf/TbfTest.cpp | 2 +- tests/types/TypesTest.cpp | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index 9f6e6c46..64d6a50f 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -797,7 +797,7 @@ int main(int argc, char **argv) abort(); msgb_talloc_ctx_init(tall_pcu_ctx, 0); - osmo_init_logging(&gprs_log_info); + osmo_init_logging2(tall_pcu_ctx, &gprs_log_info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); if (getenv("LOGL_DEBUG")) diff --git a/tests/alloc/MslotTest.cpp b/tests/alloc/MslotTest.cpp index ebe04cad..8910e52a 100644 --- a/tests/alloc/MslotTest.cpp +++ b/tests/alloc/MslotTest.cpp @@ -155,7 +155,7 @@ int main(int argc, char **argv) msgb_talloc_ctx_init(tall_pcu_ctx, 0); - osmo_init_logging(&gprs_log_info); + osmo_init_logging2(tall_pcu_ctx, &gprs_log_info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); log_set_log_level(osmo_stderr_target, LOGL_DEBUG); diff --git a/tests/bitcomp/BitcompTest.cpp b/tests/bitcomp/BitcompTest.cpp index 8dd4534e..98bb2cc8 100644 --- a/tests/bitcomp/BitcompTest.cpp +++ b/tests/bitcomp/BitcompTest.cpp @@ -188,15 +188,15 @@ static void test_EPDAN_decode_tree(void) int main(int argc, char **argv) { - osmo_init_logging(&gprs_log_info); - log_set_use_color(osmo_stderr_target, 0); - log_set_print_filename(osmo_stderr_target, 0); - log_parse_category_mask(osmo_stderr_target, "DRLCMACUL,1"); - tall_pcu_ctx = talloc_named_const(NULL, 1, "moiji-mobile bitcompTest context"); if (!tall_pcu_ctx) abort(); + osmo_init_logging2(tall_pcu_ctx, &gprs_log_info); + log_set_use_color(osmo_stderr_target, 0); + log_set_print_filename(osmo_stderr_target, 0); + log_parse_category_mask(osmo_stderr_target, "DRLCMACUL,1"); + test_EPDAN_decode_tree(); if (getenv("TALLOC_REPORT_FULL")) diff --git a/tests/codel/codel_test.c b/tests/codel/codel_test.c index 91bad13e..2ce2429e 100644 --- a/tests/codel/codel_test.c +++ b/tests/codel/codel_test.c @@ -134,7 +134,7 @@ static struct log_info info = {}; int main(int argc, char **argv) { - osmo_init_logging(&info); + osmo_init_logging2(NULL, &info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); log_set_log_level(osmo_stderr_target, LOGL_INFO); diff --git a/tests/edge/EdgeTest.cpp b/tests/edge/EdgeTest.cpp index cd80c05f..98ca206a 100644 --- a/tests/edge/EdgeTest.cpp +++ b/tests/edge/EdgeTest.cpp @@ -1402,7 +1402,7 @@ int main(int argc, char **argv) abort(); msgb_talloc_ctx_init(tall_pcu_ctx, 0); - osmo_init_logging(&gprs_log_info); + osmo_init_logging2(tall_pcu_ctx, &gprs_log_info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); diff --git a/tests/emu/pcu_emu.cpp b/tests/emu/pcu_emu.cpp index 4cc37f38..354a3286 100644 --- a/tests/emu/pcu_emu.cpp +++ b/tests/emu/pcu_emu.cpp @@ -112,7 +112,7 @@ int main(int argc, char **argv) abort(); msgb_talloc_ctx_init(tall_pcu_ctx, 0); - osmo_init_logging(&gprs_log_info); + osmo_init_logging2(tall_pcu_ctx, &gprs_log_info); vty_init(&pcu_vty_info); pcu_vty_init(&gprs_log_info); diff --git a/tests/fn/FnTest.cpp b/tests/fn/FnTest.cpp index 1e3ff113..35249f59 100644 --- a/tests/fn/FnTest.cpp +++ b/tests/fn/FnTest.cpp @@ -149,7 +149,7 @@ int main(int argc, char **argv) abort(); msgb_talloc_ctx_init(tall_pcu_ctx, 0); - osmo_init_logging(&gprs_log_info); + osmo_init_logging2(tall_pcu_ctx, &gprs_log_info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); log_set_log_level(osmo_stderr_target, LOGL_DEBUG); diff --git a/tests/llc/LlcTest.cpp b/tests/llc/LlcTest.cpp index eb693f56..3083644b 100644 --- a/tests/llc/LlcTest.cpp +++ b/tests/llc/LlcTest.cpp @@ -225,7 +225,7 @@ int main(int argc, char **argv) abort(); msgb_talloc_ctx_init(tall_pcu_ctx, 0); - osmo_init_logging(&gprs_log_info); + osmo_init_logging2(tall_pcu_ctx, &gprs_log_info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); log_set_log_level(osmo_stderr_target, LOGL_INFO); diff --git a/tests/ms/MsTest.cpp b/tests/ms/MsTest.cpp index 46015045..728daf6e 100644 --- a/tests/ms/MsTest.cpp +++ b/tests/ms/MsTest.cpp @@ -524,7 +524,7 @@ int main(int argc, char **argv) abort(); msgb_talloc_ctx_init(tall_pcu_ctx, 0); - osmo_init_logging(&gprs_log_info); + osmo_init_logging2(tall_pcu_ctx, &gprs_log_info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); log_set_log_level(osmo_stderr_target, LOGL_INFO); diff --git a/tests/rlcmac/RLCMACTest.cpp b/tests/rlcmac/RLCMACTest.cpp index 9155809c..3de4facc 100644 --- a/tests/rlcmac/RLCMACTest.cpp +++ b/tests/rlcmac/RLCMACTest.cpp @@ -230,7 +230,7 @@ void testCsnLeftAlignedVarBmpBounds(void *test_ctx) int main(int argc, char *argv[]) { void *ctx = talloc_named_const(NULL, 1, "RLCMACTest"); - osmo_init_logging(&gprs_log_info); + osmo_init_logging2(ctx, &gprs_log_info); //printSizeofRLCMAC(); testRlcMacDownlink(ctx); diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 662708a6..dfed79ec 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -3233,7 +3233,7 @@ int main(int argc, char **argv) abort(); msgb_talloc_ctx_init(tall_pcu_ctx, 0); - osmo_init_logging(&gprs_log_info); + osmo_init_logging2(tall_pcu_ctx, &gprs_log_info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); bssgp_set_log_ss(DBSSGP); diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp index 3a43897b..1bc911f5 100644 --- a/tests/types/TypesTest.cpp +++ b/tests/types/TypesTest.cpp @@ -487,7 +487,7 @@ int main(int argc, char **argv) abort(); msgb_talloc_ctx_init(tall_pcu_ctx, 0); - osmo_init_logging(&gprs_log_info); + osmo_init_logging2(tall_pcu_ctx, &gprs_log_info); log_set_use_color(osmo_stderr_target, 0); log_set_print_filename(osmo_stderr_target, 0); -- cgit v1.2.3