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/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");
 }