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
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 659d5f1..82ed608 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -71,7 +71,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;
@@ -180,9 +180,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;
@@ -202,7 +208,8 @@
return str2hex(par.val);
}
}
- setverdict(fail);
+ setverdict(fail, "Could not find conn id for MgcpReponse");
+ mtc.stop;
return '00000000'H;
}
@@ -390,12 +397,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;
}
}
@@ -579,6 +588,7 @@
}
if (f_mgcp_find_param(resp_msg, "Z", ep_assigned) == false) {
setverdict(fail, "No SpecificEndpointName in MGCP response", resp);
+ mtc.stop;
}
/* clean-up */
@@ -611,6 +621,7 @@
}
if (f_mgcp_find_param(resp_msg, "Z", ep_assigned[i]) == false) {
setverdict(fail, "No SpecificEndpointName in MGCP response", resp);
+ mtc.stop;
}
}
@@ -920,6 +931,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);
}
@@ -1047,6 +1059,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);
@@ -1092,10 +1105,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 */
@@ -1104,10 +1119,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
@@ -1117,10 +1134,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
@@ -1142,11 +1161,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 */
@@ -1197,6 +1218,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);
@@ -1254,10 +1276,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);