aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2022-08-12 17:42:21 +0200
committerlaforge <laforge@osmocom.org>2022-08-20 08:11:27 +0000
commitef046b39bf040e9602068a699083210a2b39ba6c (patch)
treecef1ce7ee360ebdd21e95f39e2f09b6b3761beb5
parentd079b3fa33b06e75a290079aa9f60374cbddf8a3 (diff)
OSMUX_Emulation: Use Misc_Helpers.f_shutdown() everywhere
-rw-r--r--library/OSMUX_Emulation.ttcn46
1 files changed, 24 insertions, 22 deletions
diff --git a/library/OSMUX_Emulation.ttcn b/library/OSMUX_Emulation.ttcn
index d31a562b..5d9a95e5 100644
--- a/library/OSMUX_Emulation.ttcn
+++ b/library/OSMUX_Emulation.ttcn
@@ -54,6 +54,7 @@ module OSMUX_Emulation {
import from General_Types all;
import from Osmocom_Types all;
import from IPL4asp_Types all;
+import from Misc_Helpers all;
import from OSMUX_Types all;
import from OSMUX_CodecPort all;
import from OSMUX_CodecPort_CtrlFunct all;
@@ -289,26 +290,26 @@ function f_osmuxem_stats_err_check(OsmuxemStats s) {
/* Check if there was some activity at either on the RX or on the
* TX side, but complete silence would indicate some problem */
if (s.num_pkts_tx < 1 and s.num_pkts_rx < 1) {
- setverdict(fail, "no Osmux packet activity detected (packets)");
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "no Osmux packet activity detected (packets)");
}
if (s.bytes_payload_tx < 1 and s.bytes_payload_rx < 1) {
- setverdict(fail, "no Osmux packet activity detected (bytes)");
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "no Osmux packet activity detected (bytes)");
}
/* Check error counters */
if (s.num_pkts_rx_err_seq != 0) {
- setverdict(fail, "Osmux packet sequence number errors occurred");
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Osmux packet sequence number errors occurred");
}
if (s.num_pkts_rx_err_disabled != 0) {
- setverdict(fail, "Osmux packets received while RX was disabled");
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Osmux packets received while RX was disabled");
}
if (s.num_pkts_rx_err_payload != 0) {
- setverdict(fail, "Osmux packets with mismatching payload received");
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Osmux packets with mismatching payload received");
}
}
@@ -336,8 +337,9 @@ private function f_rxhandle_get_by_cid(OsmuxCID cid) runs on OSMUX_Emulation_CT
return RxHandleTable[i].vc_conn;
}
}
- setverdict(fail, "No Component for CID ", cid);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("No Component for CID ", cid));
+ return RxHandleTable[0].vc_conn; /* make compiler happy, not reached */
}
private function f_rxhandle_cid_add(OsmuxRxHandle hdl) runs on OSMUX_Emulation_CT {
@@ -349,8 +351,8 @@ private function f_rxhandle_cid_add(OsmuxRxHandle hdl) runs on OSMUX_Emulation_C
return;
}
}
- testcase.stop("No Space in RxHandleTable for ", hdl.cid);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("No Space in RxHandleTable for ", hdl.cid));
}
private function f_txhandle_cid_add(OsmuxTxHandle hdl) runs on OSMUX_Emulation_CT {
@@ -361,8 +363,8 @@ private function f_txhandle_cid_add(OsmuxTxHandle hdl) runs on OSMUX_Emulation_C
return;
}
}
- testcase.stop("No Space in TxHandleList for ", hdl.cid);
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("No Space in TxHandleList for ", hdl.cid));
}
function f_osmux_gen_expected_rx_rtp_payload(INT4b amr_ft, octetstring tx_fixed_payload) return octetstring {
@@ -459,8 +461,8 @@ function f_main() runs on OSMUX_Emulation_CT
res := OSMUX_CodecPort_CtrlFunct.f_IPL4_listen(OSMUX, g_local_host,
g_local_port, {udp:={}});
if (not ispresent(res.connId)) {
- setverdict(fail, "Could not listen on Osmux socket, check your configuration");
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Could not listen on Osmux socket, check your configuration");
}
g_osmux_conn_id := res.connId;
tr_osmux_amr.connId := g_osmux_conn_id;
@@ -474,8 +476,8 @@ function f_main() runs on OSMUX_Emulation_CT
g_local_host, g_local_port,
g_osmux_conn_id, {udp:={}});
if (not ispresent(res.connId)) {
- setverdict(fail, "Could not connect to Osmux socket, check your configuration");
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Could not connect to Osmux socket, check your configuration");
}
g_tx_connected := true;
CTRL.reply(OsmuxEM_connect:{g_remote_host, g_remote_port});
@@ -569,8 +571,8 @@ function f_main() runs on OSMUX_Emulation_CT
/* fail on any unexpected messages */
[] OSMUX.receive {
- setverdict(fail, "Received unexpected type from Osmux");
- mtc.stop;
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ "Received unexpected msg type from Osmux");
}
}
}