aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-07-02 17:45:42 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2011-07-02 17:45:42 +0200
commit2b3520139a813cc8cb9c290ff8bd8a1aa3772bc8 (patch)
tree1efadd4a08677a26d67ffded7053e252f3dd40bf /tests
parentcda8c43537650e33128aeb47ba1871b0a6310a55 (diff)
tests: use logging infrastructure to display messages
instead of using printf
Diffstat (limited to 'tests')
-rw-r--r--tests/e1inp_ipa_bsc_test.c31
-rw-r--r--tests/e1inp_ipa_bts_test.c27
2 files changed, 35 insertions, 23 deletions
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,6 +8,17 @@
static void *tall_test;
static struct e1inp_sign_link *oml_sign_link, *rsl_sign_link;
+#define DBSCTEST OSMO_LOG_SS_APPS
+
+struct log_info_cat bsc_test_cat[] = {
+ [DBSCTEST] = {
+ .name = "DBSCTEST",
+ .description = "BSC-mode test",
+ .color = "\033[1;35m",
+ .enabled = 1, .loglevel = LOGL_NOTICE,
+ },
+};
+
static struct e1inp_sign_link *
sign_link_up(void *dev, struct e1inp_line *line, enum e1inp_sign_type type)
{
@@ -15,12 +26,14 @@ sign_link_up(void *dev, struct e1inp_line *line, enum e1inp_sign_type type)
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],
@@ -29,33 +42,25 @@ sign_link_up(void *dev, struct e1inp_line *line, enum e1inp_sign_type type)
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)
{
- printf("link got down.\n");
+ 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)
{
- printf("OML/RSL data received\n");
+ LOGP(DBSCTEST, LOGL_NOTICE, "OML/RSL message received.\n");
return 0;
}
-#define DBSCTEST OSMO_LOG_SS_APPS
-
-struct log_info_cat bsc_test_cat[] = {
- [DBSCTEST] = {
- .name = "DBSCTEST",
- .description = "BSC-mode test",
- .color = "\033[1;35m",
- .enabled = 1, .loglevel = LOGL_NOTICE,
- },
-};
-
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 @@ sign_link_up(void *unit, struct e1inp_line *line, enum e1inp_sign_type type)
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;
}