summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp65/init.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-05-22 09:31:13 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-05-23 08:57:32 +0200
commit4edf348c3395560bcaaf3c020968e427f5683d28 (patch)
treebb132a0862f916a58de14df14eb32d6c7d5df20e /testsuites/sptests/sp65/init.c
parentc/src/aclocal/check-smp.m4: Use HAS_SMP not HAS_POSIX_API (diff)
downloadrtems-4edf348c3395560bcaaf3c020968e427f5683d28.tar.bz2
score: PR2179: Fix initially locked PCP mutexes
Elevate the priority of the creating task to the ceiling priority in case a semaphore is created as initially locked.
Diffstat (limited to 'testsuites/sptests/sp65/init.c')
-rw-r--r--testsuites/sptests/sp65/init.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/testsuites/sptests/sp65/init.c b/testsuites/sptests/sp65/init.c
index cba836d422..7c6d8d3bef 100644
--- a/testsuites/sptests/sp65/init.c
+++ b/testsuites/sptests/sp65/init.c
@@ -28,6 +28,17 @@ rtems_task Task_1(rtems_task_argument arg);
#define TASK_PRIORITY 1
#endif
+static void assert_priority(rtems_task_priority expected)
+{
+ rtems_status_code sc;
+ rtems_task_priority prio;
+
+ sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ rtems_test_assert(prio == expected);
+}
+
rtems_task Init(
rtems_task_argument ignored
)
@@ -38,6 +49,30 @@ rtems_task Init(
TEST_BEGIN();
/*
+ * Verify that an initially locked priority ceiling mutex elevates the
+ * priority of the creating task.
+ */
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 's','e','m','1' ),
+ 0,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING,
+ 1,
+ &Mutex_id
+ );
+ rtems_test_assert(status == RTEMS_SUCCESSFUL);
+
+ assert_priority(1);
+
+ status = rtems_semaphore_release(Mutex_id);
+ rtems_test_assert(status == RTEMS_SUCCESSFUL);
+
+ assert_priority(TASK_PRIORITY);
+
+ status = rtems_semaphore_delete(Mutex_id);
+ rtems_test_assert(status == RTEMS_SUCCESSFUL);
+
+ /*
* Create binary semaphore (a.k.a. Mutex) with Priority Ceiling
* attribute.
*/