From 0e779a4c2e938e7e8a01670fe8a96d442415810e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 9 Dec 2020 08:20:44 +0100 Subject: smptests/smpipi01: Fix sporadic test failure --- testsuites/smptests/smpipi01/init.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'testsuites/smptests/smpipi01/init.c') diff --git a/testsuites/smptests/smpipi01/init.c b/testsuites/smptests/smpipi01/init.c index 3ca04c7ffe..18b7a9ae17 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); } } } -- cgit v1.2.3