示例#1
0
文件: test.c 项目: SushMJ/gainos-tk
void ShutdownHook(void)
{
	Sequence(2);
	/* \treq EH_07 nmf B1B2E1E2 se CheckShutdownHook: ShutdownOS
	 *
	 * \result ShutdowHook is called after os shutdown
	 * 
	 */
	ASSERT(EH_07,0);

	Sequence(3);

	/* evaluate conformance tests */
	ConfTestEvaluation();

	/* finish the conformance test */
	ConfTestFinish();
}
void PostTaskHook(void)
{
   static uint8 count = 0;
   StatusType ret;
   TaskType TaskID;
   TaskStateType TaskState;

   switch (count)
   {
      case 0:
         /* increment post task hook call count */
         count++;

         Sequence(5);
         /* \treq EH_04 nmf B1B2E1E2 se Check PreTaskHook/PostTaskHook:
          * Force rescheduling
          *
          * \result PreTaskHook is called before executing the new task,
          * but after the transition to running state. PostTaskHook is called
          * after existing the current task but before leaving the task's
          * running state.
          */
         ret = GetTaskID(&TaskID);
         ASSERT(EH_04, ret != E_OK);
         ASSERT(EH_04, TaskID != Task1);

         Sequence(6);
         ret = GetTaskState(Task1, &TaskState);
         ASSERT(OTHER, ret != E_OK);
         ASSERT(OTHER, TaskState != RUNNING);

         Sequence(7);
         ret = GetTaskState(Task2, &TaskState);
         ASSERT(OTHER, ret != E_OK);
         ASSERT(OTHER, TaskState != READY);
         break;
      case 1:
         /* increment post task hook call count */
         count++;

         Sequence(14);
         /* \treq EH_04 nmf B1B2E1E2 se Check PreTaskHook/PostTaskHook:
          * Force rescheduling
          *
          * \result PreTaskHook is called before executing the new task,
          * but after the transition to running state. PostTaskHook is called
          * after existing the current task but before leaving the task's
          * running state.
          */
         ret = GetTaskID(&TaskID);
         ASSERT(EH_04, ret != E_OK);
         ASSERT(EH_04, TaskID != Task2);

         Sequence(15);
         ret = GetTaskState(Task1, &TaskState);
         ASSERT(OTHER, ret != E_OK);
         ASSERT(OTHER, TaskState != READY);

         Sequence(16);
         ret = GetTaskState(Task2, &TaskState);
         ASSERT(OTHER, ret != E_OK);
         ASSERT(OTHER, TaskState != RUNNING);
         break;
      case 2:
         /* increment post task hook call count */
         count++;

         Sequence(21);
         /* \treq EH_04 nmf B1B2E1E2 se Check PreTaskHook/PostTaskHook:
          * Force rescheduling
          *
          * \result PreTaskHook is called before executing the new task,
          * but after the transition to running state. PostTaskHook is called
          * after existing the current task but before leaving the task's
          * running state.
          */
         ret = GetTaskID(&TaskID);
         ASSERT(EH_04, ret != E_OK);
         ASSERT(EH_04, TaskID != Task1);

         Sequence(22);
         ret = GetTaskState(Task1, &TaskState);
         ASSERT(OTHER, ret != E_OK);
         ASSERT(OTHER, TaskState != RUNNING);

         Sequence(23);
         ret = GetTaskState(Task2, &TaskState);
         ASSERT(OTHER, ret != E_OK);
         ASSERT(OTHER, TaskState != SUSPENDED);

         Sequence(24);

         /* evaluate conformance tests */
         ConfTestEvaluation();

         /* finish the conformance test */
         ConfTestFinish();
         break;
      default:
         while(1);
         break;
   }
}