summaryrefslogtreecommitdiff
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-02-24 14:06:16 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-03-03 07:09:59 +0100
commit38736c69f84a07838dc18f7357ce5f14e555c860 (patch)
treeab728b5ec5a65d73062cc3917c97e31ffbb3153a /testsuites
parentfd8c87a8cf0a309a58dd89221607db028f147391 (diff)
rtems: Add rtems_scheduler_map_priority_to_posix()
Update #3881.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/sptests/spscheduler01/init.c52
1 files changed, 45 insertions, 7 deletions
diff --git a/testsuites/sptests/spscheduler01/init.c b/testsuites/sptests/spscheduler01/init.c
index f42e60c593..27d36cbc1a 100644
--- a/testsuites/sptests/spscheduler01/init.c
+++ b/testsuites/sptests/spscheduler01/init.c
@@ -1,11 +1,5 @@
/*
- * Copyright (c) 2014, 2018 embedded brains GmbH. All rights reserved.
- *
- * embedded brains GmbH
- * Dornierstr. 4
- * 82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
+ * Copyright (C) 2014, 2020 embedded brains GmbH (http://www.embedded-brains.de)
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -497,6 +491,49 @@ static void test_scheduler_get_max_prio(void)
rtems_test_assert(priority == 255);
}
+static void test_scheduler_map_to_posix(void)
+{
+ rtems_status_code sc;
+ int posix_priority;
+ rtems_id scheduler_id;
+
+ posix_priority = 123;
+ sc = rtems_scheduler_map_priority_to_posix(invalid_id, 1, &posix_priority);
+ rtems_test_assert(sc == RTEMS_INVALID_ID);
+ rtems_test_assert(posix_priority == 123);
+
+ sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+ sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 1, NULL);
+ rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
+
+ posix_priority = 123;
+ sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 0, &posix_priority);
+ rtems_test_assert(sc == RTEMS_INVALID_PRIORITY);
+ rtems_test_assert(posix_priority == 123);
+
+ posix_priority = 123;
+ sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 255, &posix_priority);
+ rtems_test_assert(sc == RTEMS_INVALID_PRIORITY);
+ rtems_test_assert(posix_priority == 123);
+
+ posix_priority = 123;
+ sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 256, &posix_priority);
+ rtems_test_assert(sc == RTEMS_INVALID_PRIORITY);
+ rtems_test_assert(posix_priority == 123);
+
+ posix_priority = 123;
+ sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 1, &posix_priority);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(posix_priority == 254);
+
+ posix_priority = 123;
+ sc = rtems_scheduler_map_priority_to_posix(scheduler_id, 254, &posix_priority);
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+ rtems_test_assert(posix_priority == 1);
+}
+
static void test_scheduler_get_processors(void)
{
rtems_status_code sc;
@@ -625,6 +662,7 @@ static void Init(rtems_task_argument arg)
test_task_get_set_scheduler();
test_scheduler_ident();
test_scheduler_get_max_prio();
+ test_scheduler_map_to_posix();
test_scheduler_get_processors();
test_scheduler_add_remove_processors();
test_task_get_priority();