diff options
author | Max <msuraev@sysmocom.de> | 2016-05-18 13:04:47 +0200 |
---|---|---|
committer | Holger Freyther <holger@freyther.de> | 2016-05-31 09:32:12 +0000 |
commit | 69e9c0dfc6cc10c07d03f8800d8ff7197fe97c8b (patch) | |
tree | d54d4a96e6ed18afe30e7c9d870a5586ea758a9f /openbsc/tests/gsm0408/gsm0408_test.c | |
parent | 82dd983dd85c04b5aa013365334f2a249140902e (diff) |
Make si2q scheduling optional
Previously si2quater SI messages were always scheduled. Check for
neighbor configuration and only schedule si2q when necessary. Add
corresponding unit test.
Change-Id: Ibe997803ffb894133fd4d838410fe735791d414f
Fixes: OS#1727
Reviewed-on: https://gerrit.osmocom.org/81
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
Diffstat (limited to 'openbsc/tests/gsm0408/gsm0408_test.c')
-rw-r--r-- | openbsc/tests/gsm0408/gsm0408_test.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 92626670c..7acc93f96 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -21,7 +21,7 @@ #include <assert.h> #include <stdio.h> #include <stdlib.h> - +#include <stdbool.h> #include <arpa/inet.h> #include <openbsc/gsm_04_08.h> @@ -95,9 +95,15 @@ static inline void add_arfcn_b(struct osmo_earfcn_si2q *e, uint16_t earfcn, static inline void gen(struct gsm_bts *bts) { + bts->si_valid = 0; + bts->si_valid |= (1 << SYSINFO_TYPE_2quater); + /* should be no-op as entire buffer is filled with padding: */ + memset(bts->si_buf[SYSINFO_TYPE_2quater], 0xAE, GSM_MACBLOCK_LEN); int r = gsm_generate_si(bts, SYSINFO_TYPE_2quater); + bool v = bts->si_valid & (1 << SYSINFO_TYPE_2quater); if (r > 0) - printf("generated SI2quater: [%d] %s\n", r, + printf("generated %s SI2quater: [%d] %s\n", + v ? "valid" : "invalid", r, osmo_hexdump(bts->si_buf[SYSINFO_TYPE_2quater], r)); else printf("failed to generate SI2quater: %s\n", strerror(-r)); @@ -123,6 +129,9 @@ static inline void test_si2q_u(void) exit(1); bts = gsm_bts_alloc(network); + /* first generate invalid SI as no UARFCN added */ + gen(bts); + /* subsequent calls should produce valid SI if there's enough memory */ _bts_uarfcn_add(bts, 1982, 13, 1); _bts_uarfcn_add(bts, 1982, 44, 0); _bts_uarfcn_add(bts, 1982, 61, 1); @@ -155,7 +164,9 @@ static inline void test_si2q_e(void) bts->si_common.si2quater_neigh_list.thresh_hi = 5; osmo_earfcn_init(&bts->si_common.si2quater_neigh_list); - + /* first generate invalid SI as no EARFCN added */ + gen(bts); + /* subsequent calls should produce valid SI if there's enough memory */ add_arfcn_b(&bts->si_common.si2quater_neigh_list, 1917, 1); gen(bts); |