aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-02-13 17:16:44 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-02-14 12:15:40 +0100
commit7997bf4bed15fa8c6807820b1a9b379a2ae0c61e (patch)
tree2313d9a2d1c823702d8f52c293ad52ebe51ce6ba /tests
parentec1bb16eef42cf2cf32af8faca05d234b2a0c891 (diff)
libcommon: eliminate debug.c
Provide concise log categories for each main scope. Move the complete log categories 1:1 to osmo_bsc_main.c. In bsc_nat.c, omit obviously unused log categories. In tests, omit almost all log categories, except for those explicitly tested as the expected output. Note: should any logging occur for a log category that is omitted by accident, such will end up being logged as DLGLOBAL, so it will show up and we can fix it, and it will not get lost silently. Change-Id: Ib524e49ec211662e0dfde8161495a72aa8ad76cf
Diffstat (limited to 'tests')
-rw-r--r--tests/abis/abis_test.c8
-rw-r--r--tests/bsc-nat-trie/bsc_nat_trie_test.c8
-rw-r--r--tests/bsc-nat/bsc_nat_test.c8
-rw-r--r--tests/bsc/bsc_test.c33
-rw-r--r--tests/bssap/bssap_test.c18
-rw-r--r--tests/channel/channel_test.c8
-rw-r--r--tests/gsm0408/gsm0408_test.c8
-rw-r--r--tests/nanobts_omlattr/nanobts_omlattr_test.c8
-rw-r--r--tests/subscr/bsc_subscr_test.c14
9 files changed, 112 insertions, 1 deletions
diff --git a/tests/abis/abis_test.c b/tests/abis/abis_test.c
index 461f24ed5..36a45a3a4 100644
--- a/tests/abis/abis_test.c
+++ b/tests/abis/abis_test.c
@@ -83,6 +83,14 @@ static void test_sw_selection(void)
printf("%s(): OK\n", __func__);
}
+static const struct log_info_cat log_categories[] = {
+};
+
+static const struct log_info log_info = {
+ .cat = log_categories,
+ .num_cat = ARRAY_SIZE(log_categories),
+};
+
int main(int argc, char **argv)
{
osmo_init_logging(&log_info);
diff --git a/tests/bsc-nat-trie/bsc_nat_trie_test.c b/tests/bsc-nat-trie/bsc_nat_trie_test.c
index 3c04a9f84..1c48564a4 100644
--- a/tests/bsc-nat-trie/bsc_nat_trie_test.c
+++ b/tests/bsc-nat-trie/bsc_nat_trie_test.c
@@ -28,6 +28,14 @@
#include <string.h>
+static const struct log_info_cat log_categories[] = {
+};
+
+static const struct log_info log_info = {
+ .cat = log_categories,
+ .num_cat = ARRAY_SIZE(log_categories),
+};
+
int main(int argc, char **argv)
{
struct nat_rewrite *trie;
diff --git a/tests/bsc-nat/bsc_nat_test.c b/tests/bsc-nat/bsc_nat_test.c
index a61da0058..3d3b4558d 100644
--- a/tests/bsc-nat/bsc_nat_test.c
+++ b/tests/bsc-nat/bsc_nat_test.c
@@ -1549,6 +1549,14 @@ static void test_nat_extract_lac()
bsc_nat_free(nat);
}
+static const struct log_info_cat log_categories[] = {
+};
+
+static const struct log_info log_info = {
+ .cat = log_categories,
+ .num_cat = ARRAY_SIZE(log_categories),
+};
+
int main(int argc, char **argv)
{
msgb_talloc_ctx_init(NULL, 0);
diff --git a/tests/bsc/bsc_test.c b/tests/bsc/bsc_test.c
index 420ef73d6..19bb608e0 100644
--- a/tests/bsc/bsc_test.c
+++ b/tests/bsc/bsc_test.c
@@ -194,6 +194,39 @@ out:
talloc_free(net);
}
+static const struct log_info_cat log_categories[] = {
+ [DNM] = {
+ .name = "DNM",
+ .description = "A-bis Network Management / O&M (NM/OML)",
+ .color = "\033[1;36m",
+ .enabled = 1, .loglevel = LOGL_INFO,
+ },
+ [DNAT] = {
+ .name = "DNAT",
+ .description = "GSM 08.08 NAT/Multiplexer",
+ .enabled = 1, .loglevel = LOGL_NOTICE,
+ },
+ [DMSC] = {
+ .name = "DMSC",
+ .description = "Mobile Switching Center",
+ .enabled = 1, .loglevel = LOGL_NOTICE,
+ },
+ [DCTRL] = {
+ .name = "DCTRL",
+ .description = "Control interface",
+ .enabled = 1, .loglevel = LOGL_NOTICE,
+ },
+ [DFILTER] = {
+ .name = "DFILTER",
+ .description = "BSC/NAT IMSI based filtering",
+ .enabled = 1, .loglevel = LOGL_DEBUG,
+ },
+};
+
+static const struct log_info log_info = {
+ .cat = log_categories,
+ .num_cat = ARRAY_SIZE(log_categories),
+};
int main(int argc, char **argv)
{
diff --git a/tests/bssap/bssap_test.c b/tests/bssap/bssap_test.c
index 1d8fe7720..dac0ff762 100644
--- a/tests/bssap/bssap_test.c
+++ b/tests/bssap/bssap_test.c
@@ -120,6 +120,24 @@ void test_cell_identifier()
}
}
+static const struct log_info_cat log_categories[] = {
+ [DMSC] = {
+ .name = "DMSC",
+ .description = "Mobile Switching Center",
+ .enabled = 1, .loglevel = LOGL_NOTICE,
+ },
+ [DREF] = {
+ .name = "DREF",
+ .description = "Reference Counting",
+ .enabled = 0, .loglevel = LOGL_DEBUG,
+ },
+};
+
+static const struct log_info log_info = {
+ .cat = log_categories,
+ .num_cat = ARRAY_SIZE(log_categories),
+};
+
int main(int argc, char **argv)
{
osmo_init_logging(&log_info);
diff --git a/tests/channel/channel_test.c b/tests/channel/channel_test.c
index 933df9c9d..f37877e94 100644
--- a/tests/channel/channel_test.c
+++ b/tests/channel/channel_test.c
@@ -88,6 +88,14 @@ void test_dyn_ts_subslots(void)
OSMO_ASSERT(ts_subslots(&ts) == 0);
}
+static const struct log_info_cat log_categories[] = {
+};
+
+static const struct log_info log_info = {
+ .cat = log_categories,
+ .num_cat = ARRAY_SIZE(log_categories),
+};
+
int main(int argc, char **argv)
{
osmo_init_logging(&log_info);
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index 784c3e995..8cd9f81af 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -708,6 +708,14 @@ static void test_si_ba_ind(struct gsm_network *net)
OSMO_ASSERT(si5ter->bcch_frequency_list[0] & 0x10);
}
+static const struct log_info_cat log_categories[] = {
+};
+
+static const struct log_info log_info = {
+ .cat = log_categories,
+ .num_cat = ARRAY_SIZE(log_categories),
+};
+
int main(int argc, char **argv)
{
struct gsm_network *net;
diff --git a/tests/nanobts_omlattr/nanobts_omlattr_test.c b/tests/nanobts_omlattr/nanobts_omlattr_test.c
index 674148a25..1d248c277 100644
--- a/tests/nanobts_omlattr/nanobts_omlattr_test.c
+++ b/tests/nanobts_omlattr/nanobts_omlattr_test.c
@@ -183,6 +183,14 @@ static void test_nanobts_attr_radio_get(struct gsm_bts *bts,
printf("\n");
}
+static const struct log_info_cat log_categories[] = {
+};
+
+static const struct log_info log_info = {
+ .cat = log_categories,
+ .num_cat = ARRAY_SIZE(log_categories),
+};
+
int main(int argc, char **argv)
{
void *ctx;
diff --git a/tests/subscr/bsc_subscr_test.c b/tests/subscr/bsc_subscr_test.c
index 934684f27..d15c1141d 100644
--- a/tests/subscr/bsc_subscr_test.c
+++ b/tests/subscr/bsc_subscr_test.c
@@ -110,6 +110,19 @@ static void test_bsc_subscr(void)
OSMO_ASSERT(llist_empty(bsc_subscribers));
}
+static const struct log_info_cat log_categories[] = {
+ [DREF] = {
+ .name = "DREF",
+ .description = "Reference Counting",
+ .enabled = 1, .loglevel = LOGL_DEBUG,
+ },
+};
+
+static const struct log_info log_info = {
+ .cat = log_categories,
+ .num_cat = ARRAY_SIZE(log_categories),
+};
+
int main()
{
printf("Testing BSC subscriber core code.\n");
@@ -118,7 +131,6 @@ int main()
log_set_print_timestamp(osmo_stderr_target, 0);
log_set_use_color(osmo_stderr_target, 0);
log_set_print_category(osmo_stderr_target, 1);
- log_set_category_filter(osmo_stderr_target, DREF, 1, LOGL_DEBUG);
bsc_subscribers = talloc_zero(NULL, struct llist_head);
INIT_LLIST_HEAD(bsc_subscribers);