aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-03-05 21:53:18 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2018-03-08 20:21:55 +0000
commit1d7473cf029fcaf1b5742af8105ae93ddd1f8a2b (patch)
treefb2dc5f37a8b729f1173cc1f37cfb2643cfe437b
parent7ec27564c9e0e3def3d329f1371babb4858b23a2 (diff)
handover_test: explicitly wrap abis_rsl_sendmsg()
Until now, handover_test simply defines an abis_rsl_sendmsg() function to override the one from libosmo-babis. To me this amounts to implicit linker magic (aka luck). The common pattern we're using for this scenario is to explicitly wrap an existing function by instructing the linker. Also do this for abis_rsl_sendmsg() in handover_test.c to clarify. Change-Id: I05ce33a4e42bc82b9ce5060e2f811033f5a1f8d8
-rw-r--r--tests/handover/Makefile.am4
-rw-r--r--tests/handover/handover_test.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/tests/handover/Makefile.am b/tests/handover/Makefile.am
index 5cdc0b073..7133fcddc 100644
--- a/tests/handover/Makefile.am
+++ b/tests/handover/Makefile.am
@@ -27,6 +27,10 @@ handover_test_SOURCES = \
handover_test.c \
$(NULL)
+handover_test_LDFLAGS =\
+ -Wl,--wrap=abis_rsl_sendmsg \
+ $(NULL)
+
handover_test_LDADD = \
$(top_builddir)/src/libbsc/libbsc.a \
$(LIBOSMOCORE_LIBS) \
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 8ba97fd8e..bf7350c62 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -339,8 +339,10 @@ static void send_ho_complete(struct gsm_lchan *lchan, bool success)
abis_rsl_rcvmsg(msg);
}
-/* RSL messages from BSC */
-int abis_rsl_sendmsg(struct msgb *msg)
+/* override, requires '-Wl,--wrap=abis_rsl_sendmsg'.
+ * Catch RSL messages sent towards the BTS. */
+int __real_abis_rsl_sendmsg(struct msgb *msg);
+int __wrap_abis_rsl_sendmsg(struct msgb *msg)
{
struct abis_rsl_dchan_hdr *dh = (struct abis_rsl_dchan_hdr *) msg->data;
struct e1inp_sign_link *sign_link = msg->dst;