aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ipaccess/ipaccess-config.c2
-rw-r--r--src/ipaccess/ipaccess-proxy.c2
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c2
-rw-r--r--src/utils/bs11_config.c2
-rw-r--r--tests/abis/abis_test.c2
-rw-r--r--tests/bsc/bsc_test.c10
-rw-r--r--tests/channel/channel_test.c2
-rw-r--r--tests/gsm0408/gsm0408_test.c4
-rw-r--r--tests/handover/handover_test.c12
-rw-r--r--tests/nanobts_omlattr/nanobts_omlattr_test.c17
-rw-r--r--tests/subscr/bsc_subscr_test.c5
11 files changed, 41 insertions, 19 deletions
diff --git a/src/ipaccess/ipaccess-config.c b/src/ipaccess/ipaccess-config.c
index 45cab8fbf..223606373 100644
--- a/src/ipaccess/ipaccess-config.c
+++ b/src/ipaccess/ipaccess-config.c
@@ -900,7 +900,7 @@ int main(int argc, char **argv)
tall_ctx_config = talloc_named_const(NULL, 0, "ipaccess-config");
msgb_talloc_ctx_init(tall_ctx_config, 0);
- osmo_init_logging(&log_info);
+ osmo_init_logging2(tall_ctx_config, &log_info);
bts_model_nanobts_init();
printf("ipaccess-config (C) 2009-2010 by Harald Welte and others\n");
diff --git a/src/ipaccess/ipaccess-proxy.c b/src/ipaccess/ipaccess-proxy.c
index 6a3af287c..aa5e7b499 100644
--- a/src/ipaccess/ipaccess-proxy.c
+++ b/src/ipaccess/ipaccess-proxy.c
@@ -1228,7 +1228,7 @@ int main(int argc, char **argv)
tall_bsc_ctx = talloc_named_const(NULL, 1, "ipaccess-proxy");
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
- osmo_init_logging(&log_info);
+ osmo_init_logging2(tall_bsc_ctx, &log_info);
log_parse_category_mask(osmo_stderr_target, "DLINP:DLMI");
handle_options(argc, argv);
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 27c5640ea..89d0d02a5 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -414,7 +414,7 @@ int main(int argc, char **argv)
tall_tqe_ctx = talloc_named_const(tall_bsc_ctx, 0, "subch_txq_entry");
tall_ctr_ctx = talloc_named_const(tall_bsc_ctx, 0, "counter");
- osmo_init_logging(&log_info);
+ osmo_init_logging2(tall_bsc_ctx, &log_info);
osmo_stats_init(tall_bsc_ctx);
/* Allocate global gsm_network struct */
diff --git a/src/utils/bs11_config.c b/src/utils/bs11_config.c
index e7c833671..8d4de0152 100644
--- a/src/utils/bs11_config.c
+++ b/src/utils/bs11_config.c
@@ -911,7 +911,7 @@ int main(int argc, char **argv)
tall_fle_ctx = talloc_named_const(tall_bs11cfg_ctx, 0, "bs11_file_list_entry");
msgb_talloc_ctx_init(tall_bs11cfg_ctx, 0);
- osmo_init_logging(&log_info);
+ osmo_init_logging2(tall_bs11cfg_ctx, &log_info);
handle_options(argc, argv);
bts_model_bs11_init();
diff --git a/tests/abis/abis_test.c b/tests/abis/abis_test.c
index 7deb0f00f..faf9ea533 100644
--- a/tests/abis/abis_test.c
+++ b/tests/abis/abis_test.c
@@ -175,7 +175,7 @@ static const struct log_info log_info = {
int main(int argc, char **argv)
{
- osmo_init_logging(&log_info);
+ osmo_init_logging2(NULL, &log_info);
test_sw_selection();
test_abis_nm_ipaccess_cgi();
diff --git a/tests/bsc/bsc_test.c b/tests/bsc/bsc_test.c
index 744b9e1cb..106b08bc7 100644
--- a/tests/bsc/bsc_test.c
+++ b/tests/bsc/bsc_test.c
@@ -39,6 +39,8 @@
#include <stdio.h>
#include <search.h>
+void *ctx = NULL;
+
enum test {
TEST_SCAN_TO_BTS,
TEST_SCAN_TO_MSC,
@@ -122,7 +124,7 @@ static void test_scan(void)
{
int i;
- struct gsm_network *net = bsc_network_init(NULL);
+ struct gsm_network *net = bsc_network_init(ctx);
struct gsm_bts *bts = gsm_bts_alloc(net, 0);
struct bsc_msc_data *msc;
struct gsm_subscriber_connection *conn;
@@ -227,12 +229,14 @@ static const struct log_info log_info = {
int main(int argc, char **argv)
{
- msgb_talloc_ctx_init(NULL, 0);
- osmo_init_logging(&log_info);
+ ctx = talloc_named_const(NULL, 0, "bsc-test");
+ msgb_talloc_ctx_init(ctx, 0);
+ osmo_init_logging2(ctx, &log_info);
test_scan();
printf("Testing execution completed.\n");
+ talloc_free(ctx);
return 0;
}
diff --git a/tests/channel/channel_test.c b/tests/channel/channel_test.c
index 78db1d4e3..e8f6cd921 100644
--- a/tests/channel/channel_test.c
+++ b/tests/channel/channel_test.c
@@ -98,7 +98,7 @@ static const struct log_info log_info = {
int main(int argc, char **argv)
{
- osmo_init_logging(&log_info);
+ osmo_init_logging2(NULL, &log_info);
test_dyn_ts_subslots();
test_bts_debug_print();
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index 67840f0e4..a934806b5 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -812,7 +812,9 @@ int main(int argc, char **argv)
{
struct gsm_network *net;
- osmo_init_logging(&log_info);
+ tall_bsc_ctx = talloc_named_const(NULL, 0, "gsm0408_test");
+
+ osmo_init_logging2(tall_bsc_ctx, &log_info);
log_set_log_level(osmo_stderr_target, LOGL_INFO);
net = bsc_network_init(tall_bsc_ctx);
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 280861ca2..ab32a29a1 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -43,6 +43,8 @@
#include <osmocom/bsc/osmo_bsc.h>
#include <osmocom/bsc/bsc_subscr_conn_fsm.h>
+void *ctx;
+
struct gsm_network *bsc_gsmnet;
/* override, requires '-Wl,--wrap=mgcp_conn_modify'.
@@ -213,7 +215,7 @@ static struct gsm_bts *create_bts(int arfcn)
bts->codec.hr = 1;
bts->codec.amr = 1;
- rsl_link = talloc_zero(0, struct e1inp_sign_link);
+ rsl_link = talloc_zero(ctx, struct e1inp_sign_link);
rsl_link->trx = bts->c0;
bts->c0->rsl_link = rsl_link;
@@ -1350,6 +1352,9 @@ int main(int argc, char **argv)
int test_case_i;
int last_test_i;
+ ctx = talloc_named_const(NULL, 0, "handover_test");
+ msgb_talloc_ctx_init(ctx, 0);
+
test_case_i = argc > 1? atoi(argv[1]) : -1;
last_test_i = ARRAY_SIZE(test_cases) - 1;
@@ -1362,14 +1367,14 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- osmo_init_logging(&log_info);
+ osmo_init_logging2(ctx, &log_info);
log_set_print_category(osmo_stderr_target, 1);
log_set_print_category_hex(osmo_stderr_target, 0);
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_BASENAME);
/* Create a dummy network */
- bsc_gsmnet = bsc_network_init(NULL);
+ bsc_gsmnet = bsc_network_init(ctx);
if (!bsc_gsmnet)
exit(1);
@@ -1676,6 +1681,7 @@ int main(int argc, char **argv)
fprintf(stderr, "--------------------\n");
+ talloc_free(ctx);
return EXIT_SUCCESS;
}
diff --git a/tests/nanobts_omlattr/nanobts_omlattr_test.c b/tests/nanobts_omlattr/nanobts_omlattr_test.c
index 663594cda..8e8626d13 100644
--- a/tests/nanobts_omlattr/nanobts_omlattr_test.c
+++ b/tests/nanobts_omlattr/nanobts_omlattr_test.c
@@ -199,11 +199,11 @@ int main(int argc, char **argv)
struct gsm_network *net;
struct gsm_bts_trx *trx;
- osmo_init_logging(&log_info);
- log_set_log_level(osmo_stderr_target, LOGL_INFO);
-
ctx = talloc_named_const(NULL, 0, "ctx");
+ osmo_init_logging2(ctx, &log_info);
+ log_set_log_level(osmo_stderr_target, LOGL_INFO);
+
/* Allocate environmental structs (bts, net, trx) */
net = talloc_zero(ctx, struct gsm_network);
INIT_LLIST_HEAD(&net->bts_list);
@@ -282,7 +282,16 @@ int main(int argc, char **argv)
talloc_free(net);
talloc_free(trx);
talloc_report_full(ctx, stderr);
- OSMO_ASSERT(talloc_total_blocks(ctx) == 1);
+ /* Expecting something like:
+ * full talloc report on 'ctx' (total 813 bytes in 6 blocks)
+ * logging contains 813 bytes in 5 blocks (ref 0) 0x60b0000000a0
+ * struct log_target contains 196 bytes in 2 blocks (ref 0) 0x6110000000a0
+ * struct log_category contains 36 bytes in 1 blocks (ref 0) 0x60d0000003e0
+ * struct log_info contains 616 bytes in 2 blocks (ref 0) 0x60d000000310
+ * struct log_info_cat contains 576 bytes in 1 blocks (ref 0) 0x6170000000e0
+ * That's the root ctx + 5x logging: */
+ OSMO_ASSERT(talloc_total_blocks(ctx) == 6);
+ talloc_free(ctx);
return 0;
}
diff --git a/tests/subscr/bsc_subscr_test.c b/tests/subscr/bsc_subscr_test.c
index d15c1141d..3c94b8662 100644
--- a/tests/subscr/bsc_subscr_test.c
+++ b/tests/subscr/bsc_subscr_test.c
@@ -125,14 +125,15 @@ static const struct log_info log_info = {
int main()
{
+ void *ctx = talloc_named_const(NULL, 0, "bsc_subscr_test");
printf("Testing BSC subscriber core code.\n");
- osmo_init_logging(&log_info);
+ osmo_init_logging2(ctx, &log_info);
log_set_print_filename(osmo_stderr_target, 0);
log_set_print_timestamp(osmo_stderr_target, 0);
log_set_use_color(osmo_stderr_target, 0);
log_set_print_category(osmo_stderr_target, 1);
- bsc_subscribers = talloc_zero(NULL, struct llist_head);
+ bsc_subscribers = talloc_zero(ctx, struct llist_head);
INIT_LLIST_HEAD(bsc_subscribers);
test_bsc_subscr();