summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spcontext01/init.c
diff options
context:
space:
mode:
authorAlexander Krutwig <alexander.krutwig@embedded-brains.de>2015-05-06 16:39:12 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-07 08:34:16 +0200
commit5b9dfff50befa221d2a5d7ca55e3df4c26c4b582 (patch)
treec2396174e01938460794b11d2df9ac8f6e1ec650 /testsuites/sptests/spcontext01/init.c
parentscore: Fix Thread_Control and Thread_Proxy_control (diff)
downloadrtems-5b9dfff50befa221d2a5d7ca55e3df4c26c4b582.tar.bz2
sptests/spcontext01: Check FPU task combinations
Diffstat (limited to '')
-rw-r--r--testsuites/sptests/spcontext01/init.c50
1 files changed, 39 insertions, 11 deletions
diff --git a/testsuites/sptests/spcontext01/init.c b/testsuites/sptests/spcontext01/init.c
index 039dd63912..d4bb4067ac 100644
--- a/testsuites/sptests/spcontext01/init.c
+++ b/testsuites/sptests/spcontext01/init.c
@@ -31,6 +31,7 @@ const char rtems_test_name[] = "SPCONTEXT 1";
typedef struct {
rtems_id control_task;
rtems_id validate_tasks[2];
+ rtems_id timer;
size_t task_index;
int iteration_counter;
} test_context;
@@ -46,17 +47,21 @@ static void validate_task(rtems_task_argument arg)
static void start_validate_task(
rtems_id *id,
uintptr_t pattern,
- rtems_task_priority priority
+ rtems_task_priority priority,
+ bool fp_unit
)
{
rtems_status_code sc;
+ rtems_attribute fpu_state;
+
+ fpu_state = fp_unit ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES;
sc = rtems_task_create(
rtems_build_name('V', 'A', 'L', 'I'),
priority,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
- RTEMS_DEFAULT_ATTRIBUTES,
+ fpu_state,
id
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
@@ -112,7 +117,7 @@ static void clobber_and_switch_timer(rtems_id timer, void *arg)
uintptr_t pattern = (uintptr_t) 0xffffffffffffffffU;
test_context *self = arg;
- reset_timer_or_finish(self, timer);
+ reset_timer_or_finish(self, self->timer);
switch_priorities(self);
_CPU_Context_volatile_clobber(pattern);
@@ -121,12 +126,11 @@ static void clobber_and_switch_timer(rtems_id timer, void *arg)
static void start_timer(test_context *self)
{
rtems_status_code sc;
- rtems_id timer;
- sc = rtems_timer_create(rtems_build_name('C', 'L', 'S', 'W'), &timer);
+ sc = rtems_timer_create(rtems_build_name('C', 'L', 'S', 'W'), &self->timer);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
- sc = rtems_timer_fire_after(timer, 2, clobber_and_switch_timer, self);
+ sc = rtems_timer_fire_after(self->timer, 2, clobber_and_switch_timer, self);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
@@ -145,19 +149,38 @@ static void wait_for_finish(void)
rtems_test_assert(out == FINISH_EVENT);
}
-static void test(test_context *self)
+static void test(test_context *self, bool task_0_fpu, bool task_1_fpu)
{
+ rtems_status_code sc;
uintptr_t pattern_0 = (uintptr_t) 0xaaaaaaaaaaaaaaaaU;
uintptr_t pattern_1 = (uintptr_t) 0x5555555555555555U;
memset(self, 0, sizeof(*self));
self->control_task = rtems_task_self();
-
- start_validate_task(&self->validate_tasks[0], pattern_0, PRIORITY_LOW);
- start_validate_task(&self->validate_tasks[1], pattern_1, PRIORITY_HIGH);
+ start_validate_task(
+ &self->validate_tasks[0],
+ pattern_0,
+ PRIORITY_LOW,
+ task_0_fpu
+ );
+ start_validate_task(
+ &self->validate_tasks[1],
+ pattern_1,
+ PRIORITY_HIGH,
+ task_1_fpu
+ );
start_timer(self);
wait_for_finish();
+
+ sc = rtems_task_delete(self->validate_tasks[0]);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_delete(self->validate_tasks[1]);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_timer_delete(self->timer);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
static void test_context_is_executing(void)
@@ -207,7 +230,12 @@ static void Init(rtems_task_argument arg)
TEST_BEGIN();
test_context_is_executing();
- test(self);
+ test(self, false, false);
+ printf("Both tasks did not use FPU: done\n");
+ test(self, false, true);
+ printf("One task used the FPU: done\n");
+ test(self, true, true);
+ printf("Both tasks used the FPU: done\n");
TEST_END();