[PATCH 4/6] spintrcritical20: Fix incorrect assumption

Joel Sherrill joel.sherrill at oarcorp.com
Tue Jul 8 20:52:03 UTC 2014


The test assumed that the thread would have enough time to block
and become enqueued. In fact, the thread would still be in the
ready state and not blocked on the semaphore. Thus the state
of the Wait sub-structure in the TCB would not be in the expected
state. The simple solution was to continue when the thread was
in the ready state.
---
 testsuites/sptests/spintrcritical20/init.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/testsuites/sptests/spintrcritical20/init.c b/testsuites/sptests/spintrcritical20/init.c
index cae8fdb..209c9e5 100644
--- a/testsuites/sptests/spintrcritical20/init.c
+++ b/testsuites/sptests/spintrcritical20/init.c
@@ -20,6 +20,7 @@
 #include <intrcritical.h>
 #include <rtems/score/threadqimpl.h>
 #include <rtems/rtems/semimpl.h>
+#include <rtems/score/statesimpl.h>
 
 const char rtems_test_name[] = "SPINTRCRITICAL 20";
 
@@ -108,6 +109,9 @@ static void Init(rtems_task_argument ignored)
       ++resets;
     }
 
+    if (ctx->semaphore_task_tcb->current_state == STATES_READY)
+      continue;
+
     _Thread_Disable_dispatch();
 
     rtems_test_assert(
-- 
1.7.1



More information about the devel mailing list