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/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 */