Change in osmo-ttcn3-hacks[master]: remsim: add the guard timeout to all test cases

laforge gerrit-no-reply at lists.osmocom.org
Mon Mar 1 12:56:35 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23147 )

Change subject: remsim: add the guard timeout to all test cases
......................................................................

remsim: add the guard timeout to all test cases

As can be seen [1], it happens quite often that a test case gets
stuck and runs forever.  Most of the existing test suites have
the guard timeout to prevent this.  Let's make use of it here too.

[1] https://jenkins.osmocom.org/jenkins/view/TTCN3/job/ttcn3-remsim-test-latest/190/
	Build has been executing for 1 day 23 hr!

Change-Id: I3897efd2a97c3e0d487057aa7bdc2967f3424dd8
---
M remsim/RemsimBankd_Tests.ttcn
M remsim/RemsimClient_Tests.ttcn
M remsim/RemsimServer_Tests.ttcn
3 files changed, 59 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/remsim/RemsimBankd_Tests.ttcn b/remsim/RemsimBankd_Tests.ttcn
index 47beedd..a2686d3 100644
--- a/remsim/RemsimBankd_Tests.ttcn
+++ b/remsim/RemsimBankd_Tests.ttcn
@@ -35,11 +35,23 @@
 /* We implement a RSPRO server to simulate the remsim-server and a
    RSPRO client to simulate a remsim-client connecting to bankd */
 type component bankd_test_CT extends rspro_server_CT, rspro_client_CT, VPCD_Adapter_CT {
+	timer g_T_guard := 60.0;
+}
+
+private altstep as_Tguard() runs on bankd_test_CT {
+	[] g_T_guard.timeout {
+		setverdict(fail, "Timeout of T_guard");
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+		}
 }
 
 private function f_init(boolean start_client := false) runs on bankd_test_CT {
 	var ComponentIdentity srv_comp_id := valueof(ts_CompId(remsimServer, "ttcn-server"));
 
+	/* Start the guard timer */
+	g_T_guard.start;
+	activate(as_Tguard());
+
 	f_rspro_srv_init(0, mp_server_ip, mp_server_port, srv_comp_id);
 
 	if (start_client) {
diff --git a/remsim/RemsimClient_Tests.ttcn b/remsim/RemsimClient_Tests.ttcn
index 499fd3e..d7d6bc7 100644
--- a/remsim/RemsimClient_Tests.ttcn
+++ b/remsim/RemsimClient_Tests.ttcn
@@ -15,6 +15,7 @@
 import from Native_Functions all;
 import from Osmocom_Types all;
 import from IPA_Emulation all;
+import from Misc_Helpers all;
 
 /* the PIPEasp port allows us to interact with osmo-remsim-client-shell via stdin/stdout */
 import from PIPEasp_PortType all;
@@ -33,12 +34,24 @@
 type component client_test_CT extends rspro_server_CT {
 	port PIPEasp_PT PIPE;
 	var ComponentIdentity g_srv_comp_id, g_bankd_comp_id;
+	timer g_T_guard := 60.0;
 };
 
+private altstep as_Tguard() runs on client_test_CT {
+	[] g_T_guard.timeout {
+		setverdict(fail, "Timeout of T_guard");
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+		}
+}
+
 private function f_init() runs on client_test_CT {
 	g_srv_comp_id := valueof(ts_CompId(remsimServer, "ttcn-server"));
 	g_bankd_comp_id := valueof(ts_CompId(remsimBankd, "ttcn-bankd"));
 
+	/* Start the guard timer */
+	g_T_guard.start;
+	activate(as_Tguard());
+
 	f_rspro_srv_init(0, mp_server_ip, mp_server_port, g_srv_comp_id);
 	f_rspro_srv_init(1, mp_bankd_ip, mp_bankd_port, g_bankd_comp_id, exp_connect := false);
 }
diff --git a/remsim/RemsimServer_Tests.ttcn b/remsim/RemsimServer_Tests.ttcn
index d5af530..135ce15 100644
--- a/remsim/RemsimServer_Tests.ttcn
+++ b/remsim/RemsimServer_Tests.ttcn
@@ -20,6 +20,7 @@
 import from RSPRO_Types all;
 import from REMSIM_Tests all;
 
+import from Misc_Helpers all;
 import from IPA_Emulation all;
 
 import from HTTPmsg_Types all;
@@ -72,13 +73,28 @@
 }
 
 type component test_CT extends rspro_client_CT, http_CT {
+	timer g_T_guard := 60.0;
 };
 
+private altstep as_Tguard() runs on test_CT {
+	[] g_T_guard.timeout {
+		setverdict(fail, "Timeout of T_guard");
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+		}
+}
+
+private function f_init() runs on test_CT {
+	/* Start the guard timer */
+	g_T_guard.start;
+	activate(as_Tguard());
+}
+
 
 testcase TC_connect_and_nothing() runs on test_CT {
 	var ComponentIdentity rspro_id := valueof(ts_CompId(remsimClient, "foobar"));
 	timer T := 20.0;
 
+	f_init();
 	f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
 	T.start;
 	/* expect that we're disconnected if we never send a ConnectClientReq */
@@ -97,6 +113,7 @@
 	var ComponentIdentity rspro_id := valueof(ts_CompId(remsimClient, "foobar"));
 	var JsRoot js;
 
+	f_init();
 	f_rsres_init();
 	f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
 	rspro[0].rspro_client_slot := valueof(ts_ClientSlot(3,4));
@@ -120,6 +137,7 @@
 	var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, "foobar"));
 	var JsRoot js;
 
+	f_init();
 	f_rsres_init();
 	f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
 	rspro[0].rspro_bank_id := 1;
@@ -170,6 +188,7 @@
 
 /* test adding a single slotmap */
 testcase TC_slotmap_add() runs on test_CT {
+	f_init();
 	f_rsres_init();
 
 	var JsSlotmap sm := valueof(ts_JsSlotmap(ts_BankSlot(1,2), ts_ClientSlot(3,4)));
@@ -181,6 +200,7 @@
 
 /* test adding a single slotmap with out-of-range values */
 testcase TC_slotmap_add_out_of_range() runs on test_CT {
+	f_init();
 	f_rsres_init();
 
 	var HTTPMessage http_resp;
@@ -206,6 +226,8 @@
 
 /* test adding a slotmap and then connecting a client + bankd */
 testcase TC_slotmap_add_conn_cl_b() runs on test_CT {
+	f_init();
+
 	/* Simulate one client */
 	var ComponentIdentity rspro_id := valueof(ts_CompId(remsimClient, testcasename()));
 	f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
@@ -249,6 +271,8 @@
 
 /* test connecting a client and later adding a slotmap for it */
 testcase TC_conn_cl_b_slotmap_add() runs on test_CT {
+	f_init();
+
 	/* Simulate one client */
 	var ComponentIdentity rspro_id := valueof(ts_CompId(remsimClient, testcasename()));
 	f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
@@ -292,6 +316,7 @@
 
 /* simple delete of a 'NEW' slotmap */
 testcase TC_slotmap_del_new() runs on test_CT {
+	f_init();
 	f_rsres_init();
 
 	var JsSlotmap sm := valueof(ts_JsSlotmap(ts_BankSlot(1,2), ts_ClientSlot(3,4)));
@@ -303,6 +328,7 @@
 
 /* simple delete of a non-existant slotmap */
 testcase TC_slotmap_del_nonexistant() runs on test_CT {
+	f_init();
 	f_rsres_init();
 
 	var JsSlotmap sm := valueof(ts_JsSlotmap(ts_BankSlot(11,12), ts_ClientSlot(13,14)));
@@ -314,6 +340,8 @@
 /* simple delete of a 'UNACKNOWLEDGED' slotmap */
 testcase TC_slotmap_del_unack() runs on test_CT {
 	var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, testcasename()));
+
+	f_init();
 	f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
 	rspro[0].rspro_bank_id := 1;
 	rspro[0].rspro_bank_nslots := 8;
@@ -347,6 +375,8 @@
 /* simple delete of a 'ACTIVE' slotmap from server + bankd */
 testcase TC_slotmap_del_active() runs on test_CT {
 	var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, testcasename()));
+
+	f_init();
 	f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
 	rspro[0].rspro_bank_id := 1;
 	rspro[0].rspro_bank_nslots := 8;
@@ -386,6 +416,8 @@
 /* simple delete of a 'ACTIVE' slotmap from client */
 testcase TC_slotmap_del_active_client() runs on test_CT {
 	var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, testcasename()));
+
+	f_init();
 	f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
 	rspro[0].rspro_bank_id := 1;
 	rspro[0].rspro_bank_nslots := 8;
@@ -438,6 +470,8 @@
 /* Add a slotmap to a currently active bank */
 testcase TC_slotmap_add_active_bank() runs on test_CT {
 	var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, testcasename()));
+
+	f_init();
 	f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
 	rspro[0].rspro_bank_id := 1;
 	rspro[0].rspro_bank_nslots := 8;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23147
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I3897efd2a97c3e0d487057aa7bdc2967f3424dd8
Gerrit-Change-Number: 23147
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210301/29400974/attachment.htm>


More information about the gerrit-log mailing list