aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2015-12-02 15:43:10 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2015-12-03 11:47:12 +0100
commit996ec1d73150366fa105b7d42ba8003fb018fcf8 (patch)
treee28855041a38c61e5d437d40202e017e5145a10e /openbsc/tests
parent18d304961249c7815cf3a78ebd1697a4efd9ab42 (diff)
gtphub: wrap gtphub_write() for test suite.
Sponsored-by: On-Waves ehi
Diffstat (limited to 'openbsc/tests')
-rw-r--r--openbsc/tests/gtphub/Makefile.am3
-rw-r--r--openbsc/tests/gtphub/gtphub_test.c18
2 files changed, 20 insertions, 1 deletions
diff --git a/openbsc/tests/gtphub/Makefile.am b/openbsc/tests/gtphub/Makefile.am
index bcaf4fa06..dcb721150 100644
--- a/openbsc/tests/gtphub/Makefile.am
+++ b/openbsc/tests/gtphub/Makefile.am
@@ -13,7 +13,8 @@ endif
gtphub_test_SOURCES = gtphub_test.c
gtphub_test_LDFLAGS = \
-Wl,--wrap=gtphub_resolve_ggsn_addr \
- -Wl,--wrap=gtphub_ares_init
+ -Wl,--wrap=gtphub_ares_init \
+ -Wl,--wrap=gtphub_write
gtphub_test_LDADD = \
$(top_builddir)/src/gprs/gtphub.o \
diff --git a/openbsc/tests/gtphub/gtphub_test.c b/openbsc/tests/gtphub/gtphub_test.c
index 0d93e5a0e..0992d7972 100644
--- a/openbsc/tests/gtphub/gtphub_test.c
+++ b/openbsc/tests/gtphub/gtphub_test.c
@@ -508,6 +508,24 @@ int __wrap_gtphub_ares_init(struct gtphub *hub)
return 0;
}
+/* override, requires '-Wl,--wrap=gtphub_write' */
+int __real_gtphub_write(const struct osmo_fd *to,
+ const struct osmo_sockaddr *to_addr,
+ const uint8_t *buf, size_t buf_len);
+
+int __wrap_gtphub_write(const struct osmo_fd *to,
+ const struct osmo_sockaddr *to_addr,
+ const uint8_t *buf, size_t buf_len)
+{
+ printf("Out-of-band gtphub_write(%d):\n"
+ "to %s\n"
+ "%s\n",
+ (int)buf_len,
+ osmo_sockaddr_to_str(to_addr),
+ osmo_hexdump(buf, buf_len));
+ return 0;
+}
+
#define buf_len 1024
static uint8_t buf[buf_len];
static uint8_t *reply_buf;