diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-01-06 14:06:56 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-01-06 17:23:19 +0100 |
commit | 08e324fda7d742400b1a5d83363139b71365fd77 (patch) | |
tree | ed3367bc8826f0907c92311f5f9e33ff841c1417 /openbsc/tests | |
parent | f5ede52a22626ab06f7fb89db356ca9796345071 (diff) |
channel: Make the test not crash again.
* Initialize logging
* The callback expects NULL or a subscriber connection
Diffstat (limited to 'openbsc/tests')
-rw-r--r-- | openbsc/tests/channel/channel_test.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c index 1121dd5ad..440e1803c 100644 --- a/openbsc/tests/channel/channel_test.c +++ b/openbsc/tests/channel/channel_test.c @@ -22,9 +22,15 @@ #include <assert.h> +#include <osmocom/core/application.h> #include <osmocom/core/select.h> -#include <openbsc/gsm_subscriber.h> + #include <openbsc/abis_rsl.h> +#include <openbsc/debug.h> +#include <openbsc/gsm_subscriber.h> + +static int s_end = 0; +static struct gsm_subscriber_connection s_conn; /* our handler */ static int subscr_cb(unsigned int hook, unsigned int event, struct msgb *msg, void *data, void *param) @@ -32,16 +38,17 @@ static int subscr_cb(unsigned int hook, unsigned int event, struct msgb *msg, vo assert(hook == 101); assert(event == 200); assert(msg == (void*)0x1323L); - assert(data == (void*)0x4242L); + assert(data == &s_conn); assert(param == (void*)0x2342L); printf("Reached, didn't crash, test passed\n"); + s_end = true; return 0; } /* mock object for testing, directly invoke the cb... maybe later through the timer */ void paging_request(struct gsm_bts *bts, struct gsm_subscriber *subscriber, int type, gsm_cbfn *cbfn, void *data) { - cbfn(101, 200, (void*)0x1323L, (void*)0x4242L, data); + cbfn(101, 200, (void*)0x1323L, &s_conn, data); } @@ -50,6 +57,8 @@ int main(int argc, char **argv) struct gsm_network *network; struct gsm_bts *bts; + osmo_init_logging(&log_info); + printf("Testing the gsm_subscriber chan logic\n"); /* Create a dummy network */ @@ -67,9 +76,11 @@ int main(int argc, char **argv) /* Ask for a channel... */ subscr_get_channel(subscr, RSL_CHANNEED_TCH_F, subscr_cb, (void*)0x2342L); - while (1) { + while (!s_end) { osmo_select_main(0); } + + return EXIT_SUCCESS; } void _abis_nm_sendmsg() {} |