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.

Using testcase.stop instead for errors internal to our test
infrastructure to mark them as test errors instead of failed.

Change-Id: Idc6819aaf0b01e70c38fad828dd44dcec6bdd778
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 "";
 }