From 294b0a299ce97b3d076e9768d96048755386ace5 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 10 Mar 2018 23:26:48 +0100 Subject: bts: Add f_shutdown() for clean shutdown; use it from tests Change-Id: I225d2363c77dce969bda95ff27506bece586a34a --- bts/BTS_Tests.ttcn | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'bts/BTS_Tests.ttcn') diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn index 8d789bd1..a345d75d 100644 --- a/bts/BTS_Tests.ttcn +++ b/bts/BTS_Tests.ttcn @@ -280,6 +280,12 @@ function f_init(charstring id := "BTS-Test") runs on test_CT { } } +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 @@ testcase TC_chan_act_stress() runs on test_CT { 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 @@ function f_TC_chan_act_react(charstring id) runs on ConnHdlr { 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 @@ function f_TC_chan_deact_not_active(charstring id) runs on ConnHdlr { } 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 @@ testcase TC_chan_act_wrong_nr() runs on test_CT { 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 @@ testcase TC_chan_act_wrong_nr() runs on test_CT { vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_nr), pars); vc_conn.done; } + f_shutdown(); } /*********************************************************************** @@ -603,12 +613,14 @@ testcase TC_rach_content() runs on test_CT { } } 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 @@ testcase TC_rach_count() runs on test_CT { } 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 @@ testcase TC_rach_max_ta() runs on test_CT { /* 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 @@ testcase TC_meas_res_sign_tchf() runs on test_CT { 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 @@ testcase TC_meas_res_sign_tchh() runs on test_CT { 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 @@ testcase TC_meas_res_sign_sdcch4() runs on test_CT { 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 @@ testcase TC_meas_res_sign_sdcch8() runs on test_CT { 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 @@ testcase TC_meas_res_sign_tchh_toa256() runs on test_CT { vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars); vc_conn.done; } + f_shutdown(); } @@ -1205,6 +1224,8 @@ private function f_TC_paging(PagingTestCfg cfg) runs on test_CT return PagingTes [] 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 @@ testcase TC_imm_ass() runs on test_CT { /* FIXME: check if imm.ass arrive on Um side */ /* FIXME: check for DELETE INDICATION */ f_sleep(100.0); + f_shutdown(); } /*********************************************************************** @@ -1697,6 +1719,7 @@ testcase TC_si_sched_default() runs on test_CT { 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 @@ testcase TC_si_sched_1() runs on test_CT { 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 @@ testcase TC_si_sched_2bis() runs on test_CT { 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 @@ testcase TC_si_sched_2ter() runs on test_CT { 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 @@ testcase TC_si_sched_2ter_2bis() runs on test_CT { 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 @@ testcase TC_si_sched_2quater() runs on test_CT { 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 @@ testcase TC_si_sched_13() runs on test_CT { 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 @@ testcase TC_si_sched_13_2bis_2ter_2quater() runs on test_CT { 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 @@ testcase TC_bcch_info() runs on test_CT { //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(); } /*********************************************************************** -- cgit v1.2.3