From a2b0ac142e5b516ee2712c58508824e821c10d04 Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Tue, 22 Sep 2020 13:26:06 +0200 Subject: gbproxy_test: fix compilation Change-Id: I5455822d4bb30de3da944c2c206fef8b57004c55 --- tests/gbproxy/gbproxy_test.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/gbproxy/gbproxy_test.c b/tests/gbproxy/gbproxy_test.c index 4cf04573e..42fbcafa8 100644 --- a/tests/gbproxy/gbproxy_test.c +++ b/tests/gbproxy/gbproxy_test.c @@ -47,38 +47,38 @@ //#define MATCH_ANY (-1) -//void *tall_sgsn_ctx = NULL; +void *tall_sgsn_ctx = NULL; //struct gbproxy_config gbcfg = {0}; //struct llist_head *received_messages = NULL; -///* override, requires '-Wl,--wrap=osmo_get_rand_id' */ -//int __real_osmo_get_rand_id(uint8_t *data, size_t len); -//int mock_osmo_get_rand_id(uint8_t *data, size_t len); -//int (*osmo_get_rand_id_cb)(uint8_t *, size_t) = -// &mock_osmo_get_rand_id; +/* override, requires '-Wl,--wrap=osmo_get_rand_id' */ +int __real_osmo_get_rand_id(uint8_t *data, size_t len); +int mock_osmo_get_rand_id(uint8_t *data, size_t len); +int (*osmo_get_rand_id_cb)(uint8_t *, size_t) = + &mock_osmo_get_rand_id; -//int __wrap_osmo_get_rand_id(uint8_t *buf, size_t num) -//{ -// return (*osmo_get_rand_id_cb)(buf, num); -//} +int __wrap_osmo_get_rand_id(uint8_t *buf, size_t num) +{ + return (*osmo_get_rand_id_cb)(buf, num); +} -//static int rand_seq_num = 0; -//int mock_osmo_get_rand_id(uint8_t *buf, size_t num) -//{ -// uint32_t val; +static int rand_seq_num = 0; +int mock_osmo_get_rand_id(uint8_t *buf, size_t num) +{ + uint32_t val; -// OSMO_ASSERT(num == sizeof(val)); + OSMO_ASSERT(num == sizeof(val)); -// val = 0x00dead00 + rand_seq_num; + val = 0x00dead00 + rand_seq_num; -// rand_seq_num++; + rand_seq_num++; -// memcpy(buf, &val, num); + memcpy(buf, &val, num); -// return 1; -//} + return 1; +} //static void cleanup_test() //{ @@ -5032,6 +5032,7 @@ int main(int argc, char **argv) { + tall_sgsn_ctx = talloc_named_const(NULL, 0, "nsip_proxy"); /* all tests ok! */ return 0; -- cgit v1.2.3