[rtems-central commit] spec: Improve thread idle bodies test

Sebastian Huber sebh at rtems.org
Tue Nov 7 14:18:45 UTC 2023


Module:    rtems-central
Branch:    master
Commit:    ed7aca86181fd597c5362a072954c9c93d5f55c1
Changeset: http://git.rtems.org/rtems-central/commit/?id=ed7aca86181fd597c5362a072954c9c93d5f55c1

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Nov  7 15:39:07 2023 +0100

spec: Improve thread idle bodies test

---

 spec/score/thread/val/idle-body-no-return.yml | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/spec/score/thread/val/idle-body-no-return.yml b/spec/score/thread/val/idle-body-no-return.yml
index 39820640..625743a5 100644
--- a/spec/score/thread/val/idle-body-no-return.yml
+++ b/spec/score/thread/val/idle-body-no-return.yml
@@ -56,19 +56,30 @@ test-support: |
 
   static void CheckIdleBody( Context *ctx, rtems_task_entry entry )
   {
-    rtems_id id;
+    rtems_id          id;
+    rtems_interval    interval;
+    rtems_status_code sc;
 
     ctx->counter = 0;
     id = CreateTask( "WORK", PRIO_LOW );
     StartTask( id, entry, ctx );
 
-    while ( ctx->counter == 0 ) {
-      rtems_status_code sc;
+    /*
+     * With optimization disabled, coverage enabled, SMP enabled and a slow
+     * target, things may take some time.
+     */
+    interval = 1;
+    while ( ctx->counter == 0 && interval <= 1024 ) {
 
-      sc = rtems_task_wake_after( 1 );
+      sc = rtems_task_wake_after( interval );
       T_rsc_success( sc );
+
+      interval *= 2;
     }
 
+    sc = rtems_task_wake_after( interval );
+    T_rsc_success( sc );
+
     T_eq_u32( ctx->counter, 1 );
     DeleteTask( id );
   }



More information about the vc mailing list