[rtems commit] smptests/smpipi01: Fix sporadic test failure

Sebastian Huber sebh at rtems.org
Wed Dec 9 07:22:59 UTC 2020


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Dec  9 08:20:44 2020 +0100

smptests/smpipi01: Fix sporadic test failure

---

 testsuites/smptests/smpipi01/init.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/testsuites/smptests/smpipi01/init.c b/testsuites/smptests/smpipi01/init.c
index 3ca04c7..18b7a9a 100644
--- a/testsuites/smptests/smpipi01/init.c
+++ b/testsuites/smptests/smpipi01/init.c
@@ -118,6 +118,8 @@ static void test_send_message_while_processing_a_message(
 
   for (cpu_index = 0; cpu_index < cpu_count; ++cpu_index) {
     if (cpu_index != cpu_index_self) {
+      Per_CPU_Control *cpu_self;
+
       ctx->jobs[0][0].context = &barrier_0_job_context;
       _Per_CPU_Add_job(_Per_CPU_Get_by_index(cpu_index), &ctx->jobs[0][0]);
       _SMP_Send_message(cpu_index, SMP_MESSAGE_PERFORM_JOBS);
@@ -142,6 +144,11 @@ static void test_send_message_while_processing_a_message(
       rtems_test_assert(ctx->counters[cpu_index].value == 2);
 
       ctx->counters[cpu_index].value = 0;
+
+      /* Ensure that the second job is done and can be reused */
+      cpu_self = _Thread_Dispatch_disable();
+      _Per_CPU_Wait_for_job(_Per_CPU_Get_by_index(cpu_index), &ctx->jobs[0][1]);
+      _Thread_Dispatch_enable(cpu_self);
     }
   }
 }



More information about the vc mailing list