diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-02-24 14:06:41 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-03-03 07:10:55 +0100 |
commit | 180201094e4237679bd27df1e36b4f72d6840870 (patch) | |
tree | b36e74251c273ac6202376b3715a304864422b05 /testsuites | |
parent | 38736c69f84a07838dc18f7357ce5f14e555c860 (diff) |
rtems: Add rtems_scheduler_map_priority_from_posix()
Update #3881.
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/sptests/spscheduler01/init.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/testsuites/sptests/spscheduler01/init.c b/testsuites/sptests/spscheduler01/init.c index 27d36cbc1a..5ed17057d3 100644 --- a/testsuites/sptests/spscheduler01/init.c +++ b/testsuites/sptests/spscheduler01/init.c @@ -534,6 +534,49 @@ static void test_scheduler_map_to_posix(void) rtems_test_assert(posix_priority == 1); } +static void test_scheduler_map_from_posix(void) +{ + rtems_status_code sc; + rtems_task_priority priority; + rtems_id scheduler_id; + + priority = 123; + sc = rtems_scheduler_map_priority_from_posix(invalid_id, 1, &priority); + rtems_test_assert(sc == RTEMS_INVALID_ID); + rtems_test_assert(priority == 123); + + sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 1, NULL); + rtems_test_assert(sc == RTEMS_INVALID_ADDRESS); + + priority = 123; + sc = rtems_scheduler_map_priority_from_posix(scheduler_id, -1, &priority); + rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); + rtems_test_assert(priority == 123); + + priority = 123; + sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 0, &priority); + rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); + rtems_test_assert(priority == 123); + + priority = 123; + sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 255, &priority); + rtems_test_assert(sc == RTEMS_INVALID_PRIORITY); + rtems_test_assert(priority == 123); + + priority = 123; + sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 1, &priority); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(priority == 254); + + priority = 123; + sc = rtems_scheduler_map_priority_from_posix(scheduler_id, 254, &priority); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(priority == 1); +} + static void test_scheduler_get_processors(void) { rtems_status_code sc; @@ -663,6 +706,7 @@ static void Init(rtems_task_argument arg) test_scheduler_ident(); test_scheduler_get_max_prio(); test_scheduler_map_to_posix(); + test_scheduler_map_from_posix(); test_scheduler_get_processors(); test_scheduler_add_remove_processors(); test_task_get_priority(); |