Change in osmo-ttcn3-hacks[master]: BTS_Tests: Use Misc_Helpers.f_shutdown consistently

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

daniel gerrit-no-reply at lists.osmocom.org
Wed Oct 24 14:32:28 UTC 2018


daniel has submitted this change and it was merged. ( https://gerrit.osmocom.org/11452 )

Change subject: BTS_Tests: Use Misc_Helpers.f_shutdown consistently
......................................................................

BTS_Tests: Use Misc_Helpers.f_shutdown consistently

Replace all calls to setverdict(fail) with f_shutdown() since I'd rather
fail and stop early in case we encounter an error.
Only replace setverdict(pass) with f_shutdown() if it is followed by
mtc.stop

Remove internal function f_shutdown and use the one from Misc_Helpers

Change-Id: Ia8b01a1876e969d6f0760ea625e4df83af4f54ca
---
M bts/BTS_Tests.ttcn
M bts/gen_links.sh
2 files changed, 131 insertions(+), 208 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, approved



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index fe0a933..5b073ef 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -1,5 +1,6 @@
 module BTS_Tests {
 
+import from Misc_Helpers all;
 import from General_Types all;
 import from GSM_Types all;
 import from GSM_RR_Types all;
@@ -270,8 +271,7 @@
 		pcu_last_info := sd.data;
 		}
 	[] pt.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(?, ?, ?))) -> value sd {
-		setverdict(fail, "Invalid PCU Version/BTS Number received");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Invalid PCU Version/BTS Number received");
 		}
 }
 
@@ -289,8 +289,7 @@
 	alt {
 	[] as_pcu_info_ind(pt, pcu_conn_id, pcu_last_info);
 	[] T.timeout {
-		setverdict(fail, "Timeout waiting for PCU INFO_IND");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU INFO_IND");
 		}
 	}
 }
@@ -341,8 +340,7 @@
 	alt {
 	[] RSL_CCHAN.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP});
 	[] T.timeout {
-		setverdict(fail, "Timeout waiting for ASP_IPA_EVENT_UP");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for ASP_IPA_EVENT_UP");
 		}
 	}
 	f_sleep(0.5);	/* workaround for OS#3000 */
@@ -366,12 +364,6 @@
 	}
 }
 
-function f_shutdown() runs on test_CT {
-	/* mtc.stop cleanly stops testcase execution to avoid unclean shutdown */
-	all component.stop;
-	mtc.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);
@@ -415,8 +407,7 @@
 
 private altstep as_Tguard() runs on ConnHdlr {
 	[] g_Tguard.timeout {
-		setverdict(fail, "Tguard timeout");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Tguard timeout");
 	}
 }
 
@@ -430,8 +421,7 @@
 	res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BB_TRXC, mp_bb_trxc_ip, mp_bb_trxc_port,
 							"", -1, -1, {udp:={}}, {});
 	if (not ispresent(res.connId)) {
-		setverdict(fail, "Could not connect to trx-control interface of trxcon, check your configuration");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Could not connect to trx-control interface of trxcon, check your configuration");
 	}
 	g_bb_trxc_conn_id := res.connId;
 }
@@ -481,15 +471,13 @@
 		setverdict(pass);
 		}
 	[] T.timeout {
-		setverdict(fail, "Timeout expecting " & id);
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout expecting " & id);
 		}
 	[not ignore_other] as_l1_sacch();
 	[not ignore_other] as_meas_res();
 	[not ignore_other] as_l1_dcch();
 	[not ignore_other] RSL.receive {
-		setverdict(fail, "Unexpected RSL message received");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RSL message received");
 		}
 	[ignore_other] RSL.receive { repeat; }
 	}
@@ -566,7 +554,7 @@
 	f_init(testcasename());
 	vc_conn := f_start_handler(refers(f_TC_chan_act_stress), pars);
 	vc_conn.done;
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* Test if re-activation of an already active channel fails as expected */
@@ -576,8 +564,7 @@
 	RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode));
 	alt {
 	[] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) {
-		setverdict(fail, "Unexpected CHAN ACT ACK on double activation");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected CHAN ACT ACK on double activation");
 		}
 	[] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) {
 		setverdict(pass);
@@ -591,7 +578,7 @@
 	f_init();
 	vc_conn := f_start_handler(refers(f_TC_chan_act_react), pars);
 	vc_conn.done;
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* Attempt to de-activate a channel that's not active */
@@ -604,8 +591,7 @@
 		setverdict(pass);
 		}
 	[] T.timeout {
-		setverdict(fail, "Timeout expecting RF_CHAN_REL_ACK");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout expecting RF_CHAN_REL_ACK");
 		}
 	}
 }
@@ -614,7 +600,7 @@
 	f_init();
 	var ConnHdlr vc_conn := f_start_handler(refers(f_TC_chan_deact_not_active), pars);
 	vc_conn.done;
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* attempt to activate channel with wrong RSL Channel Nr IE; expect NACK */
@@ -622,8 +608,7 @@
 	RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode));
 	alt {
 	[] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) {
-		setverdict(fail, "Unexpected CHAN ACT ACK");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected CHAN ACT ACK");
 		}
 	[] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) {
 		setverdict(pass);
@@ -667,7 +652,7 @@
 		vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_nr), pars);
 		vc_conn.done;
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* execute the same callback function on a variety of logical channels */
@@ -684,7 +669,7 @@
 		vc_conn.done;
 	}
 
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /***********************************************************************
@@ -696,8 +681,7 @@
 	T_sacch.start;
 	alt {
 	[not exp] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) {
-		setverdict(fail, "Received SACCH when not expecting it");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received SACCH when not expecting it");
 		}
 	[not exp] T_sacch.timeout {
 		setverdict(pass);
@@ -706,8 +690,7 @@
 		setverdict(pass);
 		}
 	[exp] T_sacch.timeout {
-		setverdict(fail, "Timeout waiting for SACCH on ", g_chan_nr);
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for SACCH on ", g_chan_nr));
 		}
 	[] L1CTL.receive { repeat; }
 	[] RSL.receive { repeat; }
@@ -750,7 +733,7 @@
 		vc_conn.done;
 	}
 	/* TODO: do the above in parallel, rather than sequentially? */
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* verify that given SACCH payload is present */
@@ -771,8 +754,7 @@
 		}
 	[] L1CTL.receive { repeat; }
 	[] T_sacch.timeout {
-		setverdict(fail, "Timeout waiting for SACCH ", l3_exp);
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for SACCH ", l3_exp));
 		}
 	}
 }
@@ -788,8 +770,7 @@
 	[] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) -> value dl {
 		var octetstring l3 := substr(dl.payload.data_ind.payload, 4, 19);
 		if (match(l3, l3_exp)) {
-			setverdict(fail, "Received unexpected SACCH ", dl);
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received unexpected SACCH ", dl));
 		} else {
 			repeat;
 		}
@@ -832,7 +813,7 @@
 		vc_conn.done;
 	}
 	/* TODO: do the above in parallel, rather than sequentially? */
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* Test for lchan-specific SACCH INFO MODIFY (TS 48.058 4.12) */
@@ -880,7 +861,7 @@
 		vc_conn.done;
 	}
 	/* TODO: do the above in parallel, rather than sequentially? */
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* Test SACCH scheduling of multiple different SI message types */
@@ -923,7 +904,7 @@
 		vc_conn.done;
 	}
 	/* TODO: do the above in parallel, rather than sequentially? */
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* Test if SACH information is modified as expected */
@@ -969,7 +950,7 @@
 		vc_conn.done;
 	}
 	/* TODO: do the above in parallel, rather than sequentially? */
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* TODO: Test for SACCH information present in RSL CHAN ACT (overrides FILLING) */
@@ -1017,8 +998,7 @@
 		var OCT1 ra := f_rnd_ra_cs();
 		var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
 		if (fn == fn_last) {
-			setverdict(fail, "Two RACH in same FN?!?");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?");
 		}
 		fn_last := fn;
 
@@ -1029,18 +1009,16 @@
 			T.stop;
 			}
 		[] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?, ?, ?))) {
-			setverdict(fail, "Unexpected CHAN RQD");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected CHAN RQD");
 			}
 		[] RSL_CCHAN.receive { repeat; }
 		[] T.timeout {
-			setverdict(fail, "Timeout waiting for CHAN RQD");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for CHAN RQD");
 			}
 		}
 	}
 	setverdict(pass);
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* Send 1000 RACH Requests (flood ~ 89/s) and count if count(Abis) == count(Um) */
@@ -1055,8 +1033,7 @@
 		var OCT1 ra := f_rnd_ra_cs();
 		var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
 		if (fn == fn_last) {
-			setverdict(fail, "Two RACH in same FN?!?");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?");
 		}
 		fn_last := fn;
 	}
@@ -1075,9 +1052,9 @@
 	if (rsl_chrqd == 1000) {
 		setverdict(pass);
 	} else {
-		setverdict(fail, "Received only ", rsl_chrqd, " out of 1000 RACH");
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received only ", rsl_chrqd, " out of 1000 RACH"));
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 private function f_main_trxc_connect() runs on test_CT {
@@ -1086,8 +1063,7 @@
 	res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BB_TRXC, mp_bb_trxc_ip, mp_bb_trxc_port,
 							"", -1, -1, {udp:={}}, {});
 	if (not ispresent(res.connId)) {
-		setverdict(fail, "Could not connect to trx-control interface of trxcon, check your configuration");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Could not connect to trx-control interface of trxcon, check your configuration");
 	}
 	g_bb_trxc_conn_id := res.connId;
 }
@@ -1110,16 +1086,14 @@
 		setverdict(pass);
 		}
 	[not expect_pass] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn))) {
-		setverdict(fail, "RACH passed but was expected to be dropped: ", toffs256);
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("RACH passed but was expected to be dropped: ", toffs256));
 		}
 	[] RSL_CCHAN.receive { repeat; }
 	[not expect_pass] T.timeout {
 		setverdict(pass);
 		}
 	[expect_pass] T.timeout {
-		setverdict(fail, "Timeout waiting for CHAN RQD");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for CHAN RQD");
 		}
 	}
 }
@@ -1146,7 +1120,7 @@
 	/* more than 63 bits is not legal / permitted */
 	f_rach_toffs(64*256, false);
 	f_rach_toffs(127*256, false);
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /***********************************************************************
@@ -1322,17 +1296,14 @@
 			g_first_meas_res := false;
 			repeat;
 		} else {
-			setverdict(fail, "Received unspecific MEAS RES ", rsl);
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received unspecific MEAS RES ", rsl));
 		}
 		}
 	[] RSL.receive(tr_RSL_MEAS_RES(?)) -> value rsl {
-		setverdict(fail, "Received unexpected MEAS RES ", rsl);
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received unexpected MEAS RES ", rsl));
 		}
 	[g_Tmeas_exp.running] g_Tmeas_exp.timeout {
-		setverdict(fail, "Didn't receive expected measurement result")
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Didn't receive expected measurement result")
 		}
 }
 
@@ -1347,7 +1318,9 @@
 	case (RSL_ALG_ID_A5_6) { return 6; }
 	case (RSL_ALG_ID_A5_7) { return 7; }
 	case else {
-		setverdict(fail, "Unknwon Algorithm ID");
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknwon Algorithm ID");
+		/* Make compiler happy by calling mtc.stop here. It is already
+		 * called in f_shutdown */
 		mtc.stop;
 		}
 	}
@@ -1363,7 +1336,9 @@
 	case (RSL_ALG_ID_A5_6) { return '101'B; }
 	case (RSL_ALG_ID_A5_7) { return '110'B; }
 	case else {
-		setverdict(fail, "Unknwon Algorithm ID");
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknwon Algorithm ID");
+		/* Make compiler happy by calling mtc.stop here. It is already
+		 * called in f_shutdown */
 		mtc.stop;
 		}
 	}
@@ -1435,13 +1410,12 @@
 	[] as_l1_dcch();
 	[] L1CTL.receive { repeat; }
 	[g_Tmeas_exp.running] T.timeout {
-		/* as_meas_res() would have done setverdict(fail) / mtc.stop in case
+		/* as_meas_res() would have done Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail) in case
 		 * of any earlier errors, so if we reach this timeout, we're good */
 		setverdict(pass);
 		}
 	[] T.timeout {
-		setverdict(fail, "No MEAS RES received at all");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "No MEAS RES received at all");
 		}
 	}
 	f_rsl_chan_deact();
@@ -1457,7 +1431,7 @@
 		vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
 		vc_conn.done;
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 testcase TC_meas_res_sign_tchh() runs on test_CT {
 	var ConnHdlr vc_conn;
@@ -1468,7 +1442,7 @@
 		vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
 		vc_conn.done;
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 testcase TC_meas_res_sign_sdcch4() runs on test_CT {
 	var ConnHdlr vc_conn;
@@ -1479,7 +1453,7 @@
 		vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
 		vc_conn.done;
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 testcase TC_meas_res_sign_sdcch8() runs on test_CT {
 	var ConnHdlr vc_conn;
@@ -1490,7 +1464,7 @@
 		vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
 		vc_conn.done;
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 testcase TC_meas_res_sign_tchh_toa256() runs on test_CT {
 	var ConnHdlr vc_conn;
@@ -1503,7 +1477,7 @@
 		vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
 		vc_conn.done;
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 
@@ -1524,8 +1498,7 @@
 		}
 	[] RSL.receive { repeat };
 	[] T.timeout {
-		setverdict(fail, "No CONN FAIL IND received");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "No CONN FAIL IND received");
 		}
 	}
 	f_rsl_chan_deact();
@@ -1570,8 +1543,7 @@
 	fn_check.frame_nr := frame_nr_51;
 
 	if (bs_ag_blks_res < 0 or bs_ag_blks_res > 7) {
-		setverdict(fail, "bs_ag_blks_res out of valid range (0..7)");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "bs_ag_blks_res out of valid range (0..7)");
 		return;
 	}
 
@@ -1600,8 +1572,7 @@
 		return;
 	}
 
-	setverdict(fail, "received paging on AGCH");
-	mtc.stop;
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "received paging on AGCH");
 	return;
 }
 
@@ -1716,8 +1687,7 @@
 			repeat;
 			}
 		[not cfg.exp_overload]  RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(0))) {
-			setverdict(fail, "Unexpected PCH Overload");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PCH Overload");
 			}
 		[cfg.exp_load_ind] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND)) {
 			log("Rx LOAD_IND");
@@ -1775,8 +1745,7 @@
 	[] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(65535))) { }
 	[] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND)) { repeat; }
 	[] T_wait.timeout {
-		setverdict(fail, "Waiting for empty paging queue");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Waiting for empty paging queue");
 		}
 	[] as_rsl_res_ind();
 	}
@@ -1802,12 +1771,12 @@
 	};
 	var PagingTestState st := f_TC_paging(cfg);
 	if (st.num_paging_sent != st.num_paging_rcv_ids) {
-		setverdict(fail, "Expected ", st.num_paging_sent, " pagings but have ",
-			   st.num_paging_rcv_ids);
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", st.num_paging_sent, " pagings but have ",
+			   st.num_paging_rcv_ids));
 	} else {
 		setverdict(pass);
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* Create ~ 80% paging load (TMSI only) sustained for about 20s, verifying that
@@ -1826,12 +1795,12 @@
 	};
 	var PagingTestState st := f_TC_paging(cfg);
 	if (st.num_paging_sent != st.num_paging_rcv_ids) {
-		setverdict(fail, "Expected ", st.num_paging_sent, " pagings but have ",
-			   st.num_paging_rcv_ids);
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", st.num_paging_sent, " pagings but have ",
+			   st.num_paging_rcv_ids));
 	} else {
 		setverdict(pass);
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* Create ~ 200% paging load (IMSI only) sustained for about 20s, verifying that
@@ -1853,11 +1822,11 @@
 	 * slots and will fully drain that buffer before returning */
 	var template integer tpl := (st.num_paging_sent*78/100 .. st.num_paging_sent *85/100);
 	if (not match(st.num_paging_rcv_ids, tpl)) {
-		setverdict(fail, "Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids);
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids));
 	} else {
 		setverdict(pass);
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* Create ~ 200% paging load (TMSI only) sustained for about 20s, verifying that
@@ -1879,11 +1848,11 @@
 	 * slots and will fully drain that buffer before returning */
 	var template integer tpl := (st.num_paging_sent*64/100 .. st.num_paging_sent *72/100);
 	if (not match(st.num_paging_rcv_ids, tpl)) {
-		setverdict(fail, "Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids);
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids));
 	} else {
 		setverdict(pass);
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 
@@ -1946,8 +1915,7 @@
 		var GsmRrMessage rr := dec_GsmRrMessage(l1_dl.payload.data_ind.payload);
 		if (not match(rr, tr_IMM_ASS(42, ?, 5, ?, ?))) {
 			/* FIXME: Why are we seeing paging requests on PCH/AGCH? */
-			//setverdict(fail, "Unexpected IMM-ASS values on AGCH: ", rr);
-			//mtc.stop;
+			//Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected IMM-ASS values on AGCH: ", rr));
 		} else {
 			num_rx := num_rx+1;
 		}
@@ -1959,16 +1927,15 @@
 	res_str := f_fmt_ia_stats(num_tx, num_rx, num_del);
 	log("AGCH test: " & res_str);
 	if (num_rx + num_del != num_tx) {
-		setverdict(fail, "RX + DEL != TX ?!?: " & res_str);
-		mtc.stop
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "RX + DEL != TX ?!?: " & res_str);
 	}
 	rx_ratio := int2float(num_rx) / int2float(num_tx);
 	if (rx_ratio < exp_pass*0.8 or rx_ratio > exp_pass*1.2) {
-		setverdict(fail, "RX ratio ("&float2str(rx_ratio)&") far from expected ("&float2str(exp_pass)&") " & res_str);
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "RX ratio ("&float2str(rx_ratio)&") far from expected ("&float2str(exp_pass)&") " & res_str);
 	} else {
 		setverdict(pass);
 	}
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* send a long burst of 1000 IMM.ASS with 20ms spacing (50 per s); expect 75% of them to be deleted */
@@ -2021,8 +1988,7 @@
 /* ensure a given TC slot of the SI vector contains given SI type at least once at TC */
 function f_ensure_si_vec_contains(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false) {
 	if (not f_si_vecslot_contains(arr[tc], key, ext_bcch)) {
-		setverdict(fail, "No ", key, " in TC=", tc, "!");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("No ", key, " in TC=", tc, "!"));
 	}
 }
 
@@ -2041,8 +2007,7 @@
 function f_si_vecslot_contains_n_of_m(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false, integer n := 1, integer m := 4) return boolean {
 	var integer count := 0;
 	if (sizeof(arr) < m) {
-		setverdict(fail, "Error: Insufficient SI in array");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Error: Insufficient SI in array");
 	}
 	for (var integer i:= 0; i < m; i := i + 1) {
 		var integer fn_mod51 := arr[i].frame_number mod 51;
@@ -2063,8 +2028,7 @@
 /* ensure a given TC slot of the SI vector contains given SI type at least N out of M times at TC */
 function f_ensure_si_vec_contains_n_of_m(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false, integer n, integer m) {
 	if (not f_si_vecslot_contains_n_of_m(arr[tc], key, ext_bcch, n, m)) {
-		setverdict(fail, "Not ", n, "/", m, " of ", key, " in TC=", tc, "!");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Not ", n, "/", m, " of ", key, " in TC=", tc, "!"));
 	}
 }
 
@@ -2085,8 +2049,7 @@
 /* ensure a given TC slot of the SI vector contains only given SI type */
 function f_ensure_si_vec_contains_only(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false) {
 	if (not f_si_vecslot_contains_only(arr[tc], key, ext_bcch)) {
-		setverdict(fail, "Not all ", key, " in TC=", tc, "!");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Not all ", key, " in TC=", tc, "!"));
 	}
 }
 
@@ -2115,8 +2078,7 @@
 	var integer i;
 	for (i := 0; i < sizeof(si_per_tc); i := i + 1) {
 		if (sizeof(si_per_tc[i]) == 0) {
-			setverdict(fail, "No SI messages for TC=", i);
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("No SI messages for TC=", i));
 		}
 	}
 	if (cfg.si1_present) {
@@ -2198,8 +2160,7 @@
 			f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13, true);
 		}
 		if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13alt)) {
-			setverdict(fail, "Cannot have SI13alt and SI13");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI13alt and SI13");
 		}
 	}
 	if (cfg.si16_present or cfg.si17_present) {
@@ -2209,8 +2170,7 @@
 			testcase.stop("Error: Cannot have SI16/SI17 and SI22!");
 		}
 		if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_22)) {
-			setverdict(fail, "Cannot have SI16/SI17 and SI22!");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI16/SI17 and SI22!");
 		}
 		if (not cfg.bcch_extended) {
 			testcase.stop("Error: SI16/SI17 requires BCCH Extd!");
@@ -2255,8 +2215,7 @@
 			testcase.stop("Error: Cannot have SI13alt and SI13");
 		}
 		if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13)) {
-			setverdict(fail, "Cannot have SI13alt and SI13");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI13alt and SI13");
 		}
 		if (not cfg.bcch_extended) {
 			f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13alt, false, 1, 4);
@@ -2287,8 +2246,7 @@
 		} else {
 			f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, true, 1, 4);
 			if (f_si_vecslot_contains(si_per_tc[4], SYSTEM_INFORMATION_TYPE_21)) {
-				setverdict(fail, "Cannot have SI21 on BCCH Norm if BCCH Extd enabled!");
-				mtc.stop;
+				Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI21 on BCCH Norm if BCCH Extd enabled!");
 			}
 		}
 	}
@@ -2302,8 +2260,7 @@
 		}
 		if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_16) or
 		    f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_17)) {
-			setverdict(fail, "Cannot have SI16/SI17 and SI22!");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI16/SI17 and SI22!");
 		}
 		if (not cfg.bcch_extended) {
 			testcase.stop("Error: SI22 requires BCCH Extd!");
@@ -2375,7 +2332,7 @@
 	f_init();
 	/* 2+3+4 are mandatory and set in f_init() */
 	f_TC_si_sched();
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 testcase TC_si_sched_1() runs on test_CT {
@@ -2383,7 +2340,7 @@
 	si_cfg.si1_present := true;
 	f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_1, '5506198fb38000000000000000000000000000e504002b'O);
 	f_TC_si_sched();
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 testcase TC_si_sched_2bis() runs on test_CT {
@@ -2391,7 +2348,7 @@
 	si_cfg.si2bis_present := true;
 	f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O);
 	f_TC_si_sched();
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 testcase TC_si_sched_2ter() runs on test_CT {
@@ -2399,7 +2356,7 @@
 	si_cfg.si2ter_present := true;
 	f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O);
 	f_TC_si_sched();
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 testcase TC_si_sched_2ter_2bis() runs on test_CT {
@@ -2409,7 +2366,7 @@
 	si_cfg.si2ter_present := true;
 	f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O);
 	f_TC_si_sched();
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 testcase TC_si_sched_2quater() runs on test_CT {
@@ -2417,7 +2374,7 @@
 	si_cfg.si2quater_present := true;
 	f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607a8a0364aa698d72ff424feee0506d5e7fff02043'O);
 	f_TC_si_sched();
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 testcase TC_si_sched_13() runs on test_CT {
@@ -2425,7 +2382,7 @@
 	si_cfg.si13_present := true;
 	f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, '0106009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O);
 	f_TC_si_sched();
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 testcase TC_si_sched_13_2bis_2ter_2quater() runs on test_CT {
@@ -2439,7 +2396,7 @@
 	si_cfg.si13_present := true;
 	f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, '0106009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O);
 	f_TC_si_sched();
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 
@@ -2449,7 +2406,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();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /***********************************************************************
@@ -2464,15 +2421,13 @@
 		setverdict(pass);
 		}
 	[] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_ERROR_REPORT(?))) {
-		setverdict(fail, "Wrong cause in RSL ERR REP");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Wrong cause in RSL ERR REP");
 		}
 	[] RSL_CCHAN.receive {
 		repeat;
 		}
 	[] T.timeout {
-		setverdict(fail, "Timeout waiting for RSL ERR REP");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RSL ERR REP");
 		}
 	}
 }
@@ -2618,8 +2573,7 @@
 	T.start;
 	alt {
 	[] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr))) {
-		setverdict(fail, "PCU RTS.req before PDCH active?");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "PCU RTS.req before PDCH active?");
 		}
 	[] PCU.receive { repeat; }
 	[] T.timeout { }
@@ -2636,17 +2590,14 @@
 		}
 	[not exp_success] PCU.receive(t_SD_PCUIF(g_pcu_conn_id,
 						 tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) {
-		setverdict(fail, "Unexpected RTS.req for supposedly failing activation");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RTS.req for supposedly failing activation");
 		}
 	[] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ)) {
-		setverdict(fail, "RTS.req for wrong TRX/TS");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "RTS.req for wrong TRX/TS");
 		}
 	[] PCU.receive { repeat; }
 	[exp_success] T.timeout {
-		setverdict(fail, "Timeout waiting for PCU RTS.req");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU RTS.req");
 		}
 	[not exp_success] T.timeout {
 		setverdict(pass);
@@ -2666,8 +2617,7 @@
 	T.start;
 	alt {
 	[] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) {
-		setverdict(fail, "Received unexpected PCU RTS.req");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received unexpected PCU RTS.req");
 		}
 	[] PCU.receive { repeat; }
 	[] T.timeout {
@@ -2737,8 +2687,7 @@
 		}
 	[] PCU.receive { repeat; }
 	[] T.timeout {
-		setverdict(fail, "Timeout waiting for SI13");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for SI13");
 		}
 	}
 }
@@ -2771,8 +2720,7 @@
 		}
 	[] PCU.receive { repeat; }
 	[] T.timeout {
-		setverdict(fail, "Timeout waiting for RTS.ind");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RTS.ind");
 		}
 	}
 }
@@ -2845,8 +2793,7 @@
 		}
 	[] L1CTL.receive { repeat; }
 	[] T.timeout {
-		setverdict(fail, "Timeout waiting for PCU-originated AGCH block on Um");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU-originated AGCH block on Um");
 		}
 	}
 }
@@ -2870,8 +2817,7 @@
 		}
 	[] L1CTL.receive { repeat; }
 	[] T.timeout {
-		setverdict(fail, "Timeout waiting for PCU-originated AGCH block on Um");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU-originated AGCH block on Um");
 		}
 	}
 }
@@ -2887,8 +2833,7 @@
 		var OCT1 ra := f_rnd_ra_ps();
 		var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
 		if (fn == fn_last) {
-			setverdict(fail, "Two RACH in same FN?!?");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?");
 		}
 		fn_last := fn;
 
@@ -2899,13 +2844,11 @@
 			T.stop;
 			}
 		[] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RACH_IND)) {
-			setverdict(fail, "Unexpected RACH IND");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RACH IND");
 			}
 		[] PCU.receive { repeat; }
 		[] T.timeout {
-			setverdict(fail, "Timeout waiting for RACH IND");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RACH IND");
 			}
 		}
 	}
@@ -2943,13 +2886,11 @@
 		[] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_PAG_REQ(0, t_mi_lv))) {
 			}
 		[] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_PAG_REQ)) {
-			setverdict(fail, "Unexpected PAGING REQ");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PAGING REQ");
 			}
 		[] PCU.receive { repeat; }
 		[] T.timeout {
-			setverdict(fail, "Timeout waiting for PAGING REQ");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PAGING REQ");
 			}
 		}
 	}
@@ -2970,8 +2911,7 @@
 	alt {
 	[] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(bts_nr, ?))) -> value sd {
 		if (substr(sd.data.u.info_ind.trx[trx_nr].pdch_mask, g_chan_nr.tn, 1) != '1'B) {
-			setverdict(fail, "PCUIF_INFO_IND PDCH_MASK not '1' after PDCH ACT");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "PCUIF_INFO_IND PDCH_MASK not '1' after PDCH ACT");
 		}
 		}
 	[] PCU.receive { repeat; }
@@ -2991,8 +2931,7 @@
 	alt {
 	[] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(bts_nr, ?))) -> value sd {
 		if (substr(sd.data.u.info_ind.trx[trx_nr].pdch_mask, g_chan_nr.tn, 1) != '0'B) {
-			setverdict(fail, "PCUIF_INFO_IND PDCH_MASK not '0' after PDCH DEACT");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "PCUIF_INFO_IND PDCH_MASK not '0' after PDCH DEACT");
 		}
 		}
 	[] PCU.receive { repeat; }
@@ -3154,8 +3093,7 @@
 	alt {
 	[] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(bts_nr, ?))) -> value sd {
 		if (substr(sd.data.u.info_ind.trx[trx_nr].pdch_mask, g_chan_nr.tn, 1) != '1'B) {
-			setverdict(fail, "PCUIF_INFO_IND PDCH_MASK not '1' after PDCH ACT");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "PCUIF_INFO_IND PDCH_MASK not '1' after PDCH ACT");
 		}
 		}
 	[] PCU.receive { repeat; }
@@ -3177,8 +3115,7 @@
 	alt {
 	[] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(bts_nr, ?))) -> value sd {
 		if (substr(sd.data.u.info_ind.trx[trx_nr].pdch_mask, g_chan_nr.tn, 1) != '0'B) {
-			setverdict(fail, "PCUIF_INFO_IND PDCH_MASK not '0' after PDCH DEACT");
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "PCUIF_INFO_IND PDCH_MASK not '0' after PDCH DEACT");
 		}
 		}
 	[] PCU.receive { repeat; }
@@ -3263,8 +3200,7 @@
 	alt {
 	[] RSL.receive(tr_RSL_IPA_PDCH_ACT_NACK(g_chan_nr, ?));
 	[] RSL.receive(tr_RSL_IPA_PDCH_ACT_ACK(g_chan_nr, ?)) {
-		setverdict(fail, "Unexpected PDCH ACT ACK");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PDCH ACT ACK");
 		}
 	[] RSL.receive { repeat; }
 	}
@@ -3373,7 +3309,7 @@
 		}
 	}
 
-	f_shutdown();
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
 /* test if SABM on Um triggers EST IND (TS 48.058 3.1) */
@@ -3395,23 +3331,20 @@
 		if (tc.exp) {
 			setverdict(pass);
 		} else {
-			setverdict(fail, "Unexpected EST IND with L3 in ", tc);
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected EST IND with L3 in ", tc));
 		}
 		}
 	[tc.l3 == ''O] RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, tc.link_id)) {
 		if (tc.exp) {
 			setverdict(pass);
 		} else {
-			setverdict(fail, "Unexpected EST IND without L3 in ", tc);
-			mtc.stop;
+			Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected EST IND without L3 in ", tc));
 		}
 		}
 	/* We also expect to receive the measurements */
 	[] as_meas_res(verify_meas := false);
 	[tc.exp] T.timeout {
-		setverdict(fail, "Timeout waiting for EST IND");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for EST IND");
 		}
 	[not tc.exp] T.timeout {
 		setverdict(pass);
@@ -3472,8 +3405,7 @@
 		}
 	[] L1CTL.receive { repeat; }
 	[] T.timeout {
-		setverdict(fail, "Timeout waiting for SABM");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for SABM");
 		}
 	}
 
@@ -3527,8 +3459,7 @@
 	T.start;
 	alt {
 	[] T.timeout {
-		setverdict(fail, "Timeout waiting for LAPDm ", exp);
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for LAPDm ", exp));
 		}
 	[] as_l1_exp_lapdm(exp);
 	}
@@ -3543,8 +3474,7 @@
 	[l3 != ''O] RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3));
 	[l3 == ''O] RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, link_id));
 	[] RSL.receive(tr_RSL_ERROR_IND(g_chan_nr, link_id, ?)) {
-		setverdict(fail, "Failing due to RSL_ERROR_IND");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Failing due to RSL_ERROR_IND");
 		}
 	[] RSL.receive { repeat; }
 	}
@@ -3754,8 +3684,7 @@
 private altstep as_rsl_any_ind(boolean exp_any) runs on ConnHdlr {
 	[exp_any] RSL.receive { repeat; }
 	[not exp_any] RSL.receive {
-		setverdict(fail, "Unexpected RSL message!");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RSL message!");
 		}
 }
 
@@ -3777,8 +3706,7 @@
 	[exp_sacch] as_meas_res(verify_meas := false);
 	[] as_rsl_any_ind(exp_any);
 	[] T.timeout {
-		setverdict(fail, "Timeout waiting for UNIT_DATA_IND");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for UNIT_DATA_IND");
 		}
 	}
 }
@@ -3802,8 +3730,7 @@
 	[exp_sacch] as_meas_res(verify_meas := false);
 	[] as_rsl_any_ind(exp_any);
 	[] T.timeout {
-		setverdict(fail, "Timeout waiting for DATA_IND");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for DATA_IND");
 		}
 	}
 }
@@ -3910,14 +3837,12 @@
 	if (ischosen(exp_match.ab)) {
 		lf.ab := dec_LapdmFrameAB(enc);
 	} else {
-		setverdict(fail, "unsupported frame type");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "unsupported frame type");
 	}
 
 	/* check if decoder result matches expectation */
 	if (not match(lf, exp_match)) {
-		setverdict(fail, name, ": decoded LAPDm doesn't match");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str(name, ": decoded LAPDm doesn't match"));
 	} else {
 		log(name, ": matched");
 		setverdict(pass);
@@ -3926,8 +3851,7 @@
 	/* test if re-encoded frame equals original input */
 	reenc := enc_LapdmFrame(lf);
 	if (enc != reenc) {
-		setverdict(fail, name, ": re-encoded LAPDm frame doesn't match");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str(name, ": re-encoded LAPDm frame doesn't match"));
 	} else {
 		setverdict(pass);
 	}
@@ -4025,7 +3949,7 @@
 				T.stop;
 				f_rsl_chan_deact();
 				f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
-				setverdict(fail, "Received fill frame on non-TCH/F channel; DTX is only allowed on TCH/F!");
+				Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received fill frame on non-TCH/F channel; DTX is only allowed on TCH/F!");
 			}
 			if (fn > first_fn + frame_dtx_tchf_mod) {
 				T.stop;
@@ -4039,7 +3963,7 @@
 				if (nfill_frames_sacch + nfill_frames_nonsacch < expected_fill_frames) {
 					log("received only ", nfill_frames_sacch, "+", nfill_frames_nonsacch,
 					    " (SACCH+other) out of ", expected_fill_frames, " expected fill frames");
-					setverdict(fail, "Not enough fill frames received");
+					Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Not enough fill frames received");
 				} else {
 					setverdict(pass);
 				}
@@ -4063,7 +3987,7 @@
 				    " (mod ", block_dtx_tchf_mod, ": ", fn mod block_dtx_tchf_mod, ")");
 				f_rsl_chan_deact();
 				f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
-				setverdict(fail, "Unexpected L2 fill frame received on Um");
+				Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected L2 fill frame received on Um");
 			}
 		} else {
 			if (dl.dl_info.link_id.c == SACCH) {
@@ -4086,7 +4010,7 @@
 				} else {
 					f_rsl_chan_deact();
 					f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
-					setverdict(fail, "Unknown channel type");
+					Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknown channel type");
 				}
 
 				f_rsl_chan_deact();
@@ -4097,7 +4021,7 @@
 				} else {
 					log("received only ", nfill_frames_sacch, "+", nfill_frames_nonsacch,
 					    " (SACCH+other) out of ", expected_fill_frames, " expected fill frames");
-					setverdict(fail, "Not enough fill frames received");
+					Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Not enough fill frames received");
 				}
 			} else {
 				repeat;
@@ -4108,8 +4032,7 @@
 	[] T.timeout {
 		f_rsl_chan_deact();
 		f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
-		setverdict(fail, "Timeout waiting for L2 fill frames on Um");
-		mtc.stop;
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for L2 fill frames on Um");
 	}
 	}
 }
diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index 1ec6153..2a07f16 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -33,7 +33,7 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_VTY_Functions.ttcn GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_VTY_Functions.ttcn GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
 #FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
 #FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn RSL_Types.ttcn RSL_Emulation.ttcn "

-- 
To view, visit https://gerrit.osmocom.org/11452
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia8b01a1876e969d6f0760ea625e4df83af4f54ca
Gerrit-Change-Number: 11452
Gerrit-PatchSet: 2
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181024/f50cbdb0/attachment.htm>


More information about the gerrit-log mailing list