summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-10-12 17:47:28 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-10-14 11:34:25 +0200
commit6cf4cb18a3d8a5b7bcc88e202061c20c6898ccfd (patch)
tree517b76ef768dc5f0f5fd7e424f90fce79d461d6e
parent3574677bc0f7eccbbf3e8f187cdd42730fc15744 (diff)
validation: Fix event send/receive
-rw-r--r--testsuites/validation/tr-event-send-receive.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/testsuites/validation/tr-event-send-receive.c b/testsuites/validation/tr-event-send-receive.c
index e5e672dbbe..0dc6ed51d1 100644
--- a/testsuites/validation/tr-event-send-receive.c
+++ b/testsuites/validation/tr-event-send-receive.c
@@ -433,8 +433,9 @@ static void Worker( rtems_task_argument arg )
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 );
@@ -447,12 +448,26 @@ static void Worker( rtems_task_argument arg )
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;