From 94bbe9979626c2b7c081f15776ae3d3b43ac8c73 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Tue, 23 Mar 2021 07:23:34 +0100 Subject: [PATCH] BTS_Tests: refactor and fix TC_pcu_socket_connect_multi The expectations of this test case were wrong. The IUT would first accept() an additional connection and then close() it immediately. Since there may be other messages, like TIME.ind and DATA.ind, the 'alt' statement would not match successful connection result, and instead would unblock the flow due to timeout. The titan.TestPorts.UNIX_DOMAIN_SOCKETasp had to be changed [1] to send UD_connect_result with ERROR if recv() returns zero or a negative. [1] https://github.com/eclipse/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/pull/4 Change-Id: I898b8b14515d79766b12d652ebb1ddf834e2863c --- bts/BTS_Tests.ttcn | 26 ++++++++++++++++++++------ deps/Makefile | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn index c0ec72806..555fe0c87 100644 --- a/bts/BTS_Tests.ttcn +++ b/bts/BTS_Tests.ttcn @@ -5465,25 +5465,39 @@ testcase TC_pcu_rr_suspend() runs on test_CT { /* 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__); } diff --git a/deps/Makefile b/deps/Makefile index 9057463ff..c63dca732 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -126,7 +126,7 @@ titan.TestPorts.SIPmsg_commit= R.15.A-1-ge4f9dd0 titan.TestPorts.TCPasp_commit= R.9.A-5-g2c91bc6 titan.TestPorts.TELNETasp_commit= 873fe539642542cd9a901c208f1ec11c6d2f5387 titan.TestPorts.UDPasp_commit= c20d77a34f288dd70dd4aaa30e520778876e9336 -titan.TestPorts.UNIX_DOMAIN_SOCKETasp_commit= R.2.A-8-g7ec4fe0 +titan.TestPorts.UNIX_DOMAIN_SOCKETasp_commit= R.2.A-13-gd34ab71 titan.TestPorts.USB_commit= master osmo-uecups_commit= master