summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-10-03 15:00:20 +0600
committerfixeria <vyanitskiy@sysmocom.de>2021-10-04 12:37:23 +0000
commit64043d8bae1831b568c02b42df6aca60f5383e48 (patch)
tree159dfcada5fe523365eb717d2deb2f5f7d942a8c
parent42525ac97be7403ad51b6adb0eff1de998749240 (diff)
BTS: reproduce a race condition described in OS#5245
-rw-r--r--bts/BTS_Tests.ttcn68
1 files changed, 68 insertions, 0 deletions
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 44d9de48..6753eec7 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -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() );