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
This commit is contained in:
Harald Welte 2020-12-09 14:33:18 +01:00
parent 158becf9cb
commit 425d376387
1 changed files with 11 additions and 4 deletions

View File

@ -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);