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


Change subject: Stop tests after failures
......................................................................

Stop tests after failures

Call mtc.stop after setverdict(fail), add reasons to most failures and
fail with verdict error for internal errors.

Change-Id: I9b618235939fa41160b9be6677b121963d3ec857
---
M mgw/MGCP_Test.ttcn
M mgw/RTP_Endpoint.ttcn
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
M pcu/GPRS_TBF.ttcn
M pcu/PCU_Tests.ttcn
M selftest/Selftest.ttcn
M sgsn/SGSN_Tests.ttcn
M sip/SIP_Tests.ttcn
M sysinfo/Test.ttcn
10 files changed, 155 insertions(+), 71 deletions(-)



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

diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index d816a71..feed34f 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -70,7 +70,7 @@
                        res := MGCP_CodecPort_CtrlFunct.f_IPL4_connect(MGCP, 
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 MGCP, check 
your configuration");
-                               self.stop;
+                               mtc.stop;
                        }
                        g_mgcp_conn_id := res.connId;

@@ -179,9 +179,15 @@
                T.start;
                alt {
                        [] MGCP.receive(mrt) -> value mrf { }
-                       [] MGCP.receive(tr_MGCP_RecvFrom_R(?)) { 
setverdict(fail); }
+                       [] MGCP.receive(tr_MGCP_RecvFrom_R(?)) {
+                               setverdict(fail, "Response didn't match 
template");
+                               mtc.stop;
+                               }
                        [] MGCP.receive { repeat; }
-                       [] T.timeout { setverdict(fail); }
+                       [] T.timeout {
+                               setverdict(fail, "Timeout waiting for response 
to ", cmd);
+                               mtc.stop;
+                               }
                }
                T.stop;

@@ -201,7 +207,8 @@
                                return str2hex(par.val);
                        }
                }
-               setverdict(fail);
+               setverdict(fail, "Could not find conn id for MgcpReponse");
+               mtc.stop;
                return '00000000'H;
        }

@@ -370,12 +377,14 @@
                   payload type should be visible in the SDP of the response. */
                if (resp.sdp.media_list[0].media_field.fmts[0] != "0") {
                        setverdict(fail, "SDP contains unexpected codec");
+                       mtc.stop;
                }

                /* See also OS#2658: We also expect the MGW to assign a port
                   number to us. */
                if 
(isbound(resp.sdp.media_list[0].media_field.ports.port_number) == false) {
                        setverdict(fail, "SDP does not contain a port number");
+                       mtc.stop;
                }
        }

@@ -559,6 +568,7 @@
                }
                if (f_mgcp_find_param(resp_msg, "Z", ep_assigned) == false) {
                        setverdict(fail, "No SpecificEndpointName in MGCP 
response", resp);
+                       mtc.stop;
                }

                /* clean-up */
@@ -591,6 +601,7 @@
                        }
                        if (f_mgcp_find_param(resp_msg, "Z", ep_assigned[i]) == 
false) {
                                setverdict(fail, "No SpecificEndpointName in 
MGCP response", resp);
+                               mtc.stop;
                        }
                }

@@ -900,6 +911,7 @@
                stats[1] := f_rtpem_stats_get(RTPEM[1]);
                if (not f_rtpem_stats_compare(stats[0], stats[1])) {
                        setverdict(fail, "RTP endpoint statistics don't match");
+                       mtc.stop;
                }
                setverdict(pass);
        }
@@ -1027,6 +1039,7 @@
                stats[1] := f_rtpem_stats_get(RTPEM[1]);
                if (not f_rtpem_stats_compare(stats[0], stats[1], tolerance)) {
                        setverdict(fail, "RTP endpoint statistics don't match");
+                       mtc.stop;
                }

                setverdict(pass);
@@ -1072,10 +1085,12 @@
                stats[0] := f_rtpem_stats_get(RTPEM[0]);
                if (stats[0].num_pkts_rx_err_disabled != 0) {
                        setverdict(fail, "received packets from MGW on recvonly 
connection");
+                       mtc.stop;
                }
                stats[1] := f_rtpem_stats_get(RTPEM[1]);
                if (stats[1].num_pkts_rx_err_disabled != 0) {
                        setverdict(fail, "received packets from MGW on recvonly 
connection");
+                       mtc.stop;
                }

                /* The second leg starts transmitting a little later */
@@ -1084,10 +1099,12 @@
                stats[0] := f_rtpem_stats_get(RTPEM[0]);
                if (stats[0].num_pkts_rx_err_disabled != 0) {
                        setverdict(fail, "received packets from MGW on recvonly 
connection");
+                       mtc.stop;
                }
                stats[1] := f_rtpem_stats_get(RTPEM[1]);
                if (stats[1].num_pkts_rx_err_disabled != 0) {
                        setverdict(fail, "received packets from MGW on recvonly 
connection");
+                       mtc.stop;
                }

                /* The first leg will now be switched into bidirectional
@@ -1097,10 +1114,12 @@
                stats[0] := f_rtpem_stats_get(RTPEM[0]);
                if (stats[1].num_pkts_rx_err_disabled != 0) {
                        setverdict(fail, "received packets from MGW on recvonly 
connection");
+                       mtc.stop;
                }
                stats[1] := f_rtpem_stats_get(RTPEM[1]);
                if (stats[1].num_pkts_rx_err_disabled != 0) {
                        setverdict(fail, "received packets from MGW on recvonly 
connection");
+                       mtc.stop;
                }

                /* When the second leg is switched into bidirectional mode
@@ -1122,11 +1141,13 @@
                temp := stats[0].num_pkts_tx - num_pkts_tx[0] - 
stats[1].num_pkts_rx;
                if (temp > 3 or temp < -3) {
                        setverdict(fail, "number of packets not within normal 
parameters");
+                       mtc.stop;
                }

                temp := stats[1].num_pkts_tx - num_pkts_tx[1] - 
stats[0].num_pkts_rx;
                if (temp > 3 or temp < -3) {
                        setverdict(fail, "number of packets not within normal 
parameters");
+                       mtc.stop;
                }

                /* Tear down */
@@ -1177,6 +1198,7 @@
                stats[1] := f_rtpem_stats_get(RTPEM[1]);
                if (not f_rtpem_stats_compare(stats[0], stats[1])) {
                        setverdict(fail, "RTP endpoint statistics don't match");
+                       mtc.stop;
                }

                setverdict(pass);
@@ -1234,10 +1256,12 @@
                stats[1] := f_rtpem_stats_get(RTPEM[1]);
                if (not f_rtpem_stats_compare(stats[0], stats[1], 5)) {
                        setverdict(fail, "RTP endpoint statistics don't match");
+                       mtc.stop;
                }
                stats[2] := f_rtpem_stats_get(RTPEM[2]);
                if (stats[2].num_pkts_rx_err_disabled != 0) {
                        setverdict(fail, "received packets on old leg after 
handover");
+                       mtc.stop;
                }

                setverdict(pass);
diff --git a/mgw/RTP_Endpoint.ttcn b/mgw/RTP_Endpoint.ttcn
index 3c939a2..c73aa58 100644
--- a/mgw/RTP_Endpoint.ttcn
+++ b/mgw/RTP_Endpoint.ttcn
@@ -111,7 +111,7 @@
                                        sub.local_name, sub.local_port, 
sub.connection_id, { udp := {} });
                if (not ispresent(res.connId)) {
                        setverdict(fail, "Could not connect RTP, check your 
configuration");
-                       self.stop;
+                       mtc.stop;
                }
                /* connect without previous bind: save conenction id allocated 
by IPL4asp */
                if (sub.connection_id == -1) {
@@ -136,7 +136,7 @@
                res := f_IPL4_listen(RTP, sub.local_name, sub.local_port, { udp 
:= {} });
                if (not ispresent(res.connId)) {
                        setverdict(fail, "Could not listen to RTP, check your 
configuration");
-                       self.stop;
+                       mtc.stop;
                }
                sub.connection_id := res.connId;
        }
diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 803cb4d..4e02d6c 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -109,7 +109,7 @@
 private altstep as_Tguard() runs on BSC_ConnHdlr {
        [] g_Tguard.timeout {
                setverdict(fail, "Tguard timeout");
-               self.stop;
+               mtc.stop;
        }
 }

@@ -183,7 +183,7 @@
        [] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_CONF_IND) {}
        [] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {
                        setverdict(fail, "DISC.ind from SCCP");
-                       self.stop;
+                       mtc.stop;
                }
        }
 }
@@ -294,7 +294,7 @@
                        }
                [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(?, g_pars.vec.kc)) {
                        setverdict(fail, "Wrong ciphering algorithm mask in 
CiphModCmd");
-                       self.stop;
+                       mtc.stop;
                        }
                }
                /* FIXME: Send the best available algorithm */
@@ -331,7 +331,7 @@
                        if (not ispresent(lu_acc.mobileIdentityTLV) or
                            not 
ischosen(lu_acc.mobileIdentityTLV.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi))
 {
                                setverdict(fail, "Expected TMSI but no TMSI was 
allocated");
-                               self.stop;
+                               mtc.stop;
                        } else {
                                g_pars.tmsi := 
lu_acc.mobileIdentityTLV.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets;
                                
BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_TmsiRealloc_Cmpl));
@@ -340,13 +340,13 @@
                        if (ispresent(lu_acc.mobileIdentityTLV) and
                            
ischosen(lu_acc.mobileIdentityTLV.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi))
 {
                                setverdict(fail, "Expected no TMSI but TMSI was 
allocated");
-                               self.stop;
+                               mtc.stop;
                        }
                }
                }
        [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) {
                setverdict(fail, "Expected LU ACK, but received LU REJ");
-               self.stop;
+               mtc.stop;
                }
        }
        /* FIXME: there could be pending SMS or other common procedures by the 
MSC, let's ignore them */
@@ -695,7 +695,7 @@
        [] MNCC.receive(tr_MNCC_START_DTMF_ind(cpars.mncc_callref, "2")) {}
        [] T.timeout {
                setverdict(fail, "Timeout waiting for START_DTMF_ind");
-               self.stop;
+               mtc.stop;
                }
        }

@@ -704,7 +704,7 @@
        alt {
        [] MNCC.receive(tr_MNCC_START_DTMF_ind(cpars.mncc_callref, "2")) {
                setverdict(fail, "Received duplicate START_DTMF_ind");
-               self.stop;
+               mtc.stop;
                }
        [] T.timeout { }
        }
@@ -716,7 +716,7 @@
        [] MNCC.receive(tr_MNCC_START_DTMF_ind(cpars.mncc_callref, "3")) { }
        [] T.timeout {
                setverdict(fail, "Received duplicate START_DTMF_ind");
-               self.stop;
+               mtc.stop;
                }
        }

@@ -732,13 +732,13 @@
                        }
                [] BSSAP.receive {
                        setverdict(fail, "Unexpected BSSMAP while waiting for 
SCCP Release");
-                       self.stop;
+                       mtc.stop;
                        }
                }
                }
        [] BSSAP.receive {
                setverdict(fail, "Unexpected BSSMAP while waiting for 
ClearCommand");
-               self.stop;
+               mtc.stop;
                }
 }

@@ -750,7 +750,7 @@
        [] as_clear_cmd_compl_disc(t) { }
        [] T.timeout {
                setverdict(fail, "Timeout waiting for ClearCommand/Release");
-               self.stop;
+               mtc.stop;
                }
        }
 }
@@ -808,7 +808,7 @@
 private altstep as_other_sms() runs on BSC_ConnHdlr {
        [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_SMS(?, ?, ?), ?)) {
                setverdict(fail, "Unexpected SMS related PDU from MSC");
-               self.stop;
+               mtc.stop;
        }
 }

diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index dc3ad1e..a2e000a 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -133,7 +133,7 @@
 private altstep as_Tguard_direct() runs on MTC_CT {
        [] Tguard_direct.timeout {
                setverdict(fail, "Tguard timeout");
-               self.stop;
+               mtc.stop;
        }
 }

@@ -213,7 +213,7 @@
                [] GSUP_IPA_EVENT.receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_UP)) { 
}
                [] T.timeout {
                        setverdict(fail, "No connection to GSUP Port");
-                       self.stop
+                       mtc.stop
                }
        }
 }
@@ -226,7 +226,7 @@
        g_initialized := true;

        if (num_bsc > NUM_BSC) {
-               setverdict(fail, "excess number of BSC instances requested");
+               testcase.stop("excess number of BSC instances requested");
        }

        for (var integer i := 0; i < num_bsc; i := i + 1) {
@@ -234,7 +234,7 @@
                        f_bssap_init(g_bssap[i], mp_bssap_cfg[i], "MSC_Test_" & 
int2str(i), BSC_BssmapOps);
                        f_bssap_start(g_bssap[i]);
                } else {
-                       setverdict(fail, "missing BSSAP configuration");
+                       testcase.stop("missing BSSAP configuration");
                }
        }

@@ -529,7 +529,7 @@
                        }
                [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) {
                        setverdict(fail, "Expecting LU REJ, but got ACCEPT");
-                       self.stop;
+                       mtc.stop;
                }
        }
        f_expect_clear();
@@ -558,7 +558,7 @@
                        }
                [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) {
                        setverdict(fail, "Expecting LU REJ, but got ACCEPT");
-                       self.stop;
+                       mtc.stop;
                }
        }
        f_expect_clear();
@@ -605,11 +605,18 @@
        alt {
        [] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ)) { }
        //[] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_ACC)) { }
-       [] BSSAP.receive { setverdict(fail, "Received unexpected BSSAP"); }
+       [] BSSAP.receive {
+               setverdict(fail, "Received unexpected BSSAP");
+               mtc.stop;
+               }
        [] GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)) {
                setverdict(fail, "Unexpected GSUP UL REQ");
+               mtc.stop;
                }
-       [] T.timeout { setverdict(fail, "Timeout waiting for CM SERV REQ"); }
+       [] T.timeout {
+               setverdict(fail, "Timeout waiting for CM SERV REQ");
+               mtc.stop;
+               }
        }

        f_expect_clear();
@@ -730,6 +737,7 @@
        /* See https://osmocom.org/issues/2862 */
        [] BSSAP.receive(tr_BSSMAP_ClearCommand) {
                        setverdict(fail, "Got a second Clear Command, only one 
expected");
+                       mtc.stop;
                        repeat;
                }
        [] BSSAP.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {}
@@ -840,6 +848,7 @@
                }
        [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) {
                setverdict(fail, "Expected LU ACK, but received REJ");
+               mtc.stop;
                }
        }

@@ -1127,7 +1136,7 @@
        [] as_clear_cmd_compl_disc();
        [] T.timeout {
                setverdict(fail, "Timeout waiting for ClearCommand or SCCP 
Release");
-               self.stop;
+               mtc.stop;
                }
        }
        setverdict(pass);
@@ -1161,7 +1170,7 @@
        [] as_clear_cmd_compl_disc();
        [] T.timeout {
                setverdict(fail, "Timeout waiting for ClearCommand or SCCP 
Release");
-               self.stop;
+               mtc.stop;
                }
        }
        setverdict(pass);
@@ -1305,7 +1314,10 @@
        timer T := 30.0;
        T.start;
        alt {
-       [] T.timeout { setverdict(fail, "Timeout waiting for channel release"); 
self.stop; }
+       [] T.timeout {
+               setverdict(fail, "Timeout waiting for channel release");
+               mtc.stop;
+               }
        [] 
BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(cpars.transaction_id))) {
                
BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_REL_COMPL(cpars.transaction_id)));
                repeat;
@@ -1317,7 +1329,10 @@
         * the current implementation, there is no recovery mechanism 
implemented
         * and a DLCX can not be performed as the MSC does not know a specific
         * endpoint yet. */
-       [] MGCP.receive { setverdict(fail, "Unexpected MGCP message"); 
self.stop; }
+       [] MGCP.receive {
+               setverdict(fail, "Unexpected MGCP message");
+               mtc.stop;
+               }
        [] as_clear_cmd_compl_disc();
        }
 }
@@ -1405,7 +1420,10 @@
        timer T := 30.0;
        T.start;
        alt {
-       [] T.timeout { setverdict(fail, "Timeout waiting for channel release"); 
self.stop; }
+       [] T.timeout {
+               setverdict(fail, "Timeout waiting for channel release");
+               mtc.stop;
+               }
        [] BSSAP.receive { repeat; }
        [] MNCC.receive { repeat; }
        [] GSUP.receive { repeat; }
@@ -1449,7 +1467,10 @@
        timer T := 190.0;
        T.start;
        alt {
-       [] T.timeout { setverdict(fail, "Timeout waiting for T310"); self.stop; 
}
+       [] T.timeout {
+               setverdict(fail, "Timeout waiting for T310");
+               mtc.stop;
+               }
        [] MNCC.receive(tr_MNCC_DISC_ind(cpars.mncc_callref)) {
                MNCC.send(ts_MNCC_REL_req(cpars.mncc_callref, 
valueof(ts_MNCC_cause(23))));
                }
@@ -1496,7 +1517,7 @@
        [] GSUP.receive(tr_GSUP_CL_RES(g_pars.imsi)) { }
        [] GSUP.receive(tr_GSUP_CL_ERR(g_pars.imsi)) {
                setverdict(fail, "Received GSUP Location Cancel Error");
-               self.stop;
+               mtc.stop;
                }
        }

@@ -1508,7 +1529,7 @@
        [] BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_REJ)) { }
        [] BSSAP.receive {
                setverdict(fail, "Received unexpected BSSAP instead of CM SERV 
REJ");
-               self.stop;
+               mtc.stop;
                }
        }
        setverdict(pass);
@@ -1581,11 +1602,11 @@
                }
        [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(?,?)) {
                setverdict(fail, "CipherModeCommand despite no A5 
intersection");
-               self.stop;
+               mtc.stop;
                }
        [] BSSAP.receive {
                setverdict(fail, "Unknown/unexpected BSSAP received");
-               self.stop;
+               mtc.stop;
                }
        }
        setverdict(pass);
@@ -1648,11 +1669,11 @@
                }
        [] BSSAP.receive(tr_BSSMAP_CipherModeCmd(?,?)) {
                setverdict(fail, "CipherModeCommand despite no A5 
intersection");
-               self.stop;
+               mtc.stop;
                }
        [] BSSAP.receive {
                setverdict(fail, "Unknown/unexpected BSSAP received");
-               self.stop;
+               mtc.stop;
                }
        }
        setverdict(pass);
@@ -1764,6 +1785,7 @@
        [reset_ack_seen == true] T.timeout { setverdict(pass) }
        [reset_ack_seen == false] T.timeout {
                setverdict(fail, "no BSSMAP RESET ACK seen!");
+               mtc.stop;
        }
        }
 }
@@ -1999,7 +2021,7 @@
        case ('110'B) { return abbreviated; }
        }
        setverdict(fail, "Unknown TON ", ton);
-       self.stop;
+       mtc.stop;
 }
 /* convert GSM L3 NPI to SMPP_NPI enum */
 function f_sm_npi_from_gsm(BIT4 npi) return SMPP_NPI {
@@ -2014,7 +2036,7 @@
        case ('1010'B) { return ermes; }
        }
        setverdict(fail, "Unknown NPI ", npi);
-       self.stop;
+       mtc.stop;
 }

 /* build a SMPP_SM from SmsParameters */
@@ -2154,7 +2176,7 @@
                }
        [] BSSAP.receive {
                setverdict(fail, "Unknown/unexpected BSSAP received");
-               self.stop;
+               mtc.stop;
                }
        }

@@ -2217,7 +2239,7 @@
                }
        [] BSSAP.receive {
                setverdict(fail, "Unknown/unexpected BSSAP received");
-               self.stop;
+               mtc.stop;
                }
        }

diff --git a/pcu/GPRS_TBF.ttcn b/pcu/GPRS_TBF.ttcn
index 3e8658e..951cf4a 100644
--- a/pcu/GPRS_TBF.ttcn
+++ b/pcu/GPRS_TBF.ttcn
@@ -121,7 +121,7 @@
        var integer idx := n - us.et.v_a;
        if (idx < 0 or idx > lengthof(us.et.v_b)) {
                setverdict(fail, "UlTbf: Cannot ACK ", n, " while V(A) is ", 
us.et.v_a);
-               self.stop;
+               mtc.stop;
        }
        /* set the bit in the acknowledge state array */
        us.et.v_b[idx] := '1'B;
@@ -411,7 +411,7 @@

 function f_dl_tbf_is_in_window(integer bsn) return boolean {
        setverdict(fail, "pleaes implement me");
-       self.stop;
+       mtc.stop;
 }

 function f_dl_tbf_is_received(inout DlTbfState ds, integer bsn) return boolean 
{
@@ -471,7 +471,7 @@
        var integer bsn := db.mac_hdr.hdr_ext.bsn;
        if (db.mac_hdr.hdr_ext.tfi != ds.tfi) {
                setverdict(fail, "Unexpected TFI of DL Data Block ", db);
-               self.stop;
+               mtc.stop;
        }
        f_dl_tbf_mark_received(ds, bsn);
        if (ds.tbf.ack_mode) {
@@ -480,7 +480,7 @@
                 * SNS */
                if (bsn < ds.er.v_q or bsn > ds.er.v_q + ds.tbf.ws) {
                        setverdict(fail, "Unexpected BSN outside of window ", 
bsn);
-                       self.stop;
+                       mtc.stop;
                }

                /* In RLC acknowledged mode, the value of V(Q) shall be updated 
when the RLC
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index 6e36f68..dfd380d 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -131,7 +131,8 @@
                log("NS Expected: ", b);

                if (a != b) {
-                       setverdict(fail);
+                       setverdict(fail, "Values mismatch", a, b);
+                       mtc.stop;
                } else {
                        setverdict(pass);
                }
@@ -188,7 +189,10 @@
                alt {
                        [] BSSGP.receive(t_BssgpStsInd(?, ?, BVC_S_UNBLOCKED)) 
{ }
                        [] BSSGP.receive { repeat; }
-                       [] T.timeout { setverdict(fail); }
+                       [] T.timeout {
+                               setverdict(fail, "Timeout establishing BSSGP 
connection");
+                               mtc.stop;
+                       }
                }
                T.stop
                log("BSSGP successfully initialized");
@@ -233,7 +237,7 @@
                        [] L1.receive { repeat; }
                        [] T.timeout {
                                setverdict(fail, "Timeout establishing UL TBF");
-                               self.stop;
+                               mtc.stop;
                        }
                }
                T.stop;
@@ -275,6 +279,7 @@
                }
        [] T.timeout {
                setverdict(fail, "Timeout waiting for ", bd_exp);
+               mtc.stop;
                }
        }
 }
@@ -365,7 +370,8 @@
                log("LLC Expected: ", b);

                if (a != b) {
-                       setverdict(fail);
+                       setverdict(fail, "LLC input ", b, " != expected ", a);
+                       mtc.stop;
                } else {
                        setverdict(pass);
                }
@@ -437,7 +443,10 @@
                log("Dec: ", udb);
                var octetstring enc := enc_RlcmacUlBlock(udb);
                log("Enc: ", enc);
-               if (enc != buf) { setverdict(fail, "Re-encoded data doesn't 
equal input data"); }
+               if (enc != buf) {
+                       setverdict(fail, "Re-encoded data doesn't equal input 
data");
+                       mtc.stop;
+               }
        }

        function f_rlcmac_uld_decenc(in octetstring buf) {
@@ -447,7 +456,10 @@
                log("Dec: ", udb);
                var octetstring enc := enc_RlcmacUlDataBlock(udb);
                log("Enc: ", enc);
-               if (enc != buf) { setverdict(fail, "Re-encoded data doesn't 
equal input data"); }
+               if (enc != buf) {
+                       setverdict(fail, "Re-encoded data doesn't equal input 
data");
+                       mtc.stop;
+               }
        }

        function f_rlcmac_dld_decenc(in octetstring buf) {
@@ -457,7 +469,10 @@
                log("Dec: ", udb);
                var octetstring enc := enc_RlcmacDlDataBlock(udb);
                log("Enc: ", enc);
-               if (enc != buf) { setverdict(fail, "Re-encoded data doesn't 
equal input data"); }
+               if (enc != buf) {
+                       setverdict(fail, "Re-encoded data doesn't equal input 
data");
+                       mtc.stop;
+               }
        }


@@ -561,7 +576,7 @@
                [] L1.receive { repeat };
                [] T.timeout {
                        setverdict(fail, "Timeout waiting for IMM ASS")
-                       self.stop;
+                       mtc.stop;
                        }
                }
                T.stop;
diff --git a/selftest/Selftest.ttcn b/selftest/Selftest.ttcn
index 826d244..8411b3d 100644
--- a/selftest/Selftest.ttcn
+++ b/selftest/Selftest.ttcn
@@ -57,7 +57,7 @@
        res := IPL4asp_PortType.f_IPL4_connect(IP, "127.0.0.1", 55555, "", 
-1,-1, {tcp:={}});
        if (not ispresent(res.connId)) {
                setverdict(fail, "Could not connect to TCP port, check your 
configuration");
-               self.stop;
+               mtc.stop;
        }
        g_ip_conn_id := res.connId;
 }
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 017c724..91edf24 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -133,7 +133,7 @@
                [] GSUP_IPA_EVENT.receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_UP)) { 
}
                [] T.timeout {
                        setverdict(fail, "No connection to GSUP Port");
-                       self.stop;
+                       mtc.stop;
                }
        }
 }
@@ -230,7 +230,7 @@
 private altstep as_Tguard() runs on BSSGP_ConnHdlr {
        [] g_Tguard.timeout {
                setverdict(fail, "Tguard timeout");
-               self.stop;
+               mtc.stop;
        }
 }

@@ -375,19 +375,19 @@
        if (not (g_pars.bssgp_cell_id.ra_id.lai.mcc_mnc == aa_plmn)) {
                  setverdict(fail, "mismatching PLMN in Attach Accept: " & 
hex2str(aa_plmn)
                                   & "; expected " & 
hex2str(g_pars.bssgp_cell_id.ra_id.lai.mcc_mnc));
-                 self.stop;
+                 mtc.stop;
        }
        g_pars.ra := aa.routingAreaIdentification;
        if (ispresent(aa.allocatedPTMSI)) {
                if (not g_pars.net.expect_ptmsi) {
                        setverdict(fail, "unexpected P-TMSI allocation");
-                       self.stop;
+                       mtc.stop;
                }
                
f_upd_ptmsi_and_tlli(aa.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets);
        }
        if (ispresent(aa.msIdentity)) {
                setverdict(fail, "unexpected TMSI allocation in non-combined 
attach");
-               self.stop;
+               mtc.stop;
        }
        /* P-TMSI.sig */
        if (ispresent(aa.ptmsiSignature)) {
@@ -404,13 +404,13 @@
        if (ispresent(ra.allocatedPTMSI)) {
                if (not g_pars.net.expect_ptmsi) {
                        setverdict(fail, "unexpected P-TMSI allocation");
-                       self.stop;
+                       mtc.stop;
                }
                
f_upd_ptmsi_and_tlli(ra.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets);
        }
        if (ispresent(ra.msIdentity)) {
                setverdict(fail, "unexpected TMSI allocation in non-combined 
attach");
-               self.stop;
+               mtc.stop;
        }
        /* P-TMSI.sig */
        if (ispresent(ra.ptmsiSignature)) {
@@ -530,6 +530,7 @@
                }
        [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_REJECT(?))) {
                setverdict(fail, "Wrong Attach Reject Cause");
+               mtc.stop;
                }
        }
 }
@@ -598,6 +599,7 @@
        [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> 
value bd {
                f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
                setverdict(fail);
+               mtc.stop;
                }
        }
 }
@@ -627,6 +629,7 @@
        [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> 
value bd {
                f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
                setverdict(fail);
+               mtc.stop;
                }
        }
 }
@@ -708,6 +711,7 @@
                }
        [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT(*, *, *))) {
                setverdict(fail);
+               mtc.stop;
                }
        }
 }
@@ -761,6 +765,7 @@
                }
        [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_RAU_REJECT)) {
                setverdict(fail, "Unexpected RAU Reject");
+               mtc.stop;
                }
        [] BSSGP.receive { repeat; }
        }
@@ -786,10 +791,12 @@
        alt {
        [not expect_purge] GSUP.receive(tr_GSUP_PURGE_MS_REQ(?)) {
                setverdict(fail, "Unexpected GSUP PURGE MS for unregistered 
TLLI");
+               mtc.stop;
                }
        [power_off] BSSGP.receive(tr_BD_L3_MT(tr_GMM_DET_ACCEPT_MT)) -> value 
bd {
                g_pars.ra := omit;
                setverdict(fail, "Unexpected ATTACH ACCEPT in no-power-off 
DETACH");
+               mtc.stop;
                /* TODO: check if any PDP contexts are deactivated on network 
side? */
                }
        [power_off] T.timeout {
@@ -913,9 +920,11 @@
                }
        [exp_rej] BSSGP.receive(tr_BD_L3_MT(tr_SM_ACT_PDP_ACCEPT)) {
                setverdict(fail, "Unexpected PDP CTX ACT ACC");
+               mtc.stop;
                }
        [not exp_rej] BSSGP.receive(tr_BD_L3_MT(tr_SM_ACT_PDP_REJ(apars.tid, 
?))) {
                setverdict(fail, "Unexpected PDP CTX ACT FAIL");
+               mtc.stop;
                }
        [not exp_rej] BSSGP.receive(tr_BD_L3_MT(tr_SM_ACT_PDP_ACCEPT(apars.tid, 
apars.sapi))) {
                setverdict(pass);
@@ -1138,9 +1147,11 @@
                }
        [] GTP.receive(tr_GTPC_MsgType(?, createPDPContextRequest, ?)) {
                setverdict(fail, "Unexpected GTP PDP CTX ACT");
+               mtc.stop;
                }
        [] BSSGP.receive(tr_BD_L3_MT(tr_SM_ACT_PDP_ACCEPT(?, ?))) {
                setverdict(fail, "Unexpected SM PDP CTX ACT ACK");
+               mtc.stop;
                }
        [] BSSGP.receive { repeat; }
        }
@@ -1266,10 +1277,11 @@
                [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_DET_REQ_MT(*, *, *))) {
                        T.stop;
                        setverdict(fail, "Unexpected GMM Detach Request");
+                       mtc.stop;
                }
                [] T.timeout {
                        setverdict(pass);
-                       self.stop;
+                       mtc.stop;
                }
                [] BSSGP.receive {
                        repeat;
@@ -1411,6 +1423,7 @@
        }
        if (count_req != 5) {
                setverdict(fail, "Did not received GMM ID Request Type IMEI 5 
times!");
+               mtc.stop;
        }
        setverdict(pass);
 }
@@ -1458,6 +1471,7 @@
        }
        if (count_req != 5) {
                setverdict(fail, "Did not received GMM ID Request Type IMSI 5 
times!");
+               mtc.stop;
        }
        setverdict(pass);
 }
@@ -1517,6 +1531,7 @@
        alt {
                [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_REJECT(?))) {
                        setverdict(fail, "Received unexpected GMM Attach 
REJECT");
+                       mtc.stop;
                }
                [] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT(*, *, *))) -> 
value bd {
                        
f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
@@ -1572,6 +1587,7 @@
        }
        if (count_req != 5) {
                setverdict(fail, "Did not received GMM Attach Complete.");
+               mtc.stop;
        }
        setverdict(pass);
 }
diff --git a/sip/SIP_Tests.ttcn b/sip/SIP_Tests.ttcn
index f690dc7..24b3622 100644
--- a/sip/SIP_Tests.ttcn
+++ b/sip/SIP_Tests.ttcn
@@ -131,7 +131,7 @@
 private altstep as_Tguard() runs on ConnHdlr {
        [] g_Tguard.timeout {
                setverdict(fail, "Tguard timeout");
-               self.stop;
+               mtc.stop;
        }
 }

diff --git a/sysinfo/Test.ttcn b/sysinfo/Test.ttcn
index 02a2279..1927e88 100644
--- a/sysinfo/Test.ttcn
+++ b/sysinfo/Test.ttcn
@@ -139,8 +139,8 @@
        /* 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)) {
-                       log("Fail: No ", key, " in TC=", tc, "!");
-                       setverdict(fail);
+                       setverdict(fail), "Fail: No ", key, " in TC=", tc, "!");
+                       mtc.stop;
                }
        }

@@ -180,8 +180,8 @@
        /* 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)) {
-                       log("Fail: Not ", n, "/", m, " of ", key, " in TC=", 
tc, "!");
-                       setverdict(fail);
+                       setverdict(fail, "Fail: Not ", n, "/", m, " of ", key, 
" in TC=", tc, "!");
+                       mtc.stop;
                }
        }

@@ -202,8 +202,8 @@
        /* 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)) {
-                       log("Fail: Not all ", key, " in TC=", tc, "!");
-                       setverdict(fail);
+                       setverdict(fail, "Fail: Not all ", key, " in TC=", tc, 
"!");
+                       mtc.stop;
                }
        }

@@ -233,6 +233,7 @@
                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=0!");
+                               mtc.stop;
                        }
                }
                if (cfg.si1_present) {
@@ -313,6 +314,7 @@
                        }
                        if (f_si_vec_contains(si_per_tc, 
SYSTEM_INFORMATION_TYPE_13alt)) {
                                setverdict(fail, "Cannot have SI13alt and 
SI13");
+                               mtc.stop;
                        }
                }
                if (cfg.si16_present or cfg.si17_present) {
@@ -323,6 +325,7 @@
                        }
                        if (f_si_vec_contains(si_per_tc, 
SYSTEM_INFORMATION_TYPE_22)) {
                                setverdict(fail, "Cannot have SI16/SI17 and 
SI22!");
+                               mtc.stop;
                        }
                        if (not cfg.bcch_extended) {
                                testcase.stop("Error: SI16/SI17 requires BCCH 
Extd!");
@@ -368,6 +371,7 @@
                        }
                        if (f_si_vec_contains(si_per_tc, 
SYSTEM_INFORMATION_TYPE_13)) {
                                setverdict(fail, "Cannot have SI13alt and 
SI13");
+                               mtc.stop;
                        }
                        if (not cfg.bcch_extended) {
                                f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, 
SYSTEM_INFORMATION_TYPE_13alt, false, 1, 4);
@@ -399,6 +403,7 @@
                                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;
                                }
                        }
                }
@@ -413,6 +418,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;
                        }
                        if (not cfg.bcch_extended) {
                                testcase.stop("Error: SI22 requires BCCH 
Extd!");
@@ -484,6 +490,7 @@
                var SystemInformation si := f_gsmtap_get_si(pt, msg_type);
                if (not match(si, t)) {
                        setverdict(fail, "SI ", si, " doesn't match ", t);
+                       mtc.stop;
                } else {
                        setverdict(pass);
                }

--
To view, visit https://gerrit.osmocom.org/9907
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: I9b618235939fa41160b9be6677b121963d3ec857
Gerrit-Change-Number: 9907
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <[email protected]>

Reply via email to