Change in ...osmo-ttcn3-hacks[master]: bts: don't require users to pass test case name to f_init()

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Jun 1 21:15:46 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14331


Change subject: bts: don't require users to pass test case name to f_init()
......................................................................

bts: don't require users to pass test case name to f_init()

The f_init() function itself can very well derive the identity using
the built-in testcasename() function.  There's no need asking users
to do that - many of them don't do it in the first place :/

Change-Id: I17a61a84fba4df31b8baab1f631c8aa55d894dbd
---
M bts/BTS_Tests.ttcn
M bts/BTS_Tests_SMSCB.ttcn
2 files changed, 42 insertions(+), 41 deletions(-)



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

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index ed1d8e1..c43774d 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -332,7 +332,8 @@
 }
 
 /* global init function */
-function f_init(charstring id := "BTS-Test") runs on test_CT {
+function f_init() runs on test_CT {
+	var charstring id := testcasename();
 	timer T := mp_ipa_up_timeout;
 	g_AllChannels := {
 		/* TS 1..4: TCH/F */
@@ -593,7 +594,7 @@
 testcase TC_chan_act_stress() 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_stress), pars);
 	vc_conn.done;
 	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
@@ -700,7 +701,7 @@
 /* execute the same callback function on a variety of logical channels */
 private function f_testmatrix_each_chan(ConnHdlrPars pars, void_fn fn) runs on test_CT {
 	var ConnHdlr vc_conn;
-	f_init(testcasename());
+	f_init();
 
 	/* test on each of the channels we have */
 	for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i+1) {
@@ -1228,7 +1229,7 @@
 
 /* Send 1000 RACH requests and check their RA+FN on the RSL side */
 testcase TC_rach_content() runs on test_CT {
-	f_init(testcasename());
+	f_init();
 	f_init_l1ctl();
 	f_l1_tune(L1CTL);
 
@@ -1470,7 +1471,7 @@
 
 /* Test if dropping of RACH Based on NM_ATT_MAX_TA works */
 testcase TC_rach_max_ta() runs on test_CT {
-	f_init(testcasename());
+	f_init();
 	f_init_l1ctl();
 	f_l1_tune(L1CTL);
 	f_sleep(1.0);
@@ -1887,7 +1888,7 @@
 testcase TC_meas_res_sign_tchf() runs on test_CT {
 	var ConnHdlr vc_conn;
 	var ConnHdlrPars pars;
-	f_init(testcasename());
+	f_init();
 	for (var integer tn := 1; tn <= 4; tn := tn+1) {
 		pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN));
 		vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
@@ -1898,7 +1899,7 @@
 testcase TC_meas_res_sign_tchh() runs on test_CT {
 	var ConnHdlr vc_conn;
 	var ConnHdlrPars pars;
-	f_init(testcasename());
+	f_init();
 	for (var integer ss := 0; ss <= 1; ss := ss+1) {
 		pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN));
 		vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
@@ -1909,7 +1910,7 @@
 testcase TC_meas_res_sign_sdcch4() runs on test_CT {
 	var ConnHdlr vc_conn;
 	var ConnHdlrPars pars;
-	f_init(testcasename());
+	f_init();
 	for (var integer ss := 0; ss <= 3; ss := ss+1) {
 		pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0, ss), ts_RSL_ChanMode_SIGN));
 		vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
@@ -1920,7 +1921,7 @@
 testcase TC_meas_res_sign_sdcch8() runs on test_CT {
 	var ConnHdlr vc_conn;
 	var ConnHdlrPars pars;
-	f_init(testcasename());
+	f_init();
 	for (var integer ss := 0; ss <= 7; ss := ss+1) {
 		pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, ss), ts_RSL_ChanMode_SIGN));
 		vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
@@ -1931,7 +1932,7 @@
 testcase TC_meas_res_sign_tchh_toa256() runs on test_CT {
 	var ConnHdlr vc_conn;
 	var ConnHdlrPars pars;
-	f_init(testcasename());
+	f_init();
 	f_vty_config(BTSVTY, "bts 0", "supp-meas-info toa256");
 	for (var integer ss := 0; ss <= 1; ss := ss+1) {
 		pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN));
@@ -2003,7 +2004,7 @@
 testcase TC_rsl_ms_pwr_ctrl() runs on test_CT {
 	var ConnHdlr vc_conn;
 	var ConnHdlrPars pars;
-	f_init(testcasename());
+	f_init();
 
 	for (var integer tn := 1; tn <= 4; tn := tn+1) {
 		pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN));
@@ -2055,7 +2056,7 @@
 testcase TC_rsl_chan_initial_ta() runs on test_CT {
 	var ConnHdlr vc_conn;
 	var ConnHdlrPars pars;
-	f_init(testcasename());
+	f_init();
 	pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
 	vc_conn := f_start_handler(refers(f_tc_rsl_chan_initial_ta), pars);
 	vc_conn.done;
@@ -2129,7 +2130,7 @@
 testcase TC_conn_fail_crit() runs on test_CT {
 	var ConnHdlr vc_conn;
 	var ConnHdlrPars pars;
-	f_init(testcasename());
+	f_init();
 	pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, 3), ts_RSL_ChanMode_SIGN));
 	pars.t_guard := 60.0;
 	vc_conn := f_start_handler(refers(f_TC_conn_fail_crit), pars);
@@ -2273,7 +2274,7 @@
 
 /* Helper function for paging related testing */
 private function f_TC_paging(PagingTestCfg cfg) runs on test_CT return PagingTestState {
-	f_init(testcasename());
+	f_init();
 	f_init_l1ctl();
 	f_l1_tune(L1CTL);
 
@@ -2511,7 +2512,7 @@
 	var charstring res_str;
 	var float rx_ratio;
 
-	f_init(testcasename());
+	f_init();
 	f_init_l1ctl();
 	f_l1_tune(L1CTL);
 
@@ -3024,7 +3025,7 @@
 
 
 testcase TC_bcch_info() runs on test_CT {
-	f_init(testcasename());
+	f_init();
 	/* FIXME: enable / disable individual BCCH info */
 	//ts_RSL_BCCH_INFO(si_type, info);
 	/* expect no ERROR REPORT after either of them *
@@ -3057,7 +3058,7 @@
 
 /* Provoke a protocol error (message too short) and match on ERROR REPORT */
 testcase TC_rsl_protocol_error() runs on test_CT {
-	f_init(testcasename());
+	f_init();
 	var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O));
 	rsl.ies := omit;
 	RSL_CCHAN.send(ts_RSL_UD(rsl));
@@ -3067,7 +3068,7 @@
 
 /* Provoke a mandatory IE error and match on ERROR REPORT */
 testcase TC_rsl_mand_ie_error() runs on test_CT {
-	f_init(testcasename());
+	f_init();
 
 	var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O));
 	rsl.ies := { rsl.ies[0] };
@@ -3078,7 +3079,7 @@
 
 /* Provoke an IE content error and match on ERROR REPORT */
 testcase TC_rsl_ie_content_error() runs on test_CT {
-	f_init(testcasename());
+	f_init();
 	var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O));
 	rsl.ies[1].body.sysinfo_type := RSL_SYSTEM_INFO_5;
 	RSL_CCHAN.send(ts_RSL_UD(rsl));
@@ -3097,7 +3098,7 @@
 	var ConnHdlr vc_conn;
 	var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_SDCCH4(0,0), ts_RSL_ChanMode_SIGN));
 
-	f_init(testcasename());
+	f_init();
 
 	vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_mdisc), pars);
 	vc_conn.done;
@@ -3129,7 +3130,7 @@
 	var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_SDCCH4(0,0), ts_RSL_ChanMode_SIGN));
 	var template (value) RSL_Message rsl_tx;
 
-	f_init(testcasename());
+	f_init();
 
 	/* Common Channel with wrong message type */
 	RSL_CCHAN.clear;
@@ -3167,7 +3168,7 @@
 	var ConnHdlr vc_conn;
 	var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_SDCCH4(0,0), ts_RSL_ChanMode_SIGN));
 
-	f_init(testcasename());
+	f_init();
 
 	RSL_CCHAN.clear;
 	vc_conn := f_start_handler(refers(f_TC_err_rep_wrong_sequence), pars);
@@ -3186,7 +3187,7 @@
 }
 testcase TC_ipa_dlcx_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_ipa_dlcx_not_active), pars);
 	vc_conn.done;
 }
@@ -3200,7 +3201,7 @@
 }
 testcase TC_ipa_crcx_twice_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_ipa_crcx_twice_not_active), pars);
 	vc_conn.done;
 }
@@ -3221,7 +3222,7 @@
 }
 testcase TC_ipa_crcx_mdcx_dlcx_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_ipa_crcx_mdcx_dlcx_not_active), pars);
 	vc_conn.done;
 }
@@ -3248,7 +3249,7 @@
 }
 testcase TC_ipa_crcx_mdcx_mdcx_dlcx_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_ipa_crcx_mdcx_mdcx_dlcx_not_active), pars);
 	vc_conn.done;
 }
@@ -3261,7 +3262,7 @@
 testcase TC_ipa_crcx_sdcch_not_active() runs on test_CT {
 	var ConnHdlrPars pars;
 	var ConnHdlr vc_conn;
-	f_init(testcasename());
+	f_init();
 
 	pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0,1), ts_RSL_ChanMode_SIGN));
 	vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars);
@@ -4283,7 +4284,7 @@
 testcase TC_dyn_osmo_pdch_act_deact() runs on test_CT {
 	var ConnHdlrPars pars;
 	var ConnHdlr vc_conn;
-	f_init(testcasename());
+	f_init();
 
 	pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN));
 	vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_act_deact), pars, true);
@@ -4305,7 +4306,7 @@
 testcase TC_dyn_osmo_pdch_unsol_deact() runs on test_CT {
 	var ConnHdlrPars pars;
 	var ConnHdlr vc_conn;
-	f_init(testcasename());
+	f_init();
 
 	pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN));
 	vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_unsol_deact), pars, true);
@@ -4331,7 +4332,7 @@
 testcase TC_dyn_osmo_pdch_double_act() runs on test_CT {
 	var ConnHdlrPars pars;
 	var ConnHdlr vc_conn;
-	f_init(testcasename());
+	f_init();
 
 	pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN));
 	vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_double_act), pars, true);
@@ -4359,7 +4360,7 @@
 testcase TC_dyn_osmo_pdch_tchf_act() runs on test_CT {
 	var ConnHdlrPars pars;
 	var ConnHdlr vc_conn;
-	f_init(testcasename());
+	f_init();
 
 	pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN));
 	vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_tchf_act), pars, true);
@@ -4391,7 +4392,7 @@
 testcase TC_dyn_osmo_pdch_tchh_act() runs on test_CT {
 	var ConnHdlrPars pars;
 	var ConnHdlr vc_conn;
-	f_init(testcasename());
+	f_init();
 
 	pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN));
 	vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_tchh_act), pars, true);
@@ -4511,7 +4512,7 @@
 testcase TC_dyn_ipa_pdch_tchf_act() runs on test_CT {
 	var ConnHdlrPars pars;
 	var ConnHdlr vc_conn;
-	f_init(testcasename());
+	f_init();
 
 	pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN));
 	vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_tchf_act), pars, true);
@@ -4547,7 +4548,7 @@
 testcase TC_dyn_ipa_pdch_tchf_act_pdch_act_nack() runs on test_CT {
 	var ConnHdlrPars pars;
 	var ConnHdlr vc_conn;
-	f_init(testcasename());
+	f_init();
 
 	pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN));
 	vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_tchf_act_pdch_act_nack), pars, true);
@@ -4579,7 +4580,7 @@
 testcase TC_dyn_ipa_pdch_act_tchf_act_nack() runs on test_CT {
 	var ConnHdlrPars pars;
 	var ConnHdlr vc_conn;
-	f_init(testcasename());
+	f_init();
 
 	pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN));
 	vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_act_tchf_act_nack), pars, true);
@@ -4626,7 +4627,7 @@
 private function f_rll_testmatrix(RllTestCases tcs, void_fn fn) runs on test_CT {
 	var ConnHdlrPars pars;
 	var ConnHdlr vc_conn;
-	f_init(testcasename());
+	f_init();
 
 	/* test on each of the channels we have */
 	for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i+1) {
@@ -5446,7 +5447,7 @@
 	var ConnHdlr vc_conn;
 	var ConnHdlrPars pars;
 	pars.t_guard := 60.0;
-	f_init(testcasename());
+	f_init();
 	for (var integer i := 0; i < sizeof(g_AllChannels); i := i + 1) {
 		pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN(dtxd)));
 		if (dtxd) {
diff --git a/bts/BTS_Tests_SMSCB.ttcn b/bts/BTS_Tests_SMSCB.ttcn
index 4d357ba..962b516 100644
--- a/bts/BTS_Tests_SMSCB.ttcn
+++ b/bts/BTS_Tests_SMSCB.ttcn
@@ -213,7 +213,7 @@
 	f_init_vty_bsc();
 	/* ensure that a CBCH is present in channel combination */
 	f_vty_cbch_setup(pars.use_sdcch4);
-	f_init(testcasename());
+	f_init();
 
 	f_init_l1ctl();
 	f_l1_tune(L1CTL, ccch_mode := CCCH_MODE_COMBINED_CBCH);
@@ -710,7 +710,7 @@
 	var ASP_RSL_Unitdata rx_ud;
 	timer T := 10.0;
 
-	f_init(testcasename());
+	f_init();
 	f_init_vty_bsc();
 
 	T.start;
@@ -738,7 +738,7 @@
 	var ASP_RSL_Unitdata rx_ud;
 	timer T := 10.0;
 
-	f_init(testcasename());
+	f_init();
 
 	RSL_CCHAN.clear;
 	T.start;
@@ -794,7 +794,7 @@
 	timer T_initial_guard := 2.0;
 	var integer i;
 
-	f_init(testcasename());
+	f_init();
 
 	/* send tons of SMSCB Command */
 	for (i := 0; i < 30; i := i+1) {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14331
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: I17a61a84fba4df31b8baab1f631c8aa55d894dbd
Gerrit-Change-Number: 14331
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190601/7eea23d4/attachment.html>


More information about the gerrit-log mailing list