forked from Imagelibrary/rtems
score: PR2179: Fix initially locked PI mutex
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user