From 425d3763873ee6e5b0cf42e09659dda604e78a8b Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 9 Dec 2020 14:33:18 +0100 Subject: [PATCH] gbproxy: Introduce global guard timer in test_CT We did have a guard time in each ConnHdlr, but not in the MTC (test_CT). However, we do have tests that don't use any ConnHdlr, and those were so far ran without a guard timeout. Fix that. Change-Id: Iee90fc26a151c692d3c6f3eb6ad80f528f8d939f --- gbproxy/GBProxy_Tests.ttcn | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn index a2055ea37..7811a0109 100644 --- a/gbproxy/GBProxy_Tests.ttcn +++ b/gbproxy/GBProxy_Tests.ttcn @@ -279,6 +279,7 @@ type component test_CT { var boolean g_use_echo := false; var ro_integer g_roi := {}; + timer g_Tguard; }; type component BSSGP_ConnHdlr { @@ -414,7 +415,7 @@ private function ro_integer_contains(ro_integer r, integer x) return boolean { return false; } -function f_init() runs on test_CT { +function f_init(float t_guard := 30.0) runs on test_CT { var ro_integer bvci_unblocked := {}; var BssgpStatusIndication bsi; var integer i; @@ -424,6 +425,9 @@ function f_init() runs on test_CT { } g_initialized := true; + g_Tguard.start(t_guard); + activate(as_gTguard(g_Tguard)); + g_sgsn[0].cfg := { nsei := mp_nsconfig_sgsn[0].nsei, sgsn_role := true, @@ -503,6 +507,9 @@ function f_init() runs on test_CT { mtc.stop; } } + + /* re-start guard timer after all BVCs are up, so it only counts the actual test case */ + g_Tguard.start(t_guard); } function f_cleanup() runs on test_CT { @@ -574,8 +581,8 @@ private function f_connect_to_sgsn_bvc(integer port_idx, BSSGP_BVC_CT bvc_ct) ru sgsn_ct[port_idx] := bvc_ct; } -private altstep as_Tguard() runs on BSSGP_ConnHdlr { - [] g_Tguard.timeout { +private altstep as_gTguard(timer Tguard) { + [] Tguard.timeout { setverdict(fail, "Tguard timeout"); mtc.stop; } @@ -601,7 +608,7 @@ runs on BSSGP_ConnHdlr { } g_Tguard.start(pars.t_guard); - activate(as_Tguard()); + activate(as_gTguard(g_Tguard)); /* call the user-supplied test case function */ fn.apply(id);