Harald Welte has submitted this change and it was merged.

Change subject: bts: Add f_shutdown() for clean shutdown; use it from tests
......................................................................


bts: Add f_shutdown() for clean shutdown; use it from tests

Change-Id: I225d2363c77dce969bda95ff27506bece586a34a
---
M bts/BTS_Tests.ttcn
1 file changed, 35 insertions(+), 4 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 8d789bd..a345d75 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -280,6 +280,12 @@
        }
 }
 
+function f_shutdown() runs on test_CT {
+       /* shut down all "externally interfaced" components first to avoid 
unclean shutdown */
+       vc_IPA.stop;
+       vc_RSL.stop;
+}
+
 /* Attach L1CTL to master test_CT (classic tests, non-handler mode) */
 function f_init_l1ctl() runs on test_CT {
        map(self:L1CTL, system:L1CTL);
@@ -442,6 +448,7 @@
        f_init(testcasename());
        vc_conn := f_start_handler(refers(f_TC_chan_act_stress), pars);
        vc_conn.done;
+       f_shutdown();
 }
 
 /* Test if re-activation of an already active channel fails as expected */
@@ -462,9 +469,10 @@
 testcase TC_chan_act_react() runs on test_CT {
        var ConnHdlr vc_conn;
        var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), 
ts_RSL_ChanMode_SIGN));
-       f_init(testcasename());
+       f_init();
        vc_conn := f_start_handler(refers(f_TC_chan_act_react), pars);
        vc_conn.done;
+       f_shutdown();
 }
 
 /* Attempt to de-activate a channel that's not active */
@@ -483,9 +491,10 @@
 }
 testcase TC_chan_deact_not_active() runs on test_CT {
        var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), 
ts_RSL_ChanMode_SIGN));
-       f_init(testcasename());
+       f_init();
        var ConnHdlr vc_conn := 
f_start_handler(refers(f_TC_chan_deact_not_active), pars);
        vc_conn.done;
+       f_shutdown();
 }
 
 /* attempt to activate channel with wrong RSL Channel Nr IE; expect NACK */
@@ -514,7 +523,7 @@
        var ConnHdlr vc_conn;
        var ConnHdlrPars pars;
 
-       f_init(testcasename());
+       f_init();
 
        var WrongChanNrCases wrong := {
                valueof(t_WCN(t_RslChanNr_RACH(0), "RACH is not a dedicated 
channel")),
@@ -537,6 +546,7 @@
                vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_nr), 
pars);
                vc_conn.done;
        }
+       f_shutdown();
 }
 
 /***********************************************************************
@@ -603,12 +613,14 @@
                }
        }
        setverdict(pass);
+       f_shutdown();
 }
 
 /* Send 1000 RACH Requests (flood ~ 89/s) and count if count(Abis) == 
count(Um) */
 testcase TC_rach_count() runs on test_CT {
-       f_init(testcasename());
+       f_init();
        f_init_l1ctl();
+       f_sleep(1.0);
        f_l1_tune(L1CTL);
 
        var GsmFrameNumber fn_last := 0;
@@ -638,6 +650,7 @@
        } else {
                setverdict(fail, "Received only ", rsl_chrqd, " out of 1000 
RACH");
        }
+       f_shutdown();
 }
 
 private function f_main_trxc_connect() runs on test_CT {
@@ -700,6 +713,7 @@
        /* more than 63 bits is not legal / permitted */
        f_rach_toffs(64*256, false);
        f_rach_toffs(127*256, false);
+       f_shutdown();
 }
 
 /***********************************************************************
@@ -968,6 +982,7 @@
                vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), 
pars);
                vc_conn.done;
        }
+       f_shutdown();
 }
 testcase TC_meas_res_sign_tchh() runs on test_CT {
        var ConnHdlr vc_conn;
@@ -978,6 +993,7 @@
                vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), 
pars);
                vc_conn.done;
        }
+       f_shutdown();
 }
 testcase TC_meas_res_sign_sdcch4() runs on test_CT {
        var ConnHdlr vc_conn;
@@ -988,6 +1004,7 @@
                vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), 
pars);
                vc_conn.done;
        }
+       f_shutdown();
 }
 testcase TC_meas_res_sign_sdcch8() runs on test_CT {
        var ConnHdlr vc_conn;
@@ -998,6 +1015,7 @@
                vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), 
pars);
                vc_conn.done;
        }
+       f_shutdown();
 }
 testcase TC_meas_res_sign_tchh_toa256() runs on test_CT {
        var ConnHdlr vc_conn;
@@ -1010,6 +1028,7 @@
                vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), 
pars);
                vc_conn.done;
        }
+       f_shutdown();
 }
 
 
@@ -1205,6 +1224,8 @@
        [] as_rsl_res_ind();
        }
 
+       f_shutdown();
+
        log("num_paging_sent=", st.num_paging_sent, " rcvd_msgs=", 
st.num_paging_rcv_msgs,
            " rcvd_ids=", st.num_paging_rcv_ids);
        return st;
@@ -1317,6 +1338,7 @@
        /* FIXME: check if imm.ass arrive on Um side */
        /* FIXME: check for DELETE INDICATION */
        f_sleep(100.0);
+       f_shutdown();
 }
 
 /***********************************************************************
@@ -1697,6 +1719,7 @@
        f_init();
        /* 2+3+4 are mandatory and set in f_init() */
        f_TC_si_sched();
+       f_shutdown();
 }
 
 testcase TC_si_sched_1() runs on test_CT {
@@ -1704,6 +1727,7 @@
        si_cfg.si1_present := true;
        f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_1, 
'5506198fb38000000000000000000000000000e504002b'O);
        f_TC_si_sched();
+       f_shutdown();
 }
 
 testcase TC_si_sched_2bis() runs on test_CT {
@@ -1711,6 +1735,7 @@
        si_cfg.si2bis_present := true;
        f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, 
'550602bfe809b3ff00000000000000000000007900002b'O);
        f_TC_si_sched();
+       f_shutdown();
 }
 
 testcase TC_si_sched_2ter() runs on test_CT {
@@ -1718,6 +1743,7 @@
        si_cfg.si2ter_present := true;
        f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, 
'010603bf66b0aa0a00000002000000000000002b2b2b2b'O);
        f_TC_si_sched();
+       f_shutdown();
 }
 
 testcase TC_si_sched_2ter_2bis() runs on test_CT {
@@ -1727,6 +1753,7 @@
        si_cfg.si2ter_present := true;
        f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, 
'010603bf66b0aa0a00000002000000000000002b2b2b2b'O);
        f_TC_si_sched();
+       f_shutdown();
 }
 
 testcase TC_si_sched_2quater() runs on test_CT {
@@ -1734,6 +1761,7 @@
        si_cfg.si2quater_present := true;
        f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, 
'050607a8a0364aa698d72ff424feee0506d5e7fff02043'O);
        f_TC_si_sched();
+       f_shutdown();
 }
 
 testcase TC_si_sched_13() runs on test_CT {
@@ -1741,6 +1769,7 @@
        si_cfg.si13_present := true;
        //f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, fixme);
        f_TC_si_sched();
+       f_shutdown();
 }
 
 testcase TC_si_sched_13_2bis_2ter_2quater() runs on test_CT {
@@ -1754,6 +1783,7 @@
        si_cfg.si13_present := true;
        //f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, fixme);
        f_TC_si_sched();
+       f_shutdown();
 }
 
 
@@ -1763,6 +1793,7 @@
        //ts_RSL_BCCH_INFO(si_type, info);
        /* expect no ERROR REPORT after either of them *
        /* negative test: ensure ERROR REPORT on unsupported types */
+       f_shutdown();
 }
 
 /***********************************************************************

-- 
To view, visit https://gerrit.osmocom.org/7248
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I225d2363c77dce969bda95ff27506bece586a34a
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder

Reply via email to