[rtems-central commit] spec: Fix event send/receive validation

Sebastian Huber sebh at rtems.org
Mon Oct 12 15:48:17 UTC 2020


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Oct 12 17:47:45 2020 +0200

spec: Fix event send/receive validation

---

 spec/rtems/event/req/send-receive.yml | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/spec/rtems/event/req/send-receive.yml b/spec/rtems/event/req/send-receive.yml
index f80514a..56e4671 100644
--- a/spec/rtems/event/req/send-receive.yml
+++ b/spec/rtems/event/req/send-receive.yml
@@ -634,8 +634,9 @@ test-support: |
     ctx = (Context *) arg;
 
     while ( true ) {
-      rtems_status_code   sc;
-      rtems_task_priority prio;
+      rtems_status_code    sc;
+      rtems_task_priority  prio;
+      T_thread_switch_log *log;
 
       Wait( ctx->worker_wakeup );
 
@@ -648,12 +649,26 @@ test-support: |
           T_eq_u32( prio, PRIO_LOW );
           break;
         case PRIO_OTHER:
+          log = T_thread_switch_record_4( &ctx->thread_switch_log );
+          T_null( log );
           sc = rtems_task_set_scheduler(
             RTEMS_SELF,
             ctx->other_sched,
             PRIO_LOW
           );
           T_rsc_success( sc );
+
+          /*
+           * Make sure the context switch to the IDLE thread on the previous
+           * CPU is recorded, otherwise the preemption check may sporadically
+           * fail on some targets.
+           */
+          while (ctx->thread_switch_log.log.recorded < 2) {
+            RTEMS_COMPILER_MEMORY_BARRIER();
+          }
+
+          log = T_thread_switch_record( NULL );
+          T_eq_ptr( log, &ctx->thread_switch_log.log );
           break;
         case PRIO_LOW:
           break;



More information about the vc mailing list