Commit 0c6f24fc authored by kremer's avatar kremer
Browse files

Added a new component (BaseSyncComp) as a base for all synchronization components.

Added a new function that can synchronize any number of components.
parent 8c1dcff8
Loading
Loading
Loading
Loading
+60 −6
Original line number Original line Diff line number Diff line
@@ -66,6 +66,22 @@ module Common_Sync {


      group compTypeRelated {
      group compTypeRelated {


        /*
         * @desc  This type is used to be the base of any synchronization
         *        behavior which is to be executed on a sync server
         *        component. The test component which acts as a
         *        sync server in a test case must NOT directly use
         *        this component type in its runs on clause!
         *        Note that server synchronization functions may be
         *        invoked by a test component as long as its
         *        component type is type compatible to this component
         *        type definition!
         */
        type component BaseSyncComp {
          port  SyncPort syncPort;
          timer tc_sync := PX_TSYNC_TIME_LIMIT;
        }

        /*
        /*
         * @desc  This type is used to define any synchronization
         * @desc  This type is used to define any synchronization
         *        behavior which is to be executed on a sync server
         *        behavior which is to be executed on a sync server
@@ -79,10 +95,11 @@ module Common_Sync {
         *        type definition!
         *        type definition!
         */
         */
        type component ServerSyncComp {
        type component ServerSyncComp {
          timer tc_shutDown := PX_TSHUT_DOWN_TIME_LIMIT;
		  // definitions for BaseSyncComp
          port  SyncPort syncPort;
          port  SyncPort syncPort;
          timer tc_sync := PX_TSYNC_TIME_LIMIT;
          timer tc_sync := PX_TSYNC_TIME_LIMIT;
          timer tc_shutDown := PX_TSHUT_DOWN_TIME_LIMIT;
        } with { extension "extends BaseSyncComp" }
        }


        /*
        /*
         * @desc  This type is used to define any synchronization
         * @desc  This type is used to define any synchronization
@@ -98,9 +115,10 @@ module Common_Sync {
         */
         */
        type component ClientSyncComp {
        type component ClientSyncComp {
          var StringStack v_stateStack:= c_initStringStack;
          var StringStack v_stateStack:= c_initStringStack;
		  // definitions for BaseSyncComp
          port  SyncPort syncPort;
          port  SyncPort syncPort;
          timer tc_sync := PX_TSYNC_TIME_LIMIT;
          timer tc_sync := PX_TSYNC_TIME_LIMIT;
        }
        } with { extension "extends BaseSyncComp" }


        /*
        /*
         * @desc  This type is used to define any synchronization
         * @desc  This type is used to define any synchronization
@@ -117,11 +135,12 @@ module Common_Sync {
         * @see   Common_Sync.ClientSyncComp
         * @see   Common_Sync.ClientSyncComp
         */
         */
        type component SelfSyncComp {
        type component SelfSyncComp {
          var StringStack v_stateStack:= c_initStringStack;
          port SyncPort syncSendPort;
          port SyncPort syncSendPort;
		  // definitions for ClientSyncComp
          var StringStack v_stateStack:= c_initStringStack;
          port SyncPort syncPort;
          port SyncPort syncPort;
          timer tc_sync := PX_TSYNC_TIME_LIMIT;
          timer tc_sync := PX_TSYNC_TIME_LIMIT;
        }
        } with { extension "extends ClientSyncComp" }


        /*
        /*
         * @desc  This port type must be imported into test suites
         * @desc  This port type must be imported into test suites
@@ -252,6 +271,41 @@ module Common_Sync {
        f_serverWaitForAllClientsToStop();
        f_serverWaitForAllClientsToStop();
      }
      }


      /* @desc   Implements synchronization of N clients from server side
       *         on one or more synchronization points.
       *         If problem occurs, then server sends STOP to all clients.
       *         Waits for PX_TSYNC_TIME_LIMIT to let clients
       *         finish executing their behavior until this
       *         synchronization point. After passing all synchronization
       *         points successfuly the server waits for all clients
       *         to stop.
       *         See f_serverSyncClientsTimed for overwriting this
       *         the timing constraint!
       *         This function sets the server component verdict.
       * @remark The use of this function requires prior connection  of
       *         the server sync ports!
       * @see    Common_Sync.f_connect4SelfOrClientSync
       * @see    Common_Sync.PX_TSYNC_TIME_LIMIT
       * @see    Common_Sync.f_serverSyncClientsTimed
       * @see    Common_Sync.f_serverWaitForAllClientsToStop
       * @param  p_numClients number of synchronization clients
       * @param  p_syncPointIds list of synchronization point name/ids
       * @return execution status
       */
      function f_serverSyncNClientsAndStop ( 
      	in integer p_numClients,
      	in SyncPointList p_syncPointIds )
      runs on ServerSyncComp {
        var integer i, v_noOfSyncIds := sizeof(p_syncPointIds);
        for ( i := 0; i < v_noOfSyncIds; i := i+1 ) {
          f_serverSyncClientsTimed (
          	p_numClients,
          	p_syncPointIds[i],
          	PX_TSYNC_TIME_LIMIT );
        }
        f_serverWaitForAllClientsToStop();
      }

      /* @desc   Implements synchronization of 2 clients and 1 UT from server side
      /* @desc   Implements synchronization of 2 clients and 1 UT from server side
       *         on one or more synchronization points.
       *         on one or more synchronization points.
       *         If problem occurs, then server sends STOP to all clients.
       *         If problem occurs, then server sends STOP to all clients.