[rtems commit] validation: Add comments to task tests

Sebastian Huber sebh at rtems.org
Tue Mar 2 06:49:57 UTC 2021


Module:    rtems
Branch:    master
Commit:    2ad03ded38b9db9e7d38098af77e8e9bedda0ba3
Changeset: http://git.rtems.org/rtems/commit/?id=2ad03ded38b9db9e7d38098af77e8e9bedda0ba3

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Mar  1 10:00:26 2021 +0100

validation: Add comments to task tests

---

 testsuites/validation/tc-task-construct-errors.c | 123 +++++++++++++++++++++++
 testsuites/validation/tc-task-create-errors.c    | 108 ++++++++++++++++++++
 2 files changed, 231 insertions(+)

diff --git a/testsuites/validation/tc-task-construct-errors.c b/testsuites/validation/tc-task-construct-errors.c
index cb8106e..72baefb 100644
--- a/testsuites/validation/tc-task-construct-errors.c
+++ b/testsuites/validation/tc-task-construct-errors.c
@@ -337,11 +337,17 @@ static void RtemsTaskReqConstructErrors_Pre_Id_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Pre_Id_Valid: {
+      /*
+       * The id parameter shall reference an object identifier value.
+       */
       ctx->id = &ctx->id_value;
       break;
     }
 
     case RtemsTaskReqConstructErrors_Pre_Id_Null: {
+      /*
+       * The id parameter shall be NULL.
+       */
       ctx->id = NULL;
       break;
     }
@@ -358,11 +364,17 @@ static void RtemsTaskReqConstructErrors_Pre_Name_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Pre_Name_Valid: {
+      /*
+       * The name of the task configuration shall be valid.
+       */
       ctx->config.name = NAME;
       break;
     }
 
     case RtemsTaskReqConstructErrors_Pre_Name_Inv: {
+      /*
+       * The name of the task configuration shall be invalid.
+       */
       ctx->config.name = 0;
       break;
     }
@@ -379,11 +391,18 @@ static void RtemsTaskReqConstructErrors_Pre_SysTsk_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Pre_SysTsk_Yes: {
+      /*
+       * The attributes of the task configuration shall specify a system task.
+       */
       ctx->config.attributes |= RTEMS_SYSTEM_TASK;
       break;
     }
 
     case RtemsTaskReqConstructErrors_Pre_SysTsk_No: {
+      /*
+       * The attributes of the task configuration shall specify an application
+       * task.
+       */
       /* Nothing to do */
       break;
     }
@@ -400,16 +419,25 @@ static void RtemsTaskReqConstructErrors_Pre_Prio_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Pre_Prio_Valid: {
+      /*
+       * The initial priority of the task configuration shall be valid.
+       */
       ctx->config.initial_priority = 254;
       break;
     }
 
     case RtemsTaskReqConstructErrors_Pre_Prio_Zero: {
+      /*
+       * The initial priority of the task configuration shall be zero.
+       */
       ctx->config.initial_priority = 0;
       break;
     }
 
     case RtemsTaskReqConstructErrors_Pre_Prio_Inv: {
+      /*
+       * The initial priority of the task configuration shall be invalid.
+       */
       ctx->config.initial_priority = 0xffffffff;
       break;
     }
@@ -426,11 +454,17 @@ static void RtemsTaskReqConstructErrors_Pre_Free_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Pre_Free_Yes: {
+      /*
+       * The system shall have at least one inactive task object available.
+       */
       /* Nothing to do */
       break;
     }
 
     case RtemsTaskReqConstructErrors_Pre_Free_No: {
+      /*
+       * The system shall have no inactive task object available.
+       */
       ctx->seized_objects = T_seize_objects( Create, ctx );
       break;
     }
@@ -447,11 +481,19 @@ static void RtemsTaskReqConstructErrors_Pre_TLS_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Pre_TLS_Enough: {
+      /*
+       * The maximum thread-local storage size of the task configuration shall be
+       * greater than or equal to the thread-local storage size.
+       */
       ctx->config.maximum_thread_local_storage_size = MAX_TLS_SIZE;
       break;
     }
 
     case RtemsTaskReqConstructErrors_Pre_TLS_Small: {
+      /*
+       * The maximum thread-local storage size of the task configuration shall be
+       * less than the thread-local storage size.
+       */
       ctx->config.maximum_thread_local_storage_size = 0;
       break;
     }
@@ -468,11 +510,19 @@ static void RtemsTaskReqConstructErrors_Pre_Stack_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Pre_Stack_Enough: {
+      /*
+       * The task stack size of the task configuration shall be greater than or
+       * equal to the configured minimum size.
+       */
       ctx->stack_size = RTEMS_MINIMUM_STACK_SIZE;
       break;
     }
 
     case RtemsTaskReqConstructErrors_Pre_Stack_Small: {
+      /*
+       * The task stack size of the task configuration shall be less than the
+       * configured minimum size.
+       */
       ctx->stack_size = 0;
       break;
     }
@@ -489,11 +539,17 @@ static void RtemsTaskReqConstructErrors_Pre_Ext_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Pre_Ext_Ok: {
+      /*
+       * None of the task create extensions shall fail.
+       */
       ctx->create_extension_status = true;
       break;
     }
 
     case RtemsTaskReqConstructErrors_Pre_Ext_Err: {
+      /*
+       * At least one of the task create extensions shall fail.
+       */
       ctx->create_extension_status = false;
       break;
     }
@@ -510,36 +566,64 @@ static void RtemsTaskReqConstructErrors_Post_Status_Check(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Post_Status_Ok: {
+      /*
+       * The return status of rtems_task_construct() shall be
+       * RTEMS_SUCCESSFUL.
+       */
       T_rsc_success( ctx->status );
       break;
     }
 
     case RtemsTaskReqConstructErrors_Post_Status_InvAddr: {
+      /*
+       * The return status of rtems_task_construct() shall be
+       * RTEMS_INVALID_ADDRESS.
+       */
       T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
       break;
     }
 
     case RtemsTaskReqConstructErrors_Post_Status_InvName: {
+      /*
+       * The return status of rtems_task_construct() shall be
+       * RTEMS_INVALID_NAME.
+       */
       T_rsc( ctx->status, RTEMS_INVALID_NAME );
       break;
     }
 
     case RtemsTaskReqConstructErrors_Post_Status_InvPrio: {
+      /*
+       * The return status of rtems_task_construct() shall be
+       * RTEMS_INVALID_PRIORITY.
+       */
       T_rsc( ctx->status, RTEMS_INVALID_PRIORITY );
       break;
     }
 
     case RtemsTaskReqConstructErrors_Post_Status_InvSize: {
+      /*
+       * The return status of rtems_task_construct() shall be
+       * RTEMS_INVALID_SIZE.
+       */
       T_rsc( ctx->status, RTEMS_INVALID_SIZE );
       break;
     }
 
     case RtemsTaskReqConstructErrors_Post_Status_TooMany: {
+      /*
+       * The return status of rtems_task_construct() shall be
+       * RTEMS_TOO_MANY.
+       */
       T_rsc( ctx->status, RTEMS_TOO_MANY );
       break;
     }
 
     case RtemsTaskReqConstructErrors_Post_Status_Unsat: {
+      /*
+       * The return status of rtems_task_construct() shall be
+       * RTEMS_UNSATISFIED.
+       */
       T_rsc( ctx->status, RTEMS_UNSATISFIED  );
       break;
     }
@@ -559,6 +643,10 @@ static void RtemsTaskReqConstructErrors_Post_Name_Check(
 
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Post_Name_Valid: {
+      /*
+       * The unique object name shall identify the task constructed by
+       * the rtems_task_construct() call.
+       */
       id = 0;
       sc = rtems_task_ident( NAME, RTEMS_SEARCH_LOCAL_NODE, &id );
       T_rsc_success( sc );
@@ -567,6 +655,9 @@ static void RtemsTaskReqConstructErrors_Post_Name_Check(
     }
 
     case RtemsTaskReqConstructErrors_Post_Name_Invalid: {
+      /*
+       * The unique object name shall not identify a task.
+       */
       sc = rtems_task_ident( NAME, RTEMS_SEARCH_LOCAL_NODE, &id );
       T_rsc( sc, RTEMS_INVALID_NAME );
       break;
@@ -584,12 +675,20 @@ static void RtemsTaskReqConstructErrors_Post_IdValue_Check(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Post_IdValue_Assigned: {
+      /*
+       * The value of the object identifier variable shall be equal to the object
+       * identifier of the task constructed by the rtems_task_construct() call.
+       */
       T_eq_ptr( ctx->id, &ctx->id_value );
       T_ne_u32( ctx->id_value, INVALID_ID );
       break;
     }
 
     case RtemsTaskReqConstructErrors_Post_IdValue_Unchanged: {
+      /*
+       * The value of the object identifier variable shall be unchanged by the
+       * rtems_task_construct() call.
+       */
       T_eq_u32( ctx->id_value, INVALID_ID );
       break;
     }
@@ -606,11 +705,19 @@ static void RtemsTaskReqConstructErrors_Post_CreateExt_Check(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Post_CreateExt_Yes: {
+      /*
+       * The create user extensions shall be invoked during the
+       * rtems_task_construct() call.
+       */
       T_eq_u32( ctx->create_extension_calls, 1 );
       break;
     }
 
     case RtemsTaskReqConstructErrors_Post_CreateExt_No: {
+      /*
+       * The create user extensions shall not be invoked during the
+       * rtems_task_construct() call.
+       */
       T_eq_u32( ctx->create_extension_calls, 0 );
       break;
     }
@@ -627,11 +734,19 @@ static void RtemsTaskReqConstructErrors_Post_DelExt_Check(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Post_DelExt_Yes: {
+      /*
+       * The delete user extensions shall be invoked during the
+       * rtems_task_construct() call.
+       */
       T_eq_u32( ctx->delete_extension_calls, 1 );
       break;
     }
 
     case RtemsTaskReqConstructErrors_Post_DelExt_No: {
+      /*
+       * The delete user extensions shall not be invoked during the
+       * rtems_task_construct() call.
+       */
       T_eq_u32( ctx->delete_extension_calls, 0 );
       break;
     }
@@ -648,11 +763,19 @@ static void RtemsTaskReqConstructErrors_Post_StoFree_Check(
 {
   switch ( state ) {
     case RtemsTaskReqConstructErrors_Post_StoFree_Yes: {
+      /*
+       * The storage free handler of the task configuration shall be invoked
+       * during the rtems_task_construct() call.
+       */
       T_eq_u32( ctx->storage_free_calls, 1 );
       break;
     }
 
     case RtemsTaskReqConstructErrors_Post_StoFree_No: {
+      /*
+       * The storage free handler of the task configuration shall not be invoked
+       * during the rtems_task_construct() call.
+       */
       T_eq_u32( ctx->storage_free_calls, 0 );
       break;
     }
diff --git a/testsuites/validation/tc-task-create-errors.c b/testsuites/validation/tc-task-create-errors.c
index 39b9c0c..67e3fb7 100644
--- a/testsuites/validation/tc-task-create-errors.c
+++ b/testsuites/validation/tc-task-create-errors.c
@@ -301,11 +301,17 @@ static void RtemsTaskReqCreateErrors_Pre_Id_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Pre_Id_Valid: {
+      /*
+       * The id parameter shall reference an object identifier value.
+       */
       ctx->id = &ctx->id_value;
       break;
     }
 
     case RtemsTaskReqCreateErrors_Pre_Id_Null: {
+      /*
+       * The id parameter shall be NULL.
+       */
       ctx->id = NULL;
       break;
     }
@@ -322,11 +328,17 @@ static void RtemsTaskReqCreateErrors_Pre_Name_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Pre_Name_Valid: {
+      /*
+       * The ``name`` parameter shall be valid.
+       */
       ctx->name = NAME;
       break;
     }
 
     case RtemsTaskReqCreateErrors_Pre_Name_Inv: {
+      /*
+       * The ``name`` parameter shall be invalid.
+       */
       ctx->name = 0;
       break;
     }
@@ -343,11 +355,19 @@ static void RtemsTaskReqCreateErrors_Pre_SysTsk_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Pre_SysTsk_Yes: {
+      /*
+       * The ``attribute_set`` parameter shall specify a system
+       * task.
+       */
       ctx->attributes = RTEMS_SYSTEM_TASK;
       break;
     }
 
     case RtemsTaskReqCreateErrors_Pre_SysTsk_No: {
+      /*
+       * The ``attribute_set`` parameter shall specify an
+       * application task.
+       */
       ctx->attributes = RTEMS_DEFAULT_ATTRIBUTES;
       break;
     }
@@ -364,16 +384,25 @@ static void RtemsTaskReqCreateErrors_Pre_Prio_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Pre_Prio_Valid: {
+      /*
+       * The ``initial_priority`` parameter shall be valid.
+       */
       ctx->initial_priority = 254;
       break;
     }
 
     case RtemsTaskReqCreateErrors_Pre_Prio_Zero: {
+      /*
+       * The ``initial_priority`` parameter shall be zero.
+       */
       ctx->initial_priority = 0;
       break;
     }
 
     case RtemsTaskReqCreateErrors_Pre_Prio_Inv: {
+      /*
+       * The ``initial_priority`` parameter shall be invalid.
+       */
       ctx->initial_priority = 0xffffffff;
       break;
     }
@@ -390,11 +419,17 @@ static void RtemsTaskReqCreateErrors_Pre_Free_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Pre_Free_Yes: {
+      /*
+       * The system shall have at least one inactive task object available.
+       */
       /* Nothing to do */
       break;
     }
 
     case RtemsTaskReqCreateErrors_Pre_Free_No: {
+      /*
+       * The system shall have no inactive task object available.
+       */
       ctx->seized_objects = T_seize_objects( Create, ctx );
       break;
     }
@@ -411,16 +446,28 @@ static void RtemsTaskReqCreateErrors_Pre_Stack_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Pre_Stack_Normal: {
+      /*
+       * The ``initial_priority`` parameter shall be greater than or
+       * equal to the configured minimum size.
+       */
       ctx->stack_size = RTEMS_MINIMUM_STACK_SIZE;
       break;
     }
 
     case RtemsTaskReqCreateErrors_Pre_Stack_Small: {
+      /*
+       * The ``initial_priority`` parameter shall be less than the
+       * configured minimum size.
+       */
       ctx->stack_size = 0;
       break;
     }
 
     case RtemsTaskReqCreateErrors_Pre_Stack_Huge: {
+      /*
+       * The ``initial_priority`` parameter shall be greater than the
+       * maximum stack size which can be allocated by the system.
+       */
       ctx->stack_size = SIZE_MAX;
       break;
     }
@@ -437,11 +484,17 @@ static void RtemsTaskReqCreateErrors_Pre_Ext_Prepare(
 {
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Pre_Ext_Ok: {
+      /*
+       * None of the task create extensions shall fail.
+       */
       ctx->create_extension_status = true;
       break;
     }
 
     case RtemsTaskReqCreateErrors_Pre_Ext_Err: {
+      /*
+       * At least one of the task create extensions shall fail.
+       */
       ctx->create_extension_status = false;
       break;
     }
@@ -458,31 +511,55 @@ static void RtemsTaskReqCreateErrors_Post_Status_Check(
 {
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Post_Status_Ok: {
+      /*
+       * The return status of rtems_task_create() shall be
+       * RTEMS_SUCCESSFUL.
+       */
       T_rsc_success( ctx->status );
       break;
     }
 
     case RtemsTaskReqCreateErrors_Post_Status_InvAddr: {
+      /*
+       * The return status of rtems_task_create() shall be
+       * RTEMS_INVALID_ADDRESS.
+       */
       T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
       break;
     }
 
     case RtemsTaskReqCreateErrors_Post_Status_InvName: {
+      /*
+       * The return status of rtems_task_create() shall be
+       * RTEMS_INVALID_NAME.
+       */
       T_rsc( ctx->status, RTEMS_INVALID_NAME );
       break;
     }
 
     case RtemsTaskReqCreateErrors_Post_Status_InvPrio: {
+      /*
+       * The return status of rtems_task_create() shall be
+       * RTEMS_INVALID_PRIORITY.
+       */
       T_rsc( ctx->status, RTEMS_INVALID_PRIORITY );
       break;
     }
 
     case RtemsTaskReqCreateErrors_Post_Status_TooMany: {
+      /*
+       * The return status of rtems_task_create() shall be
+       * RTEMS_TOO_MANY.
+       */
       T_rsc( ctx->status, RTEMS_TOO_MANY );
       break;
     }
 
     case RtemsTaskReqCreateErrors_Post_Status_Unsat: {
+      /*
+       * The return status of rtems_task_create() shall be
+       * RTEMS_UNSATISFIED.
+       */
       T_rsc( ctx->status, RTEMS_UNSATISFIED  );
       break;
     }
@@ -502,6 +579,10 @@ static void RtemsTaskReqCreateErrors_Post_Name_Check(
 
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Post_Name_Valid: {
+      /*
+       * The unique object name shall identify the task created by
+       * the rtems_task_create() call.
+       */
       id = 0;
       sc = rtems_task_ident( NAME, RTEMS_SEARCH_LOCAL_NODE, &id );
       T_rsc_success( sc );
@@ -510,6 +591,9 @@ static void RtemsTaskReqCreateErrors_Post_Name_Check(
     }
 
     case RtemsTaskReqCreateErrors_Post_Name_Invalid: {
+      /*
+       * The unique object name shall not identify a task.
+       */
       sc = rtems_task_ident( NAME, RTEMS_SEARCH_LOCAL_NODE, &id );
       T_rsc( sc, RTEMS_INVALID_NAME );
       break;
@@ -527,12 +611,20 @@ static void RtemsTaskReqCreateErrors_Post_IdValue_Check(
 {
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Post_IdValue_Assigned: {
+      /*
+       * The value of the object identifier variable shall be equal to the object
+       * identifier of the task created by the rtems_task_create() call.
+       */
       T_eq_ptr( ctx->id, &ctx->id_value );
       T_ne_u32( ctx->id_value, INVALID_ID );
       break;
     }
 
     case RtemsTaskReqCreateErrors_Post_IdValue_Unchanged: {
+      /*
+       * The value of the object identifier variable shall be unchanged by the
+       * rtems_task_create() call.
+       */
       T_eq_u32( ctx->id_value, INVALID_ID );
       break;
     }
@@ -549,11 +641,19 @@ static void RtemsTaskReqCreateErrors_Post_CreateExt_Check(
 {
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Post_CreateExt_Yes: {
+      /*
+       * The create user extensions shall be invoked during the
+       * rtems_task_create() call.
+       */
       T_eq_u32( ctx->create_extension_calls, 1 );
       break;
     }
 
     case RtemsTaskReqCreateErrors_Post_CreateExt_No: {
+      /*
+       * The create user extensions shall not be invoked during the
+       * rtems_task_create() call.
+       */
       T_eq_u32( ctx->create_extension_calls, 0 );
       break;
     }
@@ -570,11 +670,19 @@ static void RtemsTaskReqCreateErrors_Post_DelExt_Check(
 {
   switch ( state ) {
     case RtemsTaskReqCreateErrors_Post_DelExt_Yes: {
+      /*
+       * The delete user extensions shall be invoked during the
+       * rtems_task_create() call.
+       */
       T_eq_u32( ctx->delete_extension_calls, 1 );
       break;
     }
 
     case RtemsTaskReqCreateErrors_Post_DelExt_No: {
+      /*
+       * The delete user extensions shall not be invoked during the
+       * rtems_task_create() call.
+       */
       T_eq_u32( ctx->delete_extension_calls, 0 );
       break;
     }



More information about the vc mailing list