summaryrefslogtreecommitdiffstats
path: root/testsuites/smptests/smppsxmutex01/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/smptests/smppsxmutex01/init.c')
-rw-r--r--testsuites/smptests/smppsxmutex01/init.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/testsuites/smptests/smppsxmutex01/init.c b/testsuites/smptests/smppsxmutex01/init.c
index f5aacb42d8..6532f5868d 100644
--- a/testsuites/smptests/smppsxmutex01/init.c
+++ b/testsuites/smptests/smppsxmutex01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2016 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2016 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -55,25 +55,11 @@ static test_context test_instance;
static void *thread_b(void *arg)
{
test_context *ctx;
- rtems_id scheduler_b_id;
- rtems_status_code sc;
- rtems_task_priority prio;
int prio_ceiling;
int eno;
ctx = arg;
- rtems_test_assert(rtems_scheduler_get_processor() == 0);
-
- sc = rtems_scheduler_ident(SCHED_B, &scheduler_b_id);
- rtems_test_assert(sc == RTEMS_SUCCESSFUL);
-
- sc = rtems_task_set_priority(pthread_self(), RTEMS_CURRENT_PRIORITY, &prio);
- rtems_test_assert(sc == RTEMS_SUCCESSFUL);
-
- sc = rtems_task_set_scheduler(pthread_self(), scheduler_b_id, prio);
- rtems_test_assert(sc == RTEMS_SUCCESSFUL);
-
rtems_test_assert(rtems_scheduler_get_processor() == 1);
eno = pthread_mutex_init(&ctx->mtx_b, &ctx->mtx_attr);
@@ -132,8 +118,24 @@ static void test(test_context *ctx)
rtems_test_assert(eno == 0);
if (cpu_count > 1) {
+ rtems_id scheduler_a_id;
+ rtems_id scheduler_b_id;
+ rtems_status_code sc;
+ rtems_task_priority prio;
void *exit_code;
+ sc = rtems_scheduler_ident(SCHED_A, &scheduler_a_id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_scheduler_ident(SCHED_B, &scheduler_b_id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_set_priority(pthread_self(), RTEMS_CURRENT_PRIORITY, &prio);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_set_scheduler(pthread_self(), scheduler_b_id, prio);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
eno = pthread_create(&ctx->thread_b, NULL, thread_b, ctx);
rtems_test_assert(eno == 0);
@@ -141,6 +143,9 @@ static void test(test_context *ctx)
eno = pthread_join(ctx->thread_b, &exit_code);
rtems_test_assert(eno == 0);
rtems_test_assert(exit_code == ctx);
+
+ sc = rtems_task_set_scheduler(pthread_self(), scheduler_a_id, prio);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
eno = pthread_mutex_destroy(&ctx->mtx_a);