30 static struct timespec oneMs = {0,1000000};
33 static struct timespec tenMs = {0,10000000};
36 static struct timespec nineMs = {0,9000000};
39 static struct timespec hundredMs = {0,100000000};
42 #define N_NOTIFY2 10000 51 static void* TestCaseStressRun_Notify1(
void* rtDesc);
60 static void* TestCaseStressRun_Notify2(
void* rtDesc);
121 pthread_attr_t tattr;
122 pthread_mutexattr_t mattr;
123 pthread_condattr_t cattr;
562 nanosleep(&tenMs,NULL);
584 nanosleep(&tenMs,NULL);
612 nanosleep(&tenMs,NULL);
640 nanosleep(&tenMs,NULL);
728 nanosleep(&tenMs,NULL);
750 nanosleep(&tenMs,NULL);
778 nanosleep(&tenMs,NULL);
881 nanosleep(&tenMs,NULL);
964 nanosleep(&oneMs,NULL);
965 nanosleep(&oneMs,NULL);
966 nanosleep(&oneMs,NULL);
1034 for (i=1; i<10000; i++) {
1035 if (rand()<RAND_MAX/2)
1036 nanosleep(&oneMs,NULL);
1041 nanosleep(&hundredMs,NULL);
1087 int i, nStartStopCycles;
1107 nStartStopCycles = 0;
1108 for (i=1; i<10000; i++) {
1109 if (rand()<RAND_MAX/2)
1110 nanosleep(&oneMs,NULL);
1147 if (rand()<RAND_MAX/99) {
1197 int i, nStartStopCycles;
1198 pthread_t notifThread;
1219 pthread_create( ¬ifThread, NULL, TestCaseStressRun_Notify1, rtDesc);
1220 nStartStopCycles = 1;
1222 for (i=0; i<10000; i++) {
1223 if (rand()<RAND_MAX/20) {
1228 pthread_join(notifThread,status);
1254 pthread_create( ¬ifThread, NULL, TestCaseStressRun_Notify1, rtDesc);
1263 pthread_join(notifThread,status);
1279 int i, nStartStopCycles;
1280 pthread_t notifThread1, notifThread2;
1292 pthread_create( ¬ifThread1, NULL, TestCaseStressRun_Notify2, rtDesc);
1293 pthread_create( ¬ifThread2, NULL, TestCaseStressRun_Notify2, rtDesc);
1294 nStartStopCycles = 0;
1296 for (i=0; i<20; i++) {
1327 pthread_join(notifThread1,status);
1328 pthread_join(notifThread2,status);
1344 pthread_t notifThread1, notifThread2;
1360 pthread_create( ¬ifThread1, NULL, TestCaseStressRun_Notify2, rtDesc);
1361 pthread_create( ¬ifThread2, NULL, TestCaseStressRun_Notify2, rtDesc);
1364 pthread_join(notifThread1,status);
1365 pthread_join(notifThread2,status);
1421 int i, nStartStopCycles;
1422 pthread_t notifThread1, notifThread2;
1436 nStartStopCycles = 1;
1439 pthread_create( ¬ifThread1, NULL, TestCaseStressRun_Notify2, rtDesc);
1440 pthread_create( ¬ifThread2, NULL, TestCaseStressRun_Notify2, rtDesc);
1442 for (i=0; i<10000; i++) {
1443 if (rand()<RAND_MAX/2)
1444 nanosleep(&oneMs,NULL);
1445 if (rand()<RAND_MAX/99) {
1473 pthread_join(notifThread1,status);
1474 pthread_join(notifThread2,status);
1485 void* TestCaseStressRun_Notify1(
void* rtDesc) {
1487 for (i=1; i<10000; i++) {
1488 if (rand()<RAND_MAX/2)
1489 nanosleep(&nineMs,NULL);
1498 void* TestCaseStressRun_Notify2(
void* rtDesc) {
1501 if (rand()<RAND_MAX/2)
1502 nanosleep(&oneMs,NULL);
void * rtData
The pointer to the RT Container data.
void FwRtSetInitializeActivPr(FwRtDesc_t rtDesc, FwRtAction_t initializeActivPr)
Define the function implementing the Initialization Action for the Activation Procedure.
Declaration of the test cases for the RT Container Module.
int apImplActivLogicCounter
Counter increment by the Implement Activation Logic Action.
FwRtDesc_t FwRtMakeTestRT3(unsigned int i)
This function resets the i-th instance of the Test RT Container RT3 and returns a pointer to its desc...
FwRtOutcome_t InitializeNotifPr(FwRtDesc_t rtDesc)
Dummy procedure action function.
FwRtTestOutcome_t FwRtTestCaseRun3()
Verify the logic to handle a container stop request while notifications are pending.
void FwRtSetPosixAttr(FwRtDesc_t rtDesc, pthread_attr_t *pThreadAttr, pthread_mutexattr_t *pMutexAttr, pthread_condattr_t *pCondAttr)
Set the pointers to the attribute objects of the POSIX thread, mutex and condition variable used by t...
Declaration of the API for a RT Container.
FwRtOutcome_t FinalizeNotifPr(FwRtDesc_t rtDesc)
Dummy procedure action function.
FwRtTestOutcome_t FwRtTestCaseSetAction1()
Verify the action setting interface of a RT Container.
Header file to define all constants and types for the RT Container Module of the FW Profile...
The RT Container is in state STOPPED.
FwRtAction_t initializeNotifPr
Pointer to the function encapsulating the initialization action for the Notification Procedure...
FwRtDesc_t FwRtMakeTestRT5(unsigned int i)
This function resets the i-th instance of the Test RT Container RT5 and returns a pointer to its desc...
FwRtOutcome_t apExecFuncBehaviourFlag
Flag determining the outcome of the Execute Functional Behaviour Action.
void FwRtNotify(FwRtDesc_t rtDesc)
Execute the Notification Procedure of a RT Container.
int apSetupNotifCounter
Counter incremented by the Setup Notification Action.
FwRtOutcome_t ImplementActivLogic(FwRtDesc_t rtDesc)
Dummy procedure action function.
FwRtDesc_t FwRtMakeTestRT1(unsigned int i)
This function resets the i-th instance of the Test RT Container RT1 and returns a pointer to its desc...
void FwRtSetImplementActivLogic(FwRtDesc_t rtDesc, FwRtAction_t implementActivLogic)
Define the function implementing the activation logic for the RT Container.
void FwRtSetInitializeNotifPr(FwRtDesc_t rtDesc, FwRtAction_t initializeNotifPr)
Define the function implementing the Initialization Action for the Notification Procedure.
FwRtTestOutcome_t FwRtTestCaseRunNonNullAttr1()
Verify a nominal run of the RT Container with non-NULL values for the attributes of the POSIX objects...
FwRtAction_t implementNotifLogic
Pointer to the function encapsulating the implementation of the notification logic.
pthread_condattr_t * FwRtGetCondAttr(FwRtDesc_t rtDesc)
Get the value of the attributes of the condition variable associated to the RT Container.
void FwRtReset(FwRtDesc_t rtDesc)
Reset the RT Container descriptor (RTD).
FwRtTestOutcome_t FwRtTestCaseStressRun3()
Verify the RT Container logic in a stress test where two different threads send random sequences of n...
FwRtOutcome_t SetUpNotification(FwRtDesc_t rtDesc)
Dummy procedure action function.
FwRtAction_t finalizeActivPr
Pointer to the function encapsulating the finalization action for the Activation Procedure.
int apFinalCounter
Counter incremented by the Finalization Action of the Activation Procedure.
FwRtOutcome_t InitializeActivPr(FwRtDesc_t rtDesc)
Dummy procedure action function.
FwRtAction_t implementActivLogic
Pointer to the function encapsulating the implementation of the activation logic. ...
FwRtTestOutcome_t FwRtTestCaseRunDefault1()
Verify a nominal run of the RT Container with default configuration.
FwRtOutcome_t(* FwRtAction_t)(FwRtDesc_t)
Type for a pointer to a container action.
FwRtTestOutcome_t FwRtTestCaseStressRun5()
Verify the RT Container logic in a stress test where two threads send random sequences of notificatio...
void FwRtSetFinalizeActivPr(FwRtDesc_t rtDesc, FwRtAction_t finalizeActivPr)
Define the function implementing the Finalization Action for the Activation Procedure.
FwRtOutcome_t FinalizeActivPr(FwRtDesc_t rtDesc)
Dummy procedure action function.
void FwRtWaitForTermination(FwRtDesc_t rtDesc)
Blocking function which returns when the Activation Thread has terminated.
void FwRtStop(FwRtDesc_t rtDesc)
Stop a RT Container.
void FwRtShutdown(FwRtDesc_t rtDesc)
Shutdown the RT Container.
FwRtAction_t setUpNotification
Pointer to the function encapsulating the logic to set up the notification for the RT Container...
FwRtAction_t execFuncBehaviour
Pointer to the function encapsulating the execution of the functional behaviour associated to the RT ...
int FwRtGetErrCode(FwRtDesc_t rtDesc)
Return the error code of the RT Container.
void FwRtStart(FwRtDesc_t rtDesc)
Start a RT Container.
The RT Container has not yet been initialized.
FwRtState_t FwRtGetContState(FwRtDesc_t rtDesc)
Return the RT Container state.
FwRtTestOutcome_t FwRtTestCaseStressRun2()
Verify the RT Container logic in a stress test with a long sequences of notifications and start/stop ...
struct FwRtDesc * FwRtDesc_t
Forward declaration for the pointer to a RT Container Descriptor.
int apExecFuncBehaviourCounter
Counter incremented by the Execute Functional Behaviour Action.
pthread_mutexattr_t * FwRtGetMutexAttr(FwRtDesc_t rtDesc)
Get the value of the attributes of the mutex associated to the RT Container.
void FwRtSetImplementNotifLogic(FwRtDesc_t rtDesc, FwRtAction_t implementNotifLogicPr)
Define the function implementing the Notification Logic for the Notification Procedure.
Type for the data structure passed to all RT Containers made by the functions declared by this header...
int npInitCounter
Counter incremented by the Initialization Action of the Notification Procedure.
void FwRtSetSetUpNotif(FwRtDesc_t rtDesc, FwRtAction_t setUpNotification)
Define the function implementing the logic to set up a notification for the RT Container.
FwRtTestOutcome_t FwRtTestCaseRun2()
Verify the logic to handle bursts of notifications.
FwRtOutcome_t apImplActivLogicFlag
Flag determining outcome of Implement Activation Logic Action.
FwRtOutcome_t ExecFuncBehaviour(FwRtDesc_t rtDesc)
Dummy procedure action function.
Declaration of functions to create and configure test RT Containers.
FwRtOutcome_t ImplementNotifLogicPr(FwRtDesc_t rtDesc)
Dummy procedure action function.
pthread_attr_t * FwRtGetActivThreadAttr(FwRtDesc_t rtDesc)
Get the value of the attributes of the Activation Thread.
FwRtCounterU2_t FwRtGetNotifCounter(FwRtDesc_t rtDesc)
Return the value of the notification counter.
FwRtDesc_t FwRtMakeTestRT2(unsigned int i)
This function resets the i-th instance of the Test RT Container RT2 and returns a pointer to its desc...
pthread_attr_t * pThreadAttr
The pointer to the Activation Thread attributes.
int apInitCounter
Counter incremented by the Initialization Action of the Activation Procedure.
FwRtTestOutcome_t FwRtTestCaseStressRun4()
Verify the RT Container logic in a stress test where two threads send random sequences of notificatio...
FwRtBool_t FwRtIsActivPrStarted(FwRtDesc_t rtDesc)
Check whether the Activation Procedure is started.
FwRtTestOutcome_t FwRtTestCaseSetAttr1()
Verify the attribute setting interface of a RT Container.
#define N_NOTIFY2
Number of cycles in TestCaseStressRun_Notify2
A configuration function has been called during the container's normal operation (i.e.
FwRtAction_t initializeActivPr
Pointer to the function encapsulating the initialization action for the Activation Procedure...
pthread_mutexattr_t * pMutexAttr
The pointer to the mutex attributes.
int npImplNotifLogicCounter
Counter incremented by the Implement Notification Logic Action.
void FwRtSetFinalizeNotifPr(FwRtDesc_t rtDesc, FwRtAction_t finalizeNotifPr)
Define the function implementing the Finalization Action for the Notification Procedure.
void FwRtInit(FwRtDesc_t rtDesc)
Initialize a RT Container.
FwRtBool_t FwRtIsNotifPrStarted(FwRtDesc_t rtDesc)
Check whether the Notification Procedure is started.
FwRtDesc_t FwRtMakeTestRT4(unsigned int i)
This function resets the i-th instance of the Test RT Container RT4 and returns a pointer to its desc...
FwRtAction_t finalizeNotifPr
Pointer to the function encapsulating the finalization action for the Notification Procedure...
void * FwRtGetData(FwRtDesc_t rtDesc)
Get the pointer to the container data in the container descriptor.
FwRtOutcome_t npImplNotifLogicFlag
Flag determining outcome of Implement Notification Logic Action.
Structure representing a RT Container Descriptor.
pthread_condattr_t * pCondAttr
The pointer to the condition variable attributes.
FwRtTestOutcome_t
Outcome of a procedure test case.
The RT Container is in state STARTED.
int FwRtOutcome_t
Type used for the outcome of a container action.
FwRtTestOutcome_t FwRtTestCaseStressRun1()
Verify the RT Container logic in a stress test with a long sequences of notifications and random outc...
FwRtTestOutcome_t FwRtTestCaseStressRun6()
Verify the RT Container logic in a stress test where two threads send random sequences of notificatio...
FwRtTestOutcome_t FwRtTestCaseRun1()
Verify the logic to skip a notification in the Notification Procedure.
void FwRtSetExecFuncBehaviour(FwRtDesc_t rtDesc, FwRtAction_t execFuncBehaviour)
Define the function which executes the functional behaviour associated to the RT Container.
int npFinalCounter
Counter incremented by the Finalization Action of the Notification Procedure.