Change in osmo-ttcn3-hacks[master]: BTS_Tests: refactor and fix TC_pcu_socket_connect_multi

fixeria gerrit-no-reply at lists.osmocom.org
Tue Mar 23 06:27:03 UTC 2021


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23466 )


Change subject: BTS_Tests: refactor and fix TC_pcu_socket_connect_multi
......................................................................

BTS_Tests: refactor and fix TC_pcu_socket_connect_multi

Change-Id: I898b8b14515d79766b12d652ebb1ddf834e2863c
---
M bts/BTS_Tests.ttcn
1 file changed, 20 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/66/23466/1

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 58947c5..a5eff00 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -5465,25 +5465,39 @@
 
 /* Ensure that PCUIF socket can accept only a single connection */
 testcase TC_pcu_socket_connect_multi() runs on test_CT {
+	var boolean connected := false;
+	var UD_connect_result cr;
+	var integer cid;
 	timer T := 5.0;
 
+	var template UD_Result tr_ok := { result_code := SUCCESS, err := omit };
+	var template UD_Result tr_err := { result_code := ERROR, err := ? };
+
 	/* this (among other things) establishes the first connection to the PCUIF socket */
 	f_init_with_pcuif();
 
-	/* try to establish a second connection, expect it to fail */
+	/* try to establish a second connection */
 	PCU.send(UD_connect:{mp_pcu_socket, -1});
 	T.start;
 	alt {
-	[] PCU.receive(UD_connect_result:{id := ?, result := { result_code := ERROR, err := ? }}) {
+	/* the IUT will first accept() the new connection, and close() it immediately */
+	[not connected] PCU.receive(UD_connect_result:{ id := ?, result := tr_ok }) -> value cr {
+		log("BTS has accept()ed connection");
+		connected := true;
+		cid := cr.id;
+		repeat;
+		}
+	[connected] PCU.receive(UD_connect_result:{ id := cid, result := tr_err }) {
+		log("BTS has close()d connection");
 		setverdict(pass);
 		}
-	[] PCU.receive(UD_connect_result:?) {
-		setverdict(fail, "Unexpected unix domain connect result");
-		}
+	/* ignore other messages related to the first connection */
+	[] PCU.receive { repeat; }
 	[] T.timeout {
-		setverdict(pass);
+		setverdict(fail, "Timeout waiting for connection result");
 		}
 	}
+
 	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23466
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: I898b8b14515d79766b12d652ebb1ddf834e2863c
Gerrit-Change-Number: 23466
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210323/f35cb6b3/attachment.htm>


More information about the gerrit-log mailing list