summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-08-19 17:43:36 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-08-20 08:17:49 +0200
commitbba3507723041f451c9da1ecee43819bcbe57f23 (patch)
tree6436d16e2edd96dc3807f0667d2b44bb4faecd44 /testsuites/sptests
parentrtems_termios_puts: Copy and write more than one char at once (diff)
downloadrtems-bba3507723041f451c9da1ecee43819bcbe57f23.tar.bz2
score: PR2179: Fix initially locked PI mutex
Diffstat (limited to 'testsuites/sptests')
-rw-r--r--testsuites/sptests/sp51/init.c36
-rw-r--r--testsuites/sptests/sp51/sp51.doc3
2 files changed, 39 insertions, 0 deletions
diff --git a/testsuites/sptests/sp51/init.c b/testsuites/sptests/sp51/init.c
index 98d362f89c..48f0146aa3 100644
--- a/testsuites/sptests/sp51/init.c
+++ b/testsuites/sptests/sp51/init.c
@@ -18,6 +18,40 @@ const char rtems_test_name[] = "SP 51";
/* forward declarations to avoid warnings */
rtems_task Init(rtems_task_argument argument);
+static void test_create_initially_locked_prio_inherit_sema(void)
+{
+ rtems_status_code sc;
+ rtems_id id;
+ rtems_task_priority prio_a;
+ rtems_task_priority prio_b;
+ rtems_task_priority prio_ceiling = 0;
+
+ sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio_a);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ rtems_test_assert(prio_a != prio_ceiling);
+
+ sc = rtems_semaphore_create(
+ rtems_build_name( 'S', 'E', 'M', 'A' ),
+ 0,
+ RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
+ prio_ceiling,
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_task_set_priority(RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &prio_b);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ rtems_test_assert(prio_a == prio_b);
+
+ sc = rtems_semaphore_release(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_semaphore_delete(id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+}
+
rtems_task Init(
rtems_task_argument argument
)
@@ -57,6 +91,8 @@ rtems_task Init(
fatal_directive_status(
sc, RTEMS_NOT_OWNER_OF_RESOURCE, "rtems_semaphore_release" );
+ test_create_initially_locked_prio_inherit_sema();
+
TEST_END();
rtems_test_exit( 0 );
}
diff --git a/testsuites/sptests/sp51/sp51.doc b/testsuites/sptests/sp51/sp51.doc
index a1003dba99..fac553475e 100644
--- a/testsuites/sptests/sp51/sp51.doc
+++ b/testsuites/sptests/sp51/sp51.doc
@@ -23,3 +23,6 @@ concepts:
+ Ensure the when the binary semaphore lock fails to acquire the mutex,
it is an error to release it since the lock failed.
+
++ Verify that creation of an initially locked priority inheritance mutex does
+ not change the priority of the executing thread.