summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-23 13:37:59 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-26 21:44:31 +0200
commitdce487912d98835b8168e755b60514f5a8592b27 (patch)
tree8778547fbb0f2dbb07bb6a83f28d3f4464924141 /testsuites/sptests
parentposix: Fix sem_init() with too large initial value (diff)
downloadrtems-dce487912d98835b8168e755b60514f5a8592b27.tar.bz2
score: Add Status_Control for all APIs
Unify the status codes of the Classic and POSIX API to use the new enum Status_Control. This eliminates the Thread_Control::Wait::timeout_code field and the timeout parameter of _Thread_queue_Enqueue_critical() and _MPCI_Send_request_packet(). It gets rid of the status code translation tables and instead uses simple bit operations to get the status for a particular API. This enables translation of status code constants at compile time. Add _Thread_Wait_get_status() to avoid direct access of thread internal data structures.
Diffstat (limited to 'testsuites/sptests')
-rw-r--r--testsuites/sptests/spintrcritical10/init.c22
-rw-r--r--testsuites/sptests/spintrcritical20/init.c14
2 files changed, 16 insertions, 20 deletions
diff --git a/testsuites/sptests/spintrcritical10/init.c b/testsuites/sptests/spintrcritical10/init.c
index 25be23a852..f7e372a46b 100644
--- a/testsuites/sptests/spintrcritical10/init.c
+++ b/testsuites/sptests/spintrcritical10/init.c
@@ -60,7 +60,7 @@ static void any_satisfy_before_timeout(rtems_id timer, void *arg)
rtems_test_assert(
*(rtems_event_set *) thread->Wait.return_argument == DEADBEEF
);
- rtems_test_assert(thread->Wait.return_code == RTEMS_SUCCESSFUL);
+ rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL);
sc = rtems_event_send(thread->Object.id, GREEN);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
@@ -68,7 +68,7 @@ static void any_satisfy_before_timeout(rtems_id timer, void *arg)
rtems_test_assert(
*(rtems_event_set *) thread->Wait.return_argument == GREEN
);
- rtems_test_assert(thread->Wait.return_code == RTEMS_SUCCESSFUL);
+ rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL);
sc = rtems_event_send(thread->Object.id, RED);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
@@ -76,14 +76,14 @@ static void any_satisfy_before_timeout(rtems_id timer, void *arg)
rtems_test_assert(
*(rtems_event_set *) thread->Wait.return_argument == GREEN
);
- rtems_test_assert(thread->Wait.return_code == RTEMS_SUCCESSFUL);
+ rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL);
_Thread_Timeout(&thread->Timer.Watchdog);
rtems_test_assert(
*(rtems_event_set *) thread->Wait.return_argument == GREEN
);
- rtems_test_assert(thread->Wait.return_code == RTEMS_SUCCESSFUL);
+ rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL);
if (ctx->hit) {
rtems_test_assert(
@@ -157,7 +157,7 @@ static void all_satisfy_before_timeout(rtems_id timer, void *arg)
rtems_test_assert(
*(rtems_event_set *) thread->Wait.return_argument == DEADBEEF
);
- rtems_test_assert(thread->Wait.return_code == RTEMS_SUCCESSFUL);
+ rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL);
sc = rtems_event_send(thread->Object.id, GREEN);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
@@ -165,7 +165,7 @@ static void all_satisfy_before_timeout(rtems_id timer, void *arg)
rtems_test_assert(
*(rtems_event_set *) thread->Wait.return_argument == DEADBEEF
);
- rtems_test_assert(thread->Wait.return_code == RTEMS_SUCCESSFUL);
+ rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL);
sc = rtems_event_send(thread->Object.id, RED);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
@@ -173,14 +173,14 @@ static void all_satisfy_before_timeout(rtems_id timer, void *arg)
rtems_test_assert(
*(rtems_event_set *) thread->Wait.return_argument == EVENTS
);
- rtems_test_assert(thread->Wait.return_code == RTEMS_SUCCESSFUL);
+ rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL);
_Thread_Timeout(&thread->Timer.Watchdog);
rtems_test_assert(
*(rtems_event_set *) thread->Wait.return_argument == EVENTS
);
- rtems_test_assert(thread->Wait.return_code == RTEMS_SUCCESSFUL);
+ rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL);
if (ctx->hit) {
rtems_test_assert(
@@ -249,14 +249,14 @@ static void timeout_before_satisfied(rtems_id timer, void *arg)
rtems_test_assert(
*(rtems_event_set *) thread->Wait.return_argument == DEADBEEF
);
- rtems_test_assert(thread->Wait.return_code == RTEMS_SUCCESSFUL);
+ rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_SUCCESSFUL);
_Thread_Timeout(&thread->Timer.Watchdog);
rtems_test_assert(
*(rtems_event_set *) thread->Wait.return_argument == DEADBEEF
);
- rtems_test_assert(thread->Wait.return_code == RTEMS_TIMEOUT);
+ rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_TIMEOUT);
sc = rtems_event_send(thread->Object.id, EVENTS);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
@@ -264,7 +264,7 @@ static void timeout_before_satisfied(rtems_id timer, void *arg)
rtems_test_assert(
*(rtems_event_set *) thread->Wait.return_argument == DEADBEEF
);
- rtems_test_assert(thread->Wait.return_code == RTEMS_TIMEOUT);
+ rtems_test_assert(_Thread_Wait_get_status(thread) == STATUS_TIMEOUT);
if (ctx->hit) {
rtems_test_assert(
diff --git a/testsuites/sptests/spintrcritical20/init.c b/testsuites/sptests/spintrcritical20/init.c
index 9c9b5f0903..1697df426a 100644
--- a/testsuites/sptests/spintrcritical20/init.c
+++ b/testsuites/sptests/spintrcritical20/init.c
@@ -18,6 +18,7 @@
#include <tmacros.h>
#include <intrcritical.h>
+#include <rtems/score/threadimpl.h>
#include <rtems/score/threadqimpl.h>
#include <rtems/rtems/semimpl.h>
@@ -44,10 +45,6 @@ static void semaphore_task(rtems_task_argument arg)
test_context *ctx = (test_context *) arg;
ctx->semaphore_task_tcb = _Thread_Get_executing();
- _Thread_Wait_set_timeout_code(
- ctx->semaphore_task_tcb,
- CORE_SEMAPHORE_TIMEOUT
- );
while (true) {
rtems_status_code sc = rtems_semaphore_obtain(
@@ -76,8 +73,7 @@ static bool test_body(void *arg)
cpu_self = _Thread_Dispatch_disable();
rtems_test_assert(
- ctx->semaphore_task_tcb->Wait.return_code
- == CORE_SEMAPHORE_STATUS_SUCCESSFUL
+ _Thread_Wait_get_status( ctx->semaphore_task_tcb ) == STATUS_SUCCESSFUL
);
/*
@@ -94,11 +90,11 @@ static bool test_body(void *arg)
_Thread_Timeout(&ctx->semaphore_task_tcb->Timer.Watchdog);
- switch (ctx->semaphore_task_tcb->Wait.return_code) {
- case CORE_SEMAPHORE_STATUS_SUCCESSFUL:
+ switch (_Thread_Wait_get_status(ctx->semaphore_task_tcb)) {
+ case STATUS_SUCCESSFUL:
ctx->status_was_successful = true;
break;
- case CORE_SEMAPHORE_TIMEOUT:
+ case STATUS_TIMEOUT:
ctx->status_was_timeout = true;
break;
default: