fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25670 )


Change subject: BTS: reproduce a race condition described in OS#5245
......................................................................

BTS: reproduce a race condition described in OS#5245

Change-Id: I3b602ac9dbe0ab3e80eb30de573c9b48a79872d8
Depends: Idb1ef445bc14a6312f08a83ecacc3a938b0e1d70
Related: OS#5245
---
M bts/BTS_Tests.ttcn
1 file changed, 68 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/70/25670/1

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 44d9de4..6753eec 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -6281,6 +6281,72 @@
        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 @@
        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() );


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25670
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I3b602ac9dbe0ab3e80eb30de573c9b48a79872d8
Gerrit-Change-Number: 25670
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to