diff --git a/test/HostAdmin/EPTF_HostAdmin_Test_Testcases.ttcn b/test/HostAdmin/EPTF_HostAdmin_Test_Testcases.ttcn index 561629629670b41065043f21f1a00075f8840b2c..931de2542fbdeace17992cd38ce3c7b48a131f3e 100644 --- a/test/HostAdmin/EPTF_HostAdmin_Test_Testcases.ttcn +++ b/test/HostAdmin/EPTF_HostAdmin_Test_Testcases.ttcn @@ -1412,6 +1412,70 @@ group HostAdminServer { f_EPTF_Base_stop(pass); } + /////////////////////////////////////////////////////////// + // Testcase: tc_HostAdminServer_hostStat_received_before_subscribeRemote_returns_MultiHostTest + // + // Purpose: + // This is a manual test!!! + // It tests if the TR 1969069 is corrected. + // + // It checks if as_EPTF_HostAdminServer_eventHandler runs into a DTE "Error: EPTF_Var: EPTF_Var[-1] has invalid content" + // when a hostStat is receved from a host that has ongoing subscribeRemote to it + // + // To run the testcase: + // Build the project on tcclab8 (Terminal 1) + // + // On tcclab8 (Terminal 1): + // HOSTNAME=$HOSTNAME mctr_cli EPTF_HostAdmin_Test.cfg + // + // On tcclab7 (Terminal 2): + // ./EPTF_HostAdmin_demo tcclab8 <portNo> + // <portNo> is the port number printed by mctr_cli + // ./EPTF_HostAdmin_demo is the name of the compiled executable + // + // then on tcclab8 (Terminal 3): + // ./EPTF_HostAdmin_demo tcclab8 <portNo> + // + // then inside mctr_cli (Terminal 1): + // cmtc + // smtc EPTF_HostAdmin_Test_Testcases.tc_HostAdminServer_hostStat_received_before_subscribeRemote_returns_MultiHostTest + // Wait until the testcase finishes. Then type + // exit + // The testcase should pass + // + /////////////////////////////////////////////////////////// + testcase tc_HostAdminServer_hostStat_received_before_subscribeRemote_returns_MultiHostTest() + runs on SYSTEM2_CT + { + var integer i := 0; + f_EPTF_HostAdminServer_init_CT("MTC", mtc); + + f_start_delay_var_component(); + // start component on different host + // => when it is started the altstep as_EPTF_HostAdminServer_eventHandler is active + // when host update timer T_EPTF_HostAdminServer_refreshProcessList times out, the altstep is activated and in f_EPTF_HostAdminServer_getOrStartClient + // if subsribeRemote is blocked and hostStat arrives from the new host => will cause "Error: EPTF_Var: EPTF_Var[-1] has invalid content" + + for(i:=0;i<lengthof(tsp_StartProcessesWithLoad);i:=i+1) { + var EPTF_Base_CT vl_load; + if(ispresent(tsp_StartProcessesWithLoad[i].hostName)) { + var charstring vl_bugfix := tsp_StartProcessesWithLoad[i].hostName; // TITAN 1.8.pl6 bug, see HO69261 + vl_load := EPTF_Base_CT.create(-, vl_bugfix); + } else { + vl_load := EPTF_Base_CT.create; + } + vl_load.start(f_demo_load("load_"&int2str(i), tsp_StartProcessesWithLoad[i].desiredLoad)); + } + + timer T2 := tsp_demoInterval; + T2.start; + T2.timeout; + + //f_checkVariables(); + + f_EPTF_Base_stop(pass); + } + group MultiHostTest_Manual { @@ -3139,6 +3203,52 @@ runs on EPTF_Base_CT } +function f_varTrigger_behaviour(in charstring pl_remoteVarName, in EPTF_HostAdminServer_CT pl_hostadmin_compref) runs on EPTF_Var_CT { + f_EPTF_Var_init_CT("VarTrigger_" & log2str(self)); + var integer vl_idx; + f_EPTF_Var_subscribeRemote( + pl_remoteCompRef := pl_hostadmin_compref, + pl_remoteProviderVarName := pl_remoteVarName, + pl_subscriptionMode:=sampledAtSync, + pl_idx := vl_idx + ) + var integer vl_dummy_value := str2int(log2str(self)); + timer t_wait := 1.0; + t_wait.start; + var integer vl_counter := 0; + alt { + [vl_counter<5] t_wait.timeout { + f_EPTF_Var_adjustContent(vl_idx,{intVal := vl_counter}) + t_wait.start; + vl_counter := vl_counter + 1; + repeat; + } + } + f_EPTF_Base_stop(pass); +} + +function f_delay_postproc_fn(in integer pl_idx, in EPTF_IntegerList pl_argList) runs on SYSTEM2_CT { + // delay execution for 2.0 sec: + timer t_wait := 2.0; + t_wait.start; t_wait.timeout; +} + +function f_start_delay_var_component() runs on SYSTEM2_CT { + // starts a component, to periodically trigger variable events on the hostAdmin_server by subscribing and adjusting remote variable + // The variable postproc is blocking the execution of the current alt-step + const charstring cl_dummyVarName := "DummyToAdjust"; + f_EPTF_Var_init_CT("MTC"); + var integer vl_idx := f_EPTF_Var_newVar(cl_dummyVarName, {intVal:=0}) + f_EPTF_Var_addPostProcFn(vl_idx,{refers(f_delay_postproc_fn), {}}); + + var EPTF_Var_CT vl_component := EPTF_Var_CT.create; + vl_component.start(f_varTrigger_behaviour(cl_dummyVarName, self)); + + // wait until components start up and generate load + timer t_wait := 2.0; + t_wait.start; t_wait.timeout; +} + } // group HostAdminServer