tests: use logging infrastructure to display messages
instead of using printf
diff --git a/tests/e1inp_ipa_bsc_test.c b/tests/e1inp_ipa_bsc_test.c
index bac9926..a65b375 100644
--- a/tests/e1inp_ipa_bsc_test.c
+++ b/tests/e1inp_ipa_bsc_test.c
@@ -8,43 +8,6 @@
static void *tall_test;
static struct e1inp_sign_link *oml_sign_link, *rsl_sign_link;
-static struct e1inp_sign_link *
-sign_link_up(void *dev, struct e1inp_line *line, enum e1inp_sign_type type)
-{
- struct e1inp_sign_link *sign_link = NULL;
-
- switch(type) {
- case E1INP_SIGN_OML:
- e1inp_ts_config_sign(&line->ts[E1INP_SIGN_OML - 1], line);
- sign_link = oml_sign_link =
- e1inp_sign_link_create(&line->ts[E1INP_SIGN_OML - 1],
- E1INP_SIGN_OML, NULL, 255, 0);
- break;
- case E1INP_SIGN_RSL:
- e1inp_ts_config_sign(&line->ts[E1INP_SIGN_RSL - 1], line);
- sign_link = rsl_sign_link =
- e1inp_sign_link_create(&line->ts[E1INP_SIGN_RSL - 1],
- E1INP_SIGN_OML, NULL, 0, 0);
- break;
- default:
- break;
- }
- return sign_link;
-}
-
-static void sign_link_down(struct e1inp_line *line)
-{
- printf("link got down.\n");
- e1inp_sign_link_destroy(oml_sign_link);
- e1inp_sign_link_destroy(rsl_sign_link);
-}
-
-static int sign_link(struct msgb *msg, struct e1inp_sign_link *link)
-{
- printf("OML/RSL data received\n");
- return 0;
-}
-
#define DBSCTEST OSMO_LOG_SS_APPS
struct log_info_cat bsc_test_cat[] = {
@@ -56,6 +19,48 @@
},
};
+static struct e1inp_sign_link *
+sign_link_up(void *dev, struct e1inp_line *line, enum e1inp_sign_type type)
+{
+ struct e1inp_sign_link *sign_link = NULL;
+
+ switch(type) {
+ case E1INP_SIGN_OML:
+ LOGP(DBSCTEST, LOGL_NOTICE, "OML link up request received.\n");
+ e1inp_ts_config_sign(&line->ts[E1INP_SIGN_OML - 1], line);
+ sign_link = oml_sign_link =
+ e1inp_sign_link_create(&line->ts[E1INP_SIGN_OML - 1],
+ E1INP_SIGN_OML, NULL, 255, 0);
+ break;
+ case E1INP_SIGN_RSL:
+ LOGP(DBSCTEST, LOGL_NOTICE, "RSL link up request received.\n");
+ e1inp_ts_config_sign(&line->ts[E1INP_SIGN_RSL - 1], line);
+ sign_link = rsl_sign_link =
+ e1inp_sign_link_create(&line->ts[E1INP_SIGN_RSL - 1],
+ E1INP_SIGN_OML, NULL, 0, 0);
+ break;
+ default:
+ break;
+ }
+ if (sign_link)
+ LOGP(DBSCTEST, LOGL_NOTICE, "signal link has been set up.\n");
+
+ return sign_link;
+}
+
+static void sign_link_down(struct e1inp_line *line)
+{
+ LOGP(DBSCTEST, LOGL_NOTICE, "signal link has been closed\n");
+ e1inp_sign_link_destroy(oml_sign_link);
+ e1inp_sign_link_destroy(rsl_sign_link);
+}
+
+static int sign_link(struct msgb *msg, struct e1inp_sign_link *link)
+{
+ LOGP(DBSCTEST, LOGL_NOTICE, "OML/RSL message received.\n");
+ return 0;
+}
+
const struct log_info bsc_test_log_info = {
.filter_fn = NULL,
.cat = bsc_test_cat,
diff --git a/tests/e1inp_ipa_bts_test.c b/tests/e1inp_ipa_bts_test.c
index dbd9e4c..8ba49c5 100644
--- a/tests/e1inp_ipa_bts_test.c
+++ b/tests/e1inp_ipa_bts_test.c
@@ -35,44 +35,51 @@
switch(type) {
case E1INP_SIGN_OML:
- printf("ID_RESP for OML received.\n");
+ LOGP(DBTSTEST, LOGL_NOTICE, "OML link up request received.\n");
e1inp_ts_config_sign(&line->ts[E1INP_SIGN_OML - 1], line);
sign_link = oml_sign_link =
e1inp_sign_link_create(&line->ts[E1INP_SIGN_OML - 1],
E1INP_SIGN_OML, NULL, 255, 0);
- if (!oml_sign_link)
- printf("cannot create OML sign link\n");
-
+ if (!oml_sign_link) {
+ LOGP(DBTSTEST, LOGL_ERROR,
+ "cannot create OML sign link\n");
+ }
dst = oml_sign_link;
break;
case E1INP_SIGN_RSL:
- printf("ID_RESP for RSL received.\n");
+ LOGP(DBTSTEST, LOGL_NOTICE, "RSL link up request received.\n");
e1inp_ts_config_sign(&line->ts[E1INP_SIGN_RSL - 1], line);
sign_link = rsl_sign_link =
e1inp_sign_link_create(&line->ts[E1INP_SIGN_RSL - 1],
E1INP_SIGN_RSL, NULL, 0, 0);
- if (!rsl_sign_link)
- printf("cannot create RSL sign link\n");
-
+ if (!rsl_sign_link) {
+ LOGP(DBTSTEST, LOGL_ERROR,
+ "cannot create RSL sign link\n");
+ }
dst = rsl_sign_link;
break;
default:
return NULL;
}
+ if (sign_link)
+ LOGP(DBTSTEST, LOGL_NOTICE, "signal link has been set up.\n");
+
return sign_link;
}
static void sign_link_down(struct e1inp_line *line)
{
- printf("closing sign link.\n");
+ LOGP(DBTSTEST, LOGL_NOTICE, "signal link has been closed\n");
+ e1inp_sign_link_destroy(oml_sign_link);
+ e1inp_sign_link_destroy(rsl_sign_link);
}
static int sign_link(struct msgb *msg, struct e1inp_sign_link *link)
{
- printf("OML/RSL data received\n");
+ LOGP(DBTSTEST, LOGL_NOTICE, "OML/RSL message received.\n");
return 0;
}