summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;