BTS: reproduce a race condition described in OS#5245

Change-Id: I3b602ac9dbe0ab3e80eb30de573c9b48a79872d8
Depends: Idb1ef445bc14a6312f08a83ecacc3a938b0e1d70
Related: OS#5245
This commit is contained in:
Vadim Yanitskiy 2021-10-03 15:00:20 +06:00 committed by fixeria
parent 42525ac97b
commit 64043d8bae
1 changed files with 68 additions and 0 deletions

View File

@ -6281,6 +6281,72 @@ testcase TC_dyn_osmo_pdch_sdcch8_act() runs on test_CT {
vc_conn.done;
}
/* Reproduce a race condition described in OS#5245 */
private function f_rsl_chan_act_deact(charstring id) runs on ConnHdlr {
f_rsl_chan_act(g_pars.chan_mode);
f_sleep(1.0);
f_rsl_chan_deact();
setverdict(pass);
}
testcase TC_dyn_osmo_pdch_tchh_race_act() runs on test_CT {
var ConnHdlrPars pars[2];
var ConnHdlr vc_conn[2];
var TrxcMessage rsp;
f_init();
/* Configure an artificial delay of 200 ms for TRXC RSP messages */
rsp := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id,
ts_TRXC_FAKE_TRXC_DELAY(200));
/* Activate all sub-channels of TCH/H on TS4 immediately in hope that the second
* CHANnel ACTIVation message will be handled before the PHY responds to 'SETSLOT' */
for (var integer i := 0; i < sizeof(pars); i := i + 1) {
/* TS4 is an Osmocom style dynamic timeslot, we want it to be TCH/H */
pars[i] := valueof(t_Pars(t_RslChanNr_Lm(4, i), ts_RSL_ChanMode_SIGN));
vc_conn[i] := f_start_handler(refers(f_rsl_chan_act_deact),
pars[i], l1ctl := false);
}
/* Wait for all components to finish */
for (var integer i := 0; i < sizeof(pars); i := i + 1) {
vc_conn[i].done;
}
/* Disable the artificial delay for TRXC RSP messages */
rsp := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id,
ts_TRXC_FAKE_TRXC_DELAY(0));
}
testcase TC_dyn_osmo_pdch_sdcch8_race_act() runs on test_CT {
var ConnHdlrPars pars[8];
var ConnHdlr vc_conn[8];
var TrxcMessage rsp;
f_init();
/* Configure an artificial delay of 200 ms for TRXC RSP messages */
rsp := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id,
ts_TRXC_FAKE_TRXC_DELAY(200));
/* Activate all sub-channels of SDCCH/8 on TS4 immediately in hope that subsequent
* CHANnel ACTIVation messages will be handled before the PHY responds to 'SETSLOT' */
for (var integer i := 0; i < sizeof(pars); i := i + 1) {
/* TS4 is an Osmocom style dynamic timeslot, we want it to be SDCCH/8 */
pars[i] := valueof(t_Pars(t_RslChanNr_SDCCH8(4, i), ts_RSL_ChanMode_SIGN));
vc_conn[i] := f_start_handler(refers(f_rsl_chan_act_deact),
pars[i], l1ctl := false);
}
/* Wait for all components to finish */
for (var integer i := 0; i < sizeof(pars); i := i + 1) {
vc_conn[i].done;
}
/* Disable the artificial delay for TRXC RSP messages */
rsp := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id,
ts_TRXC_FAKE_TRXC_DELAY(0));
}
/***********************************************************************
* IPA Style Dynamic Timeslot Support
***********************************************************************/
@ -7915,6 +7981,8 @@ control {
execute( TC_dyn_osmo_pdch_tchf_act() );
execute( TC_dyn_osmo_pdch_tchh_act() );
execute( TC_dyn_osmo_pdch_sdcch8_act() );
execute( TC_dyn_osmo_pdch_tchh_race_act() );
execute( TC_dyn_osmo_pdch_sdcch8_race_act() );
execute( TC_dyn_ipa_pdch_tchf_act() );
execute( TC_dyn_ipa_pdch_tchf_act_pdch_act_nack() );