From 8206f20f8943d52a597a7b4fb74e1f2c86fb878f Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 28 Mar 2018 18:08:05 +0200 Subject: move init from gsm_bts_alloc_register() to gsm_bts_alloc(); fix gsm0408_test gsm_bts_alloc() ought to do all static initialization, so that e.g. unit tests can use an initialized bts struct that is fully usable, just not registered at the gsm_network. For example, two INIT_LLIST_HEAD() and various system information data pointers (pointing to proper places within the same bts struct) should definitely never be omitted. This fixes the remaining errors of gsm0408_test's SI tests, as revealed by a sanitizer build using gcc (Debian 7.3.0-12) 7.3.0. Fixes: ../../../../src/osmo-bsc/src/libbsc/system_information.c:613:3: runtime error: null pointer passed as argument 1, which is declared to never be null Initializing the bts->si_common.rach_control results in different expected bytes for SI2. The initialized values are bts->si_common.rach_control.re = 1; /* no re-establishment */ bts->si_common.rach_control.tx_integer = 9; /* 12 slots spread - 217/115 slots delay */ bts->si_common.rach_control.max_trans = 3; /* 7 retransmissions */ bts->si_common.rach_control.t2 = 4; /* no emergency calls */ Causing a change to e5 04. 04 is t2 = 4, and the remaining values are verified by: uint8_t re :1, cell_bar :1, tx_integer :4, max_trans :2; >>> hex(1 + (9 << 2) + (3 << 6)) '0xe5' Change-Id: I13ef24bbe0f1fbe49465e67a0b67d6fd69fff3b1 --- tests/gsm0408/gsm0408_test.ok | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/gsm0408') diff --git a/tests/gsm0408/gsm0408_test.ok b/tests/gsm0408/gsm0408_test.ok index 6bb1140a5..727072137 100644 --- a/tests/gsm0408/gsm0408_test.ok +++ b/tests/gsm0408/gsm0408_test.ok @@ -212,8 +212,8 @@ generated valid SI2quater [05/05]: [23] 59 06 07 4a a0 04 86 59 84 26 53 97 65 6 BTS deallocated OK in test_si2q_long() BTS allocation OK in test_si_ba_ind() Testing if BA-IND is set as expected in SI2xxx and SI5xxx -SI2: 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -SI2bis: 59 06 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2b +SI2: 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e5 04 00 +SI2bis: 59 06 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e5 04 00 2b SI2ter: 59 06 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2b 2b 2b 2b SI5: 06 1d 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 SI5bis: 06 05 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -- cgit v1.2.3