daniel has uploaded this change for review. ( https://gerrit.osmocom.org/9905


Change subject: library: Ensure setverdict(fail is followed by mtc.stop
......................................................................

library: Ensure setverdict(fail is followed by mtc.stop

This will prevent subsequent failures from overwriting the verdict so we
can easily see the root cause of the test failure.

Change-Id: Idc6819aaf0b01e70c38fad828dd44dcec6bdd778
---
M library/BSSAP_Adapter.ttcn
M library/BSSGP_Emulation.ttcn
M library/BSSMAP_Emulation.ttcn
M library/GSM_Types.ttcn
M library/GSUP_Emulation.ttcn
M library/GTP_Emulation.ttcn
M library/GTP_Templates.ttcn
M library/IPA_Emulation.ttcnpp
M library/IuUP_Emulation.ttcn
M library/L1CTL_PortType.ttcn
M library/L3_Common.ttcn
M library/LAPDm_RAW_PT.ttcn
M library/MGCP_Emulation.ttcn
M library/MGCP_Templates.ttcn
M library/MNCC_Emulation.ttcn
M library/MNCC_Types.ttcn
M library/NS_Emulation.ttcn
M library/Osmocom_CTRL_Adapter.ttcn
M library/Osmocom_CTRL_Functions.ttcn
M library/Osmocom_Types.ttcn
M library/Osmocom_VTY_Functions.ttcn
M library/PCUIF_CodecPort.ttcn
M library/RSL_Emulation.ttcn
M library/RTP_Emulation.ttcn
M library/SIP_Emulation.ttcn
M library/SMPP_Emulation.ttcn
M library/TRXC_CodecPort.ttcn
27 files changed, 149 insertions(+), 147 deletions(-)



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

diff --git a/library/BSSAP_Adapter.ttcn b/library/BSSAP_Adapter.ttcn
index e50487d..b29d03f 100644
--- a/library/BSSAP_Adapter.ttcn
+++ b/library/BSSAP_Adapter.ttcn
@@ -144,7 +144,7 @@
                }
        case else {
                setverdict(fail, "Unsuppored BSSAP_Transport");
-               self.stop;
+               mtc.stop;
                }
        }

diff --git a/library/BSSGP_Emulation.ttcn b/library/BSSGP_Emulation.ttcn
index f51d539..8b3b9eb 100644
--- a/library/BSSGP_Emulation.ttcn
+++ b/library/BSSGP_Emulation.ttcn
@@ -288,8 +288,7 @@
                        return;
                }
        }
-       setverdict(fail, "Client Table full");
-       self.stop;
+       testcase.stop("Client Table full");
 }

 private function f_tbl_client_del(hexstring imsi, BSSGP_Client_CT vc_conn) 
runs on BSSGP_CT {
@@ -299,7 +298,7 @@
                        if (ClientTable[i].comp_ref != vc_conn) {
                                setverdict(fail, "Cannot unregister index=", i, 
" IMSI ", imsi, " registred to ",
                                           ClientTable[i].comp_ref, " from ", 
vc_conn);
-                               self.stop;
+                               mtc.stop;
                        }
                        log("Removing Client IMSI=", imsi, ", index=", i);
                        ClientTable[i] := {
@@ -313,7 +312,7 @@
                }
        }
        setverdict(fail, "Could not find client for IMSI ", imsi);
-       self.stop;
+       mtc.stop;
 }

 /* TS 44.064 7.2.1.1 LLGMM-ASSIGN */
@@ -344,7 +343,7 @@
                }
        }
        setverdict(fail, "Couldn't find Component for IMSI ", imsi);
-       self.stop;
+       mtc.stop;
 }
 
 private function f_tbl_comp_by_tlli(OCT4 tlli) runs on BSSGP_CT return 
BSSGP_Client_CT {
@@ -357,7 +356,7 @@
                }
        }
        setverdict(fail, "Couldn't find Component for TLLI ", tlli);
-       self.stop;
+       mtc.stop;
 }

 private function f_tbl_idx_by_comp(BSSGP_Client_CT comp_ref) runs on BSSGP_CT 
return integer {
@@ -368,7 +367,7 @@
                }
        }
        setverdict(fail, "Couldn't find Client for Component ", comp_ref);
-       self.stop;
+       mtc.stop;
 }

 private function f_tbl_tlli_by_comp(BSSGP_Client_CT comp_ref) runs on BSSGP_CT 
return OCT4 {
@@ -380,7 +379,7 @@
                }
        }
        setverdict(fail, "Couldn't find TLLI for Component ", comp_ref);
-       self.stop;
+       mtc.stop;
 }

 altstep as_allstate() runs on BSSGP_CT {
@@ -590,7 +589,7 @@
                return c_LLC_SAPI_LLSMS;
        }
        setverdict(fail, "No LLC SAPI for ", l3_mo);
-       self.stop;
+       mtc.stop;
 }

 private function f_llc_sapi_by_l3_mt(PDU_L3_SGSN_MS l3_mt) return BIT4 {
@@ -602,7 +601,7 @@
                return c_LLC_SAPI_LLSMS;
        }
        setverdict(fail, "No LLC SAPI for ", l3_mt);
-       self.stop;
+       mtc.stop;
 }
 

diff --git a/library/BSSMAP_Emulation.ttcn b/library/BSSMAP_Emulation.ttcn
index e65c550..921ac59 100644
--- a/library/BSSMAP_Emulation.ttcn
+++ b/library/BSSMAP_Emulation.ttcn
@@ -202,9 +202,8 @@
                        return ConnectionTable[i].comp_ref;
                }
        }
-       log("BSSMAP Connection table not found by SCCP Connection ID ", 
sccp_conn_id);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "BSSMAP Connection table not found by SCCP Connection 
ID ", sccp_conn_id);
+       mtc.stop;
 }

 /* resolve component reference by CIC */
@@ -216,9 +215,8 @@
                        return ConnectionTable[i].comp_ref;
                }
        }
-       log("BSSMAP Connection table not found by MGCP Transaction ID ", tid);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "BSSMAP Connection table not found by MGCP Transaction 
ID ", tid);
+       mtc.stop;
 }

 private function f_comp_store_mgcp_tid(BSSAP_ConnHdlr client, MgcpTransId tid)
@@ -230,9 +228,8 @@
                        return;
                }
        }
-       log("BSSMAP Connection table not found by component ", client);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "BSSMAP Connection table not found by component ", 
client);
+       mtc.stop;
 }

 private function f_comp_by_cic(integer cic)
@@ -243,9 +240,8 @@
                        return ConnectionTable[i].comp_ref;
                }
        }
-       log("BSSMAP Connection table not found by CIC ", cic);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "BSSMAP Connection table not found by CIC ", cic);
+       mtc.stop;
 }

 private function f_comp_store_cic(BSSAP_ConnHdlr client, integer cic)
@@ -257,8 +253,8 @@
                        return;
                }
        }
-       log("BSSMAP Connection table not found by component ", client);
-       setverdict(fail);
+       setverdict(fail, "BSSMAP Connection table not found by component ", 
client);
+       mtc.stop;
 }

 /* resolve connection ID by component reference */
@@ -269,9 +265,8 @@
                        return ConnectionTable[i].sccp_conn_id;
                }
        }
-       log("BSSMAP Connection table not found by component ", client);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "BSSMAP Connection table not found by component ", 
client);
+       mtc.stop;
 }

 /* resolve ConnectionTable index component reference */
@@ -282,9 +277,8 @@
                        return i;
                }
        }
-       log("BSSMAP Connection table not found by component ", client);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "BSSMAP Connection table not found by component ", 
client);
+       mtc.stop;
 }

 private function f_gen_conn_id()
@@ -325,9 +319,7 @@
                        return;
                }
        }
-       log("BSSMAP Connection table full!");
-       setverdict(fail);
-       self.stop;
+       testcase.stop("BSSMAP Connection table full!");
 }

 private function f_conn_table_del(integer sccp_conn_id)
@@ -341,9 +333,8 @@
                        return
                }
        }
-       log("BSSMAP Connection table attempt to delete non-existant ", 
sccp_conn_id);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "BSSMAP Connection table attempt to delete 
non-existant ", sccp_conn_id);
+       mtc.stop;
 }

 private function f_imsi_table_find(hexstring imsi, template OCT4 tmsi)
@@ -501,7 +492,8 @@
                repeat;
                }
        [] T.timeout {
-               setverdict(fail);
+               setverdict(fail, "Timeout waiting for BSSAP RESET");
+               mtc.stop;
                }
        }
 }
@@ -517,7 +509,10 @@
                }
        [] as_reset_ack();
        [] BSSAP.receive { repeat };
-       [] T.timeout { setverdict(fail, "Waiting for RESET-ACK after sending 
RESET"); }
+       [] T.timeout {
+               setverdict(fail, "Timeout waiting for RESET-ACK after sending 
RESET");
+               mtc.stop;
+               }
        }
 }

@@ -763,6 +758,7 @@

        if (not 
ischosen(conn_ind.userData.pdu.bssmap.completeLayer3Information)) {
                setverdict(fail, "N-CONNECT.ind with L3 != COMPLETE L3");
+               mtc.stop;
                return ret;
        }
        l3_info := 
conn_ind.userData.pdu.bssmap.completeLayer3Information.layer3Information.layer3info;
@@ -782,6 +778,7 @@
                }
        }
        setverdict(fail, "Couldn't find Expect for incoming connection ", 
conn_ind);
+       mtc.stop;
        return ret;
 }

@@ -796,7 +793,7 @@
                        return;
                }
        }
-       setverdict(fail, "No space left in ExpectTable");
+       testcase.stop("No space left in ExpectTable");
 }

 private function f_create_imsi(hexstring imsi, OCT4 tmsi, BSSAP_ConnHdlr hdlr)
@@ -810,8 +807,7 @@
                        return;
                }
        }
-       setverdict(fail, "No space left in ImsiTable");
-       self.stop;
+       testcase.stop("No space left in ImsiTable");
 }


diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index 2000b4a..59ccb76 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -34,6 +34,7 @@
                case (CS3) { return 52 }
                case else {
                        setverdict(fail, "Invalid GPRS CS ", cs);
+                       mtc.stop;
                        return -1;
                        }
                }
diff --git a/library/GSUP_Emulation.ttcn b/library/GSUP_Emulation.ttcn
index 7cf1656..86859ba 100644
--- a/library/GSUP_Emulation.ttcn
+++ b/library/GSUP_Emulation.ttcn
@@ -98,9 +98,8 @@
                        return GsupImsiTable[i].comp_ref;
                }
        }
-       log("GSUP IMSI table not found by IMSI ", imsi);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "GSUP IMSI table not found by IMSI ", imsi);
+       mtc.stop;
 }

 /* resolve connection ID by component reference */
@@ -111,9 +110,8 @@
                        return GsupImsiTable[i].imsi;
                }
        }
-       log("GSUP IMSI table not found by component ", client);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "GSUP IMSI table not found by component ", client);
+       mtc.stop;
 }

 private function f_imsi_table_init()
@@ -142,9 +140,7 @@
                        return;
                }
        }
-       log("GSUP IMSI table full!");
-       setverdict(fail);
-       self.stop;
+       testcase.stop("GSUP IMSI table full!");
 }

 private function f_imsi_table_del(charstring imsi)
@@ -158,9 +154,8 @@
                        return
                }
        }
-       log("GSUP IMSI table attempt to delete non-existant ", imsi);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "GSUP IMSI table attempt to delete non-existant ", 
imsi);
+       mtc.stop;
 }


@@ -190,7 +185,7 @@
                [] GSUP.receive(ASP_IPA_Event:{up_down:=ASP_IPA_EVENT_UP}) { 
repeat; }
                [] GSUP.receive(ASP_IPA_Event:{up_down:=ASP_IPA_EVENT_DOWN}) {
                        setverdict(fail, "GSUP Connection Lost");
-                       self.stop;
+                       mtc.stop;
                        }

                /* GSUP -> Client: call related messages */
@@ -272,6 +267,7 @@
                }
        }
        setverdict(fail, "Couldn't find GsupExpect for incoming imsi ", imsi);
+       mtc.stop;
        return ret;
 }

@@ -287,7 +283,7 @@
                        return;
                }
        }
-       setverdict(fail, "No space left in GsupExpectTable");
+       testcase.stop("No space left in GsupExpectTable");
 }

 /* client/conn_hdlr side function to use procedure port to create expect in 
emulation */
diff --git a/library/GTP_Emulation.ttcn b/library/GTP_Emulation.ttcn
index 534fdef..750f744 100644
--- a/library/GTP_Emulation.ttcn
+++ b/library/GTP_Emulation.ttcn
@@ -62,7 +62,7 @@
                }
        }
        setverdict(fail, "No Component for TEID ", teid);
-       self.stop;
+       mtc.stop;
 }

 private function f_comp_by_imsi(hexstring imsi) runs on GTP_Emulation_CT 
return GTP_ConnHdlr {
@@ -73,7 +73,7 @@
                }
        }
        setverdict(fail, "No Component for IMSI ", imsi);
-       self.stop;
+       mtc.stop;
 }

 private function f_tid_tbl_add(OCT4 teid, GTP_ConnHdlr vc_conn) runs on 
GTP_Emulation_CT {
@@ -85,8 +85,7 @@
                        return;
                }
        }
-       setverdict(fail, "No Space in TidTable for ", teid);
-       self.stop;
+       testcase.stop("No Space in TidTable for ", teid);
 }

 private function f_imsi_tbl_add(hexstring imsi, GTP_ConnHdlr vc_conn) runs on 
GTP_Emulation_CT {
@@ -98,8 +97,7 @@
                        return;
                }
        }
-       setverdict(fail, "No Space in IMSI Table for ", imsi);
-       self.stop;
+       testcase.stop("No Space in IMSI Table for ", imsi);
 }

 function f_gtpc_extract_imsi(PDU_GTPC gtp) return template (omit) hexstring {
diff --git a/library/GTP_Templates.ttcn b/library/GTP_Templates.ttcn
index a222b2e..d778c97 100644
--- a/library/GTP_Templates.ttcn
+++ b/library/GTP_Templates.ttcn
@@ -462,7 +462,8 @@
                                }
                        }
                }
-               setverdict(fail);
+               setverdict(fail, "Could not extract protocol payload from 
protocol ", protocol);
+               mtc.stop;
                return ''O;
        }

diff --git a/library/IPA_Emulation.ttcnpp b/library/IPA_Emulation.ttcnpp
index df2b15e..a271f2d 100644
--- a/library/IPA_Emulation.ttcnpp
+++ b/library/IPA_Emulation.ttcnpp
@@ -203,7 +203,7 @@
                                                local_host, local_port, 0, { 
tcp:={} });
        if (not ispresent(res.connId)) {
                setverdict(fail, "Could not connect IPA socket, check your 
configuration");
-               self.stop;
+               mtc.stop;
        }
        g_ipa_conn_id := res.connId;
        g_ccm_pars := ccm_pars;
@@ -218,7 +218,7 @@
                                                local_host, local_port, { 
tcp:={} });
        if (not ispresent(res.connId)) {
                setverdict(fail, "Could not listen IPA socket, check your 
configuration");
-               self.stop;
+               mtc.stop;
        }
        g_ipa_conn_id := res.connId;
        g_ccm_pars := ccm_pars;
@@ -507,7 +507,7 @@
                                }
                                case else {
                                        setverdict(fail, "Unknown mode");
-                                       self.stop;
+                                       mtc.stop;
                                }
                        }
                        }
diff --git a/library/IuUP_Emulation.ttcn b/library/IuUP_Emulation.ttcn
index 77cd739..752b897 100644
--- a/library/IuUP_Emulation.ttcn
+++ b/library/IuUP_Emulation.ttcn
@@ -80,6 +80,7 @@
                        return pdu.type_0.payload;
                } else {
                        setverdict(fail, "PDU Type 0 received but 1 
configured");
+                       mtc.stop;
                }
        } else if (ischosen(pdu.type_1)) {
                if (st.cfg.data_pdu_type_0 == false) {
@@ -88,11 +89,13 @@
                        return pdu.type_1.payload;
                } else {
                        setverdict(fail, "PDU Type 1 received but 0 
configured");
+                       mtc.stop;
                }
        } else if (ischosen(pdu.type_14)) {
                if (match(pdu, tr_IuUP_INIT)) {
                        if (st.cfg.active_init == true) {
                                setverdict(fail, "INIT received in ACTIVE 
role");
+                               mtc.stop;
                        } else {
                                /* store an INIT_ACK to be transmitted later */
                                st.pending_tx_pdu := 
valueof(ts_IuUP_INIT_ACK(pdu.type_14.frame_nr,
@@ -104,11 +107,13 @@
                                st.state := ST_DATA_TRANSFER_READY;
                        } else {
                                setverdict(fail, "INIT_ACK received in PASSIVE 
role");
+                               mtc.stop;
                        }
                }
                return ''O;
        } else {
                setverdict(fail, "Impossible IuUP PDU decoded from ", inp);
+               mtc.stop;
        }
        self.stop;
 }
diff --git a/library/L1CTL_PortType.ttcn b/library/L1CTL_PortType.ttcn
index ba9c2b5..14a059c 100644
--- a/library/L1CTL_PortType.ttcn
+++ b/library/L1CTL_PortType.ttcn
@@ -41,7 +41,7 @@
                        [] pt.receive(tr_L1CTL_FBSB_CONF(0)) { return; };
                        [i >= 9] pt.receive(tr_L1CTL_FBSB_CONF(?)) {
                                setverdict(fail, "FBSB Failed with non-zero 
return code");
-                               self.stop;
+                               mtc.stop;
                                };
                        [] pt.receive(tr_L1CTL_FBSB_CONF(?)) {
                                f_sleep(1.0);
@@ -49,7 +49,7 @@
                        [] pt.receive { repeat; };
                        [] T.timeout {
                                setverdict(fail, "Timeout in FBSB")
-                               self.stop;
+                               mtc.stop;
                                };
                        }
                }
@@ -64,7 +64,7 @@
                [] pt.receive { repeat; }
                [] T.timeout {
                        setverdict(fail, "Timeout in CCH_MODE");
-                       self.stop;
+                       mtc.stop;
                        }
                }
        }
@@ -80,7 +80,7 @@
                        [] pt.receive { repeat; };
                        [] T.timeout {
                                setverdict(fail, "Timeout in RACH");
-                               self.stop;
+                               mtc.stop;
                                }
                }
                return fn;
@@ -108,7 +108,7 @@
                        [] pt.receive { repeat };
                        [] T.timeout {
                                setverdict(fail, "Timeout waiting for IMM ASS");
-                               self.stop;
+                               mtc.stop;
                                }
                }
                T.stop;
@@ -133,7 +133,7 @@
                        [] pt.receive { repeat };
                        [] T.timeout {
                                setverdict(fail, "Timeout waiting for IMM ASS");
-                               self.stop;
+                               mtc.stop;
                                }
                }
                T.stop;
@@ -149,7 +149,7 @@
                        [] pt.receive { repeat };
                        [] T.timeout {
                                setverdict(fail, "Timeout waiting for 
TBF-CFG.conf");
-                               self.stop;
+                               mtc.stop;
                                };
                }
                T.stop;
@@ -174,7 +174,7 @@
                        [] pt.receive { repeat; }
                        [] T.timeout {
                                setverdict(fail, "Timeout waiting for 
RESET.conf");
-                               self.stop;
+                               mtc.stop;
                                }
                }
        }
diff --git a/library/L3_Common.ttcn b/library/L3_Common.ttcn
index 2b39621..bf7818a 100644
--- a/library/L3_Common.ttcn
+++ b/library/L3_Common.ttcn
@@ -70,7 +70,7 @@
                return TLLI_RAND_G_RNTI;
        } else {
                setverdict(fail, "Unknonw TLLI Type ", tllib);
-               self.stop;
+               mtc.stop;
        }
 }

diff --git a/library/LAPDm_RAW_PT.ttcn b/library/LAPDm_RAW_PT.ttcn
index bdfc50b..6b8f9fb 100644
--- a/library/LAPDm_RAW_PT.ttcn
+++ b/library/LAPDm_RAW_PT.ttcn
@@ -320,7 +320,7 @@
                        var TBF_UL_establish_res res;
                        if (isvalue(g_tbf_ul[tbf_nr].arfcn)) {
                                setverdict(fail, "Cannot establish UL TBF ID ", 
tbf_nr, ": BUSY");
-                               self.stop;
+                               mtc.stop;
                        }
                        f_establish_tbf(tbf_ul_req.ra);
                        if (ph_state == PH_STATE_TBF) {
@@ -340,7 +340,7 @@
                        var TbfNr tbf_nr := tbf_dl_req.tbf_nr;
                        if (isvalue(g_tbf_dl[tbf_nr].arfcn)) {
                                setverdict(fail, "Cannot establish DL TBF ID ", 
tbf_nr, ": BUSY");
-                               self.stop;
+                               mtc.stop;
                        }
                        g_tbf_dl[tbf_nr] := tbf_dl_req.pars;
                        f_L1CTL_TBF_CFG(L1CTL, false, tbf_dl_req.pars.tfi);
diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn
index 0863511..c3d09b9 100644
--- a/library/MGCP_Emulation.ttcn
+++ b/library/MGCP_Emulation.ttcn
@@ -134,9 +134,8 @@
                        return MgcpEndpointTable[i].comp_ref;
                }
        }
-       log("MGCP Endpoint Table not found by Endpoint", ep);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "MGCP Endpoint Table not found by Endpoint", ep);
+       mtc.stop;
 }

 private function f_ep_by_comp(MGCP_ConnHdlr client)
@@ -147,9 +146,8 @@
                        return MgcpEndpointTable[i].endpoint;
                }
        }
-       log("MGCP Endpoint Table not found by component ", client);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "MGCP Endpoint Table not found by component ", client);
+       mtc.stop;
 }

 private function f_ep_table_add(MGCP_ConnHdlr comp_ref, MgcpEndpoint ep)
@@ -162,8 +160,7 @@
                        return;
                }
        }
-       setverdict(fail, "MGCP Endpoint Table full!");
-       self.stop;
+       testcase.stop("MGCP Endpoint Table full!");
 }

 private function f_ep_table_del(MGCP_ConnHdlr comp_ref, MgcpEndpoint ep)
@@ -178,7 +175,7 @@
                }
        }
        setverdict(fail, "MGCP Endpoint Table: Couldn't find to-be-deleted 
entry!");
-       self.stop;
+       mtc.stop;
 }


@@ -211,7 +208,7 @@
                var MgcpEndpoint ep;
                if (f_mgcp_find_param(msg, "Z", ep) == false) {
                        setverdict(fail, "No SpecificEndpointName in MGCP 
response", msg);
-                       self.stop;
+                       mtc.stop;
                }
                return ep;
        }
@@ -239,7 +236,7 @@
        }
        if (not ispresent(res.connId)) {
                setverdict(fail, "Could not connect MGCP socket, check your 
configuration");
-               self.stop;
+               mtc.stop;
        }
        g_mgcp_conn_id := res.connId;

@@ -273,7 +270,7 @@
                                res := 
MGCP_CodecPort_CtrlFunct.f_IPL4_connect(MGCP, p.callagent_ip, 
p.callagent_udp_port, p.mgw_ip, p.mgw_udp_port, g_mgcp_conn_id, { udp:={} });
                                if (not ispresent(res.connId)) {
                                        setverdict(fail, "Could not connect 
MGCP socket, check your configuration");
-                                       self.stop;
+                                       mtc.stop;
                                }
                        }
                        if (ischosen(mrf.msg.command)) {
@@ -302,7 +299,7 @@
                                }
                        } else {
                                setverdict(fail, "Received unexpected MGCP 
response: ", mrf.msg.response);
-                               self.stop;
+                               mtc.stop;
                        }
                        }
                [] MGCP_PROC.getcall(MGCPEM_register:{?,?}) -> param(crit, 
vc_conn) {
@@ -387,6 +384,7 @@
                }
        }
        setverdict(fail, "Couldn't find Expect for CRCX", cmd);
+       mtc.stop;
        return ret;
 }

@@ -398,7 +396,7 @@
        for (i := 0; i < sizeof(MgcpExpectTable); i := i+1) {
                if (crit == MgcpExpectTable[i].crit) {
                        setverdict(fail, "Crit already present", crit);
-                       self.stop;
+                       mtc.stop;
                }
        }
        for (i := 0; i < sizeof(MgcpExpectTable); i := i+1) {
@@ -409,7 +407,7 @@
                        return;
                }
        }
-       setverdict(fail, "No space left in MgcpExpectTable")
+       testcase.stop("No space left in MgcpExpectTable")
 }

 /* client/conn_hdlr side function to use procedure port to create expect in 
emulation */
@@ -459,7 +457,8 @@
                return "AMR-WB";
        }

-       setverdict(fail);
+       setverdict(fail, "Unknown payload type ", pt);
+       mtc.stop;
        return "";
 }

diff --git a/library/MGCP_Templates.ttcn b/library/MGCP_Templates.ttcn
index 9d6dea6..afdc33d 100644
--- a/library/MGCP_Templates.ttcn
+++ b/library/MGCP_Templates.ttcn
@@ -294,7 +294,7 @@
                                return par.val;
                        }
                }
-               setverdict(fail);
+               setverdict(fail, "Could not extract parameters for code ", 
code);
                return "";
        }

diff --git a/library/MNCC_Emulation.ttcn b/library/MNCC_Emulation.ttcn
index d9b7c79..94ed1c4 100644
--- a/library/MNCC_Emulation.ttcn
+++ b/library/MNCC_Emulation.ttcn
@@ -116,9 +116,8 @@
                        return MnccCallTable[i].comp_ref;
                }
        }
-       log("MNCC Call table not found by MNCC Call ID ", mncc_call_id);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "MNCC Call table not found by MNCC Call ID ", 
mncc_call_id);
+       mtc.stop;
 }

 /* resolve connection ID by component reference */
@@ -129,9 +128,8 @@
                        return MnccCallTable[i].mncc_call_id;
                }
        }
-       log("MNCC Call table not found by component ", client);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "MNCC Call table not found by component ", client);
+       mtc.stop;
 }

 private function f_gen_call_id()
@@ -171,9 +169,7 @@
                        return;
                }
        }
-       log("MNCC Call table full!");
-       setverdict(fail);
-       self.stop;
+       testcase.stop("MNCC Call table full!");
 }

 private function f_call_table_del(uint32_t mncc_call_id)
@@ -187,9 +183,8 @@
                        return
                }
        }
-       log("MNCC Call table attempt to delete non-existant ", mncc_call_id);
-       setverdict(fail);
-       self.stop;
+       setverdict(fail, "MNCC Call table attempt to delete non-existant ", 
mncc_call_id);
+       mtc.stop;
 }


@@ -203,14 +198,14 @@
        [] MNCC.receive(UD_connect_result:?) -> value res {
                if (ispresent(res.result) and ispresent(res.result.result_code) 
and res.result.result_code == ERROR) {
                        setverdict(fail, "Error connecting to MNCC socket", 
res);
-                       self.stop;
+                       mtc.stop;
                } else {
                        g_mncc_ud_id := res.id;
                }
                }
        [] T.timeout {
                setverdict(fail, "Timeout connecting to MNCC socket");
-               self.stop;
+               mtc.stop;
                }
        }
 }
@@ -226,14 +221,14 @@
        [] MNCC.receive(UD_listen_result:?) -> value res {
                if (ispresent(res.result) and ispresent(res.result.result_code) 
and res.result.result_code == ERROR) {
                        setverdict(fail, "Error listening to MNCC socket", res);
-                       self.stop;
+                       mtc.stop;
                } else {
                        g_mncc_ud_id := res.id;
                }
                }
        [] T.timeout {
                setverdict(fail, "Timeout listening to MNCC socket");
-               self.stop;
+               mtc.stop;
                }
        }

@@ -244,7 +239,7 @@
                }
        [] T.timeout {
                setverdict(fail, "Timeout waiting for MNCC connection");
-               self.stop;
+               mtc.stop;
                }
        }
 }
@@ -393,6 +388,7 @@
        if (not ischosen(conn_ind.u.signal) or
            (conn_ind.msg_type != MNCC_SETUP_IND and conn_ind.msg_type != 
MNCC_SETUP_REQ)) {
                setverdict(fail, "MNCC ExpectedCreateCallback needs 
MNCC_SETUP_{IND,REQ}");
+               mtc.stop;
                return ret;
        }
        dest_number := conn_ind.u.signal.called.number;
@@ -412,6 +408,7 @@
                }
        }
        setverdict(fail, "Couldn't find MnccExpect for incoming call ", 
dest_number);
+       mtc.stop;
        return ret;
 }

@@ -427,7 +424,7 @@
                        return;
                }
        }
-       setverdict(fail, "No space left in MnccMnccExpectTable");
+       testcase.stop("No space left in MnccMnccExpectTable");
 }

 /* client/conn_hdlr side function to use procedure port to create expect in 
emulation */
diff --git a/library/MNCC_Types.ttcn b/library/MNCC_Types.ttcn
index 19af236..157457a 100644
--- a/library/MNCC_Types.ttcn
+++ b/library/MNCC_Types.ttcn
@@ -1922,7 +1922,7 @@
                return pdu.u.signal.callref;
        } else  {
                setverdict(fail, "Unable to determine Callref for MNCC", pdu);
-               self.stop
+               mtc.stop
        }
 }

diff --git a/library/NS_Emulation.ttcn b/library/NS_Emulation.ttcn
index d43d15c..01d45b4 100644
--- a/library/NS_Emulation.ttcn
+++ b/library/NS_Emulation.ttcn
@@ -83,7 +83,7 @@
                res := f_IPL4_connect(NSCP, mp_remote_ip, mp_remote_udp_port, 
mp_local_ip, mp_local_udp_port, 0, { udp := {}});
                if (not ispresent(res.connId)) {
                        setverdict(fail, "Could not connect NS UDP socket, 
check your configuration");
-                       self.stop;
+                       mtc.stop;
                }
                g_conn_id := res.connId;
                f_change_state(NSE_S_DEAD_BLOCKED);
diff --git a/library/Osmocom_CTRL_Adapter.ttcn 
b/library/Osmocom_CTRL_Adapter.ttcn
index 22195c8..a98ac29 100644
--- a/library/Osmocom_CTRL_Adapter.ttcn
+++ b/library/Osmocom_CTRL_Adapter.ttcn
@@ -38,7 +38,7 @@
        [] IPA_CTRL.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}) { }
        [] T.timeout {
                setverdict(fail, "Timeout CTRL waiting for ASP_IPA_EVENT_UP");
-               self.stop;
+               mtc.stop;
                }
        }
 }
diff --git a/library/Osmocom_CTRL_Functions.ttcn 
b/library/Osmocom_CTRL_Functions.ttcn
index 70885c9..da3b80d 100644
--- a/library/Osmocom_CTRL_Functions.ttcn
+++ b/library/Osmocom_CTRL_Functions.ttcn
@@ -40,10 +40,12 @@
                [] pt.receive(tr_CtrlMsgTrap) { repeat; }
                [] pt.receive(tr_CtrlMsgError) -> value rx {
                        setverdict(fail, "Error in CTRL GET ", variable, ": ", 
rx.err.reason);
+                       mtc.stop;
                        return "FAIL";
                        }
                [] T.timeout {
                        setverdict(fail, "Timeout waiting for CTRL GET REPLY ", 
variable);
+                       mtc.stop;
                        return "TIMEOUT";
                        }
                }
@@ -62,9 +64,11 @@
                [] pt.receive(tr_CtrlMsgTrap) { repeat; }
                [] pt.receive(tr_CtrlMsgError) -> value rx {
                        setverdict(fail, "Error in CTRL GET ", variable, ": ", 
rx.err.reason);
+                       mtc.stop;
                        }
                [] T.timeout {
                        setverdict(fail, "Timeout waiting for CTRL SET REPLY ", 
variable);
+                       mtc.stop;
                        }
                }
        }
@@ -80,6 +84,7 @@
                        }
                [] T.timeout {
                        setverdict(fail, "Timeout waiting for TRAP ", variable);
+                       mtc.stop;
                        return "TIMEOUT";
                        }
                }
@@ -92,6 +97,7 @@
                ctrl_resp := f_ctrl_get(pt, variable);
                if (not match(ctrl_resp, exp)) {
                        setverdict(fail, "Unexpected " & variable & ":" & 
ctrl_resp);
+                       mtc.stop;
                }
        }

@@ -111,6 +117,7 @@
                ctrl_resp := f_ctrl_get(pt, variable);
                if (not match(str2int(ctrl_resp), exp)) {
                        setverdict(fail, variable & " value " & ctrl_resp & " 
didn't match ", exp);
+                       mtc.stop;
                }
        }

diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn
index d01fe37..6c1690a 100644
--- a/library/Osmocom_Types.ttcn
+++ b/library/Osmocom_Types.ttcn
@@ -96,7 +96,7 @@
                }
        }
        setverdict(fail, "Unsupported template", inp);
-       self.stop;
+       mtc.stop;
 }

 type record of integer IntegerRecord;
diff --git a/library/Osmocom_VTY_Functions.ttcn 
b/library/Osmocom_VTY_Functions.ttcn
index c7f4441..6e4eb74 100644
--- a/library/Osmocom_VTY_Functions.ttcn
+++ b/library/Osmocom_VTY_Functions.ttcn
@@ -59,7 +59,7 @@
                        [] pt.receive(charstring:?) -> value rx { buf := buf & 
rx; repeat };
                        [] T.timeout {
                                setverdict(fail, "VTY Timeout for prompt");
-                               self.stop;
+                               mtc.stop;
                                };
                }
                T.stop;
@@ -132,7 +132,7 @@
        var charstring ret := f_vty_transceive_ret(pt, cmd);
        if (not match(ret, exp_ret)) {
                setverdict(fail, "Non-matching VTY response: ", ret);
-               self.stop;
+               mtc.stop;
        }
 }

@@ -140,7 +140,7 @@
        var charstring ret := f_vty_transceive_ret(pt, cmd);
        if (match(ret, exp_ret)) {
                setverdict(fail, "Unexpected matching VTY response: ", ret);
-               self.stop;
+               mtc.stop;
        }
 }

diff --git a/library/PCUIF_CodecPort.ttcn b/library/PCUIF_CodecPort.ttcn
index c642202..389c5ca 100644
--- a/library/PCUIF_CodecPort.ttcn
+++ b/library/PCUIF_CodecPort.ttcn
@@ -70,14 +70,14 @@
                        } else {
                                setverdict(fail, "Error connecting to PCU 
socket");
                        }
-                       self.stop;
+                       mtc.stop;
                } else {
                        return res.id;
                }
                }
        [] T.timeout {
                setverdict(fail, "Timeout connecting to PCU socket");
-               self.stop;
+               mtc.stop;
                }
        }
        return -23;
@@ -106,7 +106,7 @@
        [] pt.receive { repeat; }
        [] T.timeout {
                setverdict(fail, "Timeout waiting for PCU DATA.cnf");
-               self.stop;
+               mtc.stop;
                }
        }
        return 0;
diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index 325f22e..3c035e9 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -90,11 +90,11 @@
                }
                [] RSL.receive {
                        setverdict(fail, "Unexpected RSL message on DCHAN");
-                       self.stop;
+                       mtc.stop;
                }
                [] T.timeout {
                        setverdict(fail, "Timeout waiting for RSL on DCHAN");
-                       self.stop;
+                       mtc.stop;
                }
        }
        /* never reached */
@@ -361,7 +361,7 @@
                                cid := f_cid_by_ra_fn(ra, fn);
                                if (cid == -1) {
                                        setverdict(fail, "IMM ASS for unknown 
DChan");
-                                       self.stop;
+                                       mtc.stop;
                                }
                                /* update client with trx_nr */
                                ConnectionTable[cid].trx_nr := 
f_trx_by_streamId(rx_rsl.streamId);
@@ -421,12 +421,13 @@
                                CLIENT_PT.send(rx_rsl.rsl) to 
ConnectionTable[cid].comp_ref;
                        } else {
                                setverdict(fail, "RSL for unknown Dchan");
+                               mtc.stop;
                        }
                }

                [not dchan_suspended] IPA_PT.receive {
                        setverdict(fail, "Received unknown primitive from IPA");
-                       self.stop;
+                       mtc.stop;
                }

                [bts_role] CLIENT_PT.receive(RSLDC_ChanRqd:?) -> value chan_rqd 
sender vc_conn {
diff --git a/library/RTP_Emulation.ttcn b/library/RTP_Emulation.ttcn
index 475b478..71cd8db 100644
--- a/library/RTP_Emulation.ttcn
+++ b/library/RTP_Emulation.ttcn
@@ -303,7 +303,7 @@
                                                                g_local_port, 
{udp:={}});
                        if (not ispresent(res.connId)) {
                                setverdict(fail, "Could not listen on RTP 
socket, check your configuration");
-                               self.stop;
+                               mtc.stop;
                        }
                        g_rtp_conn_id := res.connId;
                        tr_rtp.connId := g_rtp_conn_id;
@@ -311,7 +311,7 @@
                                                                g_local_port+1, 
{udp:={}});
                        if (not ispresent(res.connId)) {
                                setverdict(fail, "Could not listen on RTCP 
socket, check your configuration");
-                               self.stop;
+                               mtc.stop;
                        }
                        g_rtcp_conn_id := res.connId;
                        tr_rtcp.connId := g_rtcp_conn_id;
@@ -329,7 +329,7 @@
                                                                g_rtp_conn_id, 
{udp:={}});
                        if (not ispresent(res.connId)) {
                                setverdict(fail, "Could not connect to RTP 
socket, check your configuration");
-                               self.stop;
+                               mtc.stop;
                        }
                        res := RTP_CodecPort_CtrlFunct.f_IPL4_connect(RTCP, 
g_remote_host,
                                                                g_remote_port+1,
@@ -337,7 +337,7 @@
                                                                g_rtcp_conn_id, 
{udp:={}});
                        if (not ispresent(res.connId)) {
                                setverdict(fail, "Could not connect to RTCP 
socket, check your configuration");
-                               self.stop;
+                               mtc.stop;
                        }
                        CTRL.reply(RTPEM_connect:{g_remote_host, 
g_remote_port});
                }
@@ -426,9 +426,11 @@
                /* fail on any unexpected messages */
                [] RTP.receive {
                        setverdict(fail, "Received unexpected type from RTP");
+                       mtc.stop;
                }
                [] RTCP.receive {
                        setverdict(fail, "Received unexpected type from RTCP");
+                       mtc.stop;
                }
        }
        }
diff --git a/library/SIP_Emulation.ttcn b/library/SIP_Emulation.ttcn
index 3957b8f..98f7371 100644
--- a/library/SIP_Emulation.ttcn
+++ b/library/SIP_Emulation.ttcn
@@ -155,7 +155,7 @@
                }
        }
        setverdict(fail, "SIP Call table not found by SIP Call ID ", call_id);
-       self.stop;
+       mtc.stop;
 }

 /* resolve connection ID by component reference */
@@ -167,7 +167,7 @@
                }
        }
        setverdict(fail, "SIP Call table not found by component ", client);
-       self.stop;
+       mtc.stop;
 }

 private function f_expect_table_init()
@@ -196,8 +196,7 @@
                        return;
                }
        }
-       setverdict(fail, "SIP Call table full");
-       self.stop;
+       testcase.stop("SIP Call table full");
 }

 private function f_call_table_del(CallidString call_id)
@@ -211,7 +210,7 @@
                }
        }
        setverdict(fail, "SIP Call table attempt to delete non-existant ", 
call_id);
-       self.stop;
+       mtc.stop;
 }

 /* call-back type, to be provided by specific implementation; called when new 
call connection
@@ -270,7 +269,7 @@
                                CLIENT.send(sip_req) to vc_conn;
                        } else {
                                setverdict(fail, "SIP Request for unknown call 
", call_id);
-                               self.stop;
+                               mtc.stop;
                        }
                        }
                /* SIP response was received on SIP socket/port */
@@ -281,7 +280,7 @@
                                CLIENT.send(sip_resp) to vc_conn;
                        } else {
                                setverdict(fail, "SIP Response for unknown call 
", call_id);
-                               self.stop;
+                               mtc.stop;
                        }
                        }

@@ -344,6 +343,7 @@

        if (sip_req.requestLine.method != INVITE_E) {
                setverdict(fail, "SIP ExpectedCreateCallback needs INVITE");
+               mtc.stop
                return ret;
        }
        sip_to := sip_req.msgHeader.toField.addressField.nameAddr.addrSpec;
@@ -378,6 +378,7 @@
        }

        setverdict(fail, "Couldn't find SipExpect for incoming call ", sip_to);
+       mtc.stop
        return ret;
 }

@@ -393,7 +394,7 @@
                        return;
                }
        }
-       setverdict(fail, "No space left in SipExpectTable");
+       testcase.stop("No space left in SipExpectTable");
 }

 /* client/conn_hdlr side function to use procedure port to create expect in 
emulation */
diff --git a/library/SMPP_Emulation.ttcn b/library/SMPP_Emulation.ttcn
index 27876dc..6dc78e9 100644
--- a/library/SMPP_Emulation.ttcn
+++ b/library/SMPP_Emulation.ttcn
@@ -88,7 +88,7 @@
                }
        }
        setverdict(fail, "No componten for SMPP TID ", tid);
-       self.stop;
+       mtc.stop;
 }

 
@@ -109,8 +109,7 @@
                        return;
                }
        }
-       setverdict(fail, "SMPP Trans table full!");
-       self.stop;
+       testcase.stop("SMPP Trans table full!");
 }

 private function f_trans_table_del(uint32_t trans_id)
@@ -123,7 +122,7 @@
                }
        }
        setverdict(fail, "SMPP Trans table attempt to delete non-existant ", 
trans_id);
-       self.stop;
+       mtc.stop;
 }


@@ -136,7 +135,7 @@
                                                        local_host, local_port, 
0, { tcp :={} });
        if (not ispresent(res.connId)) {
                setverdict(fail, "Could not connect to SMPP port, check your 
configuration");
-               self.stop;
+               mtc.stop;
        }
        g_smpp_conn_id := res.connId;
 }
@@ -187,7 +186,7 @@
        [] SMPP_PORT.receive(tr_SMPP_Recv(g_smpp_conn_id, pdu)) { }
        [] T_wait.timeout {
                setverdict(fail, "Timeout waiting for ", pdu);
-               self.stop;
+               mtc.stop;
                }
        }
 }
@@ -211,7 +210,7 @@
                }
        [] SMPP_PORT.receive {
                setverdict(fail, "Unexpected SMPP from peer");
-               self.stop;
+               mtc.stop;
                }
 }

@@ -371,8 +370,7 @@
                        return;
                }
        }
-       setverdict(fail, "No space left in SmppExpectTable");
-       self.stop;
+       testcase.stop("No space left in SmppExpectTable");
 }

 private function f_exp_lookup(SMPP_TON ton, SMPP_NPI npi, charstring dst)
diff --git a/library/TRXC_CodecPort.ttcn b/library/TRXC_CodecPort.ttcn
index 774b674..09b2977 100644
--- a/library/TRXC_CodecPort.ttcn
+++ b/library/TRXC_CodecPort.ttcn
@@ -81,6 +81,7 @@
                }
        [] T.timeout {
                setverdict(fail, "Timeout waiting for ", tr, " on ", pt);
+               mtc.stop;
                }
        }
        return rf.msg;

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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc6819aaf0b01e70c38fad828dd44dcec6bdd778
Gerrit-Change-Number: 9905
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <[email protected]>

Reply via email to