pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/29068 )


Change subject: OSMUX_Emulation: Use Misc_Helpers.f_shutdown() everywhere
......................................................................

OSMUX_Emulation: Use Misc_Helpers.f_shutdown() everywhere

Change-Id: Id8f104a4123fcfbc96ab07f2e9343369946e3334
---
M library/OSMUX_Emulation.ttcn
1 file changed, 24 insertions(+), 22 deletions(-)



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

diff --git a/library/OSMUX_Emulation.ttcn b/library/OSMUX_Emulation.ttcn
index d31a562..5d9a95e 100644
--- a/library/OSMUX_Emulation.ttcn
+++ b/library/OSMUX_Emulation.ttcn
@@ -54,6 +54,7 @@
 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 @@
        /* 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 @@
                        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 @@
                        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 @@
                        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 @@
                        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 @@
                                                                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 @@

                /* 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");
                }
        }
        }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/29068
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: Id8f104a4123fcfbc96ab07f2e9343369946e3334
Gerrit-Change-Number: 29068
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to