Loading ttcn/LibCommon_Sync.ttcn +119 −13 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ module LibCommon_Sync { */ type component ClientSyncComp extends BaseSyncComp { var StringStack v_stateStack:= c_initStringStack; var TestcaseStep vc_testcaseStep := e_preamble; } /** Loading Loading @@ -144,6 +145,16 @@ module LibCommon_Sync { */ type port SyncPort message { inout SyncCmd } /** * @desc Describes in which step of execution is the testcase */ type enumerated TestcaseStep { e_preamble, e_testBody, e_postamble } } // end compTypeRelated group standardSyncPointNames { Loading Loading @@ -363,7 +374,7 @@ module LibCommon_Sync { * @see LibCommon_VerdictControl.f_setVerdict */ function f_selfOrClientSyncAndVerdict( in charstring p_syncPoint, in FncRetCode p_ret) in FncRetCode p_ret, in charstring p_logMessage := "" ) runs on SelfSyncComp { if ( self == mtc ) { // then assume we are running non-conurrent test case Loading @@ -384,15 +395,15 @@ module LibCommon_Sync { * as well as concurrent test cases. * @remark This function should _not_ be called if the MTC * acts as a client (and not a server) in a concurrent * test case. In this case f_clientSyncAndVerdict * test case. In this case f_clientSyncAndVerdictPreamble * should be used instead. * @param p_syncPoint Synchronization point name/id * @param p_ret Current behavior execution status * @see LibCommon_Sync.f_clientSyncAndVerdict * @see LibCommon_VerdictControl.f_setVerdictPreamble */ function f_selfOrClientSyncAndVerdictPR( in charstring p_syncPoint, in FncRetCode p_ret) function f_selfOrClientSyncAndVerdictPreamble( in charstring p_syncPoint, in FncRetCode p_ret, in charstring p_logMessage := "") runs on SelfSyncComp { if ( self == mtc ) { // then assume we are running non-conurrent test case Loading @@ -402,6 +413,46 @@ module LibCommon_Sync { } } /** * @desc Calls either self synchronization function if * invoking component is the MTC, otherwise * calls client synchronization. After that it * sets a preamble specific verdict based on the * specified return code. * This function allows to implement TTCN-3 functions * in a way that they can be used in both non-concurrent * as well as concurrent test cases. * @remark This function should _not_ be called if the MTC * acts as a client (and not a server) in a concurrent * test case. In this case f_clientSyncAndVerdictTestBody * should be used instead. * @param p_syncPoint Synchronization point name/id * @param p_ret Current behavior execution status * @see LibCommon_Sync.f_clientSyncAndVerdict * @see LibCommon_VerdictControl.f_setVerdictPreamble */ function f_selfOrClientSyncAndVerdictTestBody( in charstring p_syncPoint, in FncRetCode p_ret, in charstring p_logMessage := "") runs on SelfSyncComp { if ( self == mtc ) { // then assume we are running non-conurrent test case f_selfSyncAndVerdictTestBody(p_syncPoint, p_ret); } else { f_clientSyncAndVerdictTestBody(p_syncPoint, p_ret); } } /** * @desc Function kept for backward compatibility * @see f_selfOrClientSyncAndVerdictPreamble * */ function f_selfOrClientSyncAndVerdictPR( in charstring p_syncPoint, in FncRetCode p_ret) runs on SelfSyncComp { f_selfOrClientSyncAndVerdictPreamble(p_syncPoint, p_ret); } } // end group syncFunctions group syncCompStateHandling { Loading Loading @@ -785,6 +836,36 @@ module LibCommon_Sync { disconnect(self:syncPort, mtc:syncPort); }// end function f_disconnect4ClientSync /** * @desc This function combines client verdict setting with its * synchronization for use,e.g, after or within a * test body implementation. * Note that such premables can _not_ be reused in non- * concurrent test cases. This can be achieved by using * the f_selfOrClientSyncAndVerdict function instead. * This function sets the client component verdict. * @param p_syncId Synchronization point name/id * @param p_ret Current behavior execution status * @remark The use of this function requires prior connection * of the client sync port! * @see LibCommon_Sync.f_connect4ClientSync * @see LibCommon_Sync.f_connect4SelfOrClientSync * @see LibCommon_VerdictControl.f_setVerdict * @see LibCommon_Sync.f_selfOrClientSyncAndVerdict */ function f_clientSyncAndVerdict(in charstring p_syncId, in FncRetCode p_ret, in charstring p_logMessage := "" ) runs on ClientSyncComp { if(vc_testcaseStep == e_preamble) { f_clientSyncAndVerdictPreamble(p_syncId, p_ret); } else if(vc_testcaseStep == e_testBody) { f_clientSyncAndVerdictTestBody(p_syncId, p_ret); } else { f_clientSyncAndVerdictPostamble(p_syncId, p_ret); } } /** * @desc This function combines client verdict setting with its * synchronization for use after or within a preamble Loading @@ -801,10 +882,11 @@ module LibCommon_Sync { * @param p_ret Current behavior execution status */ function f_clientSyncAndVerdictPreamble(in charstring p_syncId , FncRetCode p_ret ) FncRetCode p_ret, in charstring p_logMessage := "" ) runs on ClientSyncComp { f_setVerdictPreamble(p_ret); f_clientSync(p_syncId,p_ret); vc_testcaseStep := e_testBody; } /** Loading @@ -824,11 +906,12 @@ module LibCommon_Sync { * @see LibCommon_VerdictControl.f_setVerdict * @see LibCommon_Sync.f_selfOrClientSyncAndVerdict */ function f_clientSyncAndVerdict(in charstring p_syncId, in FncRetCode p_ret ) function f_clientSyncAndVerdictTestBody(in charstring p_syncId, in FncRetCode p_ret, in charstring p_logMessage := "" ) runs on ClientSyncComp { f_setVerdict(p_ret); f_clientSync(p_syncId,p_ret); vc_testcaseStep := e_postamble; } /** Loading @@ -847,7 +930,7 @@ module LibCommon_Sync { * @param p_ret Current behavior execution status */ function f_clientSyncAndVerdictPostamble(in charstring p_syncId , in FncRetCode p_ret ) in FncRetCode p_ret, in charstring p_logMessage := "" ) runs on ClientSyncComp { f_setVerdictPostamble(p_ret); f_clientSync(p_syncId,p_ret); Loading Loading @@ -1001,7 +1084,7 @@ module LibCommon_Sync { /** * @desc This function combines MTC verdict setting with self * synchronization for use after and possibly in the test body * synchronization for use in the preamble / test body / postamble * @param p_syncId Synchronization point name/id * @param p_ret Current behavior execution status * @see LibCommon_VerdictControl.f_setVerdict Loading @@ -1011,8 +1094,14 @@ module LibCommon_Sync { function f_selfSyncAndVerdict( in charstring p_syncId, in FncRetCode p_ret ) runs on SelfSyncComp { f_setVerdict(p_ret); f_selfSync(p_syncId,p_ret); if(vc_testcaseStep == e_preamble) { f_selfSyncAndVerdictPreamble(p_syncId, p_ret); } else if(vc_testcaseStep == e_testBody) { f_selfSyncAndVerdictTestBody(p_syncId, p_ret); } else { f_selfSyncAndVerdictPostamble(p_syncId, p_ret); } } /** Loading @@ -1026,8 +1115,25 @@ module LibCommon_Sync { function f_selfSyncAndVerdictPreamble( in charstring p_syncId, in FncRetCode p_ret ) runs on SelfSyncComp { f_setVerdictPreamble(p_ret); f_setVerdictPreOrPostamble(p_ret); f_selfSync(p_syncId,p_ret); vc_testcaseStep := e_testBody; } /** * @desc This function combines MTC verdict setting with self * synchronization for use after the test body. * @param p_syncId Synchronization point name/id * @param p_ret Current behavior execution status * @see LibCommon_VerdictControl.f_setVerdict * @see LibCommon_Sync.f_selfSync */ function f_selfSyncAndVerdictTestBody( in charstring p_syncId, in FncRetCode p_ret ) runs on SelfSyncComp { f_setVerdict(p_ret); f_selfSync(p_syncId,p_ret); vc_testcaseStep := e_postamble; } /** Loading @@ -1041,7 +1147,7 @@ module LibCommon_Sync { function f_selfSyncAndVerdictPostamble( in charstring p_syncId , in FncRetCode p_ret ) runs on SelfSyncComp { f_setVerdictPostamble(p_ret); f_setVerdictPreOrPostamble(p_ret); f_selfSync(p_syncId,p_ret); } Loading ttcn/LibCommon_VerdictControl.ttcn +2 −4 Original line number Diff line number Diff line Loading @@ -81,14 +81,12 @@ * @desc This function should be used for verdict * setting outside the test body. * Sets verdicts are INCONC in case of a timeout or * an error, and PASS otherwise. * an error * @param p_ret Postamble execution status */ function f_setVerdictPreOrPostamble ( FncRetCode p_ret ) { if ( p_ret != e_success ) { setverdict(inconc); } else { setverdict(pass); } } // end function f_setVerdictPreOrPostamble Loading Loading
ttcn/LibCommon_Sync.ttcn +119 −13 Original line number Diff line number Diff line Loading @@ -113,6 +113,7 @@ module LibCommon_Sync { */ type component ClientSyncComp extends BaseSyncComp { var StringStack v_stateStack:= c_initStringStack; var TestcaseStep vc_testcaseStep := e_preamble; } /** Loading Loading @@ -144,6 +145,16 @@ module LibCommon_Sync { */ type port SyncPort message { inout SyncCmd } /** * @desc Describes in which step of execution is the testcase */ type enumerated TestcaseStep { e_preamble, e_testBody, e_postamble } } // end compTypeRelated group standardSyncPointNames { Loading Loading @@ -363,7 +374,7 @@ module LibCommon_Sync { * @see LibCommon_VerdictControl.f_setVerdict */ function f_selfOrClientSyncAndVerdict( in charstring p_syncPoint, in FncRetCode p_ret) in FncRetCode p_ret, in charstring p_logMessage := "" ) runs on SelfSyncComp { if ( self == mtc ) { // then assume we are running non-conurrent test case Loading @@ -384,15 +395,15 @@ module LibCommon_Sync { * as well as concurrent test cases. * @remark This function should _not_ be called if the MTC * acts as a client (and not a server) in a concurrent * test case. In this case f_clientSyncAndVerdict * test case. In this case f_clientSyncAndVerdictPreamble * should be used instead. * @param p_syncPoint Synchronization point name/id * @param p_ret Current behavior execution status * @see LibCommon_Sync.f_clientSyncAndVerdict * @see LibCommon_VerdictControl.f_setVerdictPreamble */ function f_selfOrClientSyncAndVerdictPR( in charstring p_syncPoint, in FncRetCode p_ret) function f_selfOrClientSyncAndVerdictPreamble( in charstring p_syncPoint, in FncRetCode p_ret, in charstring p_logMessage := "") runs on SelfSyncComp { if ( self == mtc ) { // then assume we are running non-conurrent test case Loading @@ -402,6 +413,46 @@ module LibCommon_Sync { } } /** * @desc Calls either self synchronization function if * invoking component is the MTC, otherwise * calls client synchronization. After that it * sets a preamble specific verdict based on the * specified return code. * This function allows to implement TTCN-3 functions * in a way that they can be used in both non-concurrent * as well as concurrent test cases. * @remark This function should _not_ be called if the MTC * acts as a client (and not a server) in a concurrent * test case. In this case f_clientSyncAndVerdictTestBody * should be used instead. * @param p_syncPoint Synchronization point name/id * @param p_ret Current behavior execution status * @see LibCommon_Sync.f_clientSyncAndVerdict * @see LibCommon_VerdictControl.f_setVerdictPreamble */ function f_selfOrClientSyncAndVerdictTestBody( in charstring p_syncPoint, in FncRetCode p_ret, in charstring p_logMessage := "") runs on SelfSyncComp { if ( self == mtc ) { // then assume we are running non-conurrent test case f_selfSyncAndVerdictTestBody(p_syncPoint, p_ret); } else { f_clientSyncAndVerdictTestBody(p_syncPoint, p_ret); } } /** * @desc Function kept for backward compatibility * @see f_selfOrClientSyncAndVerdictPreamble * */ function f_selfOrClientSyncAndVerdictPR( in charstring p_syncPoint, in FncRetCode p_ret) runs on SelfSyncComp { f_selfOrClientSyncAndVerdictPreamble(p_syncPoint, p_ret); } } // end group syncFunctions group syncCompStateHandling { Loading Loading @@ -785,6 +836,36 @@ module LibCommon_Sync { disconnect(self:syncPort, mtc:syncPort); }// end function f_disconnect4ClientSync /** * @desc This function combines client verdict setting with its * synchronization for use,e.g, after or within a * test body implementation. * Note that such premables can _not_ be reused in non- * concurrent test cases. This can be achieved by using * the f_selfOrClientSyncAndVerdict function instead. * This function sets the client component verdict. * @param p_syncId Synchronization point name/id * @param p_ret Current behavior execution status * @remark The use of this function requires prior connection * of the client sync port! * @see LibCommon_Sync.f_connect4ClientSync * @see LibCommon_Sync.f_connect4SelfOrClientSync * @see LibCommon_VerdictControl.f_setVerdict * @see LibCommon_Sync.f_selfOrClientSyncAndVerdict */ function f_clientSyncAndVerdict(in charstring p_syncId, in FncRetCode p_ret, in charstring p_logMessage := "" ) runs on ClientSyncComp { if(vc_testcaseStep == e_preamble) { f_clientSyncAndVerdictPreamble(p_syncId, p_ret); } else if(vc_testcaseStep == e_testBody) { f_clientSyncAndVerdictTestBody(p_syncId, p_ret); } else { f_clientSyncAndVerdictPostamble(p_syncId, p_ret); } } /** * @desc This function combines client verdict setting with its * synchronization for use after or within a preamble Loading @@ -801,10 +882,11 @@ module LibCommon_Sync { * @param p_ret Current behavior execution status */ function f_clientSyncAndVerdictPreamble(in charstring p_syncId , FncRetCode p_ret ) FncRetCode p_ret, in charstring p_logMessage := "" ) runs on ClientSyncComp { f_setVerdictPreamble(p_ret); f_clientSync(p_syncId,p_ret); vc_testcaseStep := e_testBody; } /** Loading @@ -824,11 +906,12 @@ module LibCommon_Sync { * @see LibCommon_VerdictControl.f_setVerdict * @see LibCommon_Sync.f_selfOrClientSyncAndVerdict */ function f_clientSyncAndVerdict(in charstring p_syncId, in FncRetCode p_ret ) function f_clientSyncAndVerdictTestBody(in charstring p_syncId, in FncRetCode p_ret, in charstring p_logMessage := "" ) runs on ClientSyncComp { f_setVerdict(p_ret); f_clientSync(p_syncId,p_ret); vc_testcaseStep := e_postamble; } /** Loading @@ -847,7 +930,7 @@ module LibCommon_Sync { * @param p_ret Current behavior execution status */ function f_clientSyncAndVerdictPostamble(in charstring p_syncId , in FncRetCode p_ret ) in FncRetCode p_ret, in charstring p_logMessage := "" ) runs on ClientSyncComp { f_setVerdictPostamble(p_ret); f_clientSync(p_syncId,p_ret); Loading Loading @@ -1001,7 +1084,7 @@ module LibCommon_Sync { /** * @desc This function combines MTC verdict setting with self * synchronization for use after and possibly in the test body * synchronization for use in the preamble / test body / postamble * @param p_syncId Synchronization point name/id * @param p_ret Current behavior execution status * @see LibCommon_VerdictControl.f_setVerdict Loading @@ -1011,8 +1094,14 @@ module LibCommon_Sync { function f_selfSyncAndVerdict( in charstring p_syncId, in FncRetCode p_ret ) runs on SelfSyncComp { f_setVerdict(p_ret); f_selfSync(p_syncId,p_ret); if(vc_testcaseStep == e_preamble) { f_selfSyncAndVerdictPreamble(p_syncId, p_ret); } else if(vc_testcaseStep == e_testBody) { f_selfSyncAndVerdictTestBody(p_syncId, p_ret); } else { f_selfSyncAndVerdictPostamble(p_syncId, p_ret); } } /** Loading @@ -1026,8 +1115,25 @@ module LibCommon_Sync { function f_selfSyncAndVerdictPreamble( in charstring p_syncId, in FncRetCode p_ret ) runs on SelfSyncComp { f_setVerdictPreamble(p_ret); f_setVerdictPreOrPostamble(p_ret); f_selfSync(p_syncId,p_ret); vc_testcaseStep := e_testBody; } /** * @desc This function combines MTC verdict setting with self * synchronization for use after the test body. * @param p_syncId Synchronization point name/id * @param p_ret Current behavior execution status * @see LibCommon_VerdictControl.f_setVerdict * @see LibCommon_Sync.f_selfSync */ function f_selfSyncAndVerdictTestBody( in charstring p_syncId, in FncRetCode p_ret ) runs on SelfSyncComp { f_setVerdict(p_ret); f_selfSync(p_syncId,p_ret); vc_testcaseStep := e_postamble; } /** Loading @@ -1041,7 +1147,7 @@ module LibCommon_Sync { function f_selfSyncAndVerdictPostamble( in charstring p_syncId , in FncRetCode p_ret ) runs on SelfSyncComp { f_setVerdictPostamble(p_ret); f_setVerdictPreOrPostamble(p_ret); f_selfSync(p_syncId,p_ret); } Loading
ttcn/LibCommon_VerdictControl.ttcn +2 −4 Original line number Diff line number Diff line Loading @@ -81,14 +81,12 @@ * @desc This function should be used for verdict * setting outside the test body. * Sets verdicts are INCONC in case of a timeout or * an error, and PASS otherwise. * an error * @param p_ret Postamble execution status */ function f_setVerdictPreOrPostamble ( FncRetCode p_ret ) { if ( p_ret != e_success ) { setverdict(inconc); } else { setverdict(pass); } } // end function f_setVerdictPreOrPostamble Loading