summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-13 15:22:47 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-13 15:38:14 +0200
commit0c34dbf341095f93a712bbe6d024c8c1d975b6f5 (patch)
treea96abc334efba138e460c41375541b6a159487c8 /testsuites/psxtests
parentposix: Fix pthread_setschedparam() (diff)
downloadrtems-0c34dbf341095f93a712bbe6d024c8c1d975b6f5.tar.bz2
posix: Add pthread_setschedprio()
Close #2734.
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r--testsuites/psxtests/psx05/init.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuites/psxtests/psx05/init.c b/testsuites/psxtests/psx05/init.c
index 6e7229e42f..bbc863afae 100644
--- a/testsuites/psxtests/psx05/init.c
+++ b/testsuites/psxtests/psx05/init.c
@@ -200,6 +200,16 @@ static void test_set_priority( void )
rtems_test_assert( counter == 1 );
+ status = pthread_setschedprio( pthread_self(), param.sched_priority + 1 );
+ rtems_test_assert( status == 0 );
+
+ rtems_test_assert( counter == 1 );
+
+ status = pthread_setschedprio( pthread_self(), param.sched_priority );
+ rtems_test_assert( status == 0 );
+
+ rtems_test_assert( counter == 1 );
+
counter = -1;
sched_yield();
@@ -209,6 +219,25 @@ static void test_set_priority( void )
rtems_test_assert( counter == -1 );
}
+static void test_errors_pthread_setschedprio( void )
+{
+ int status;
+ int policy;
+ struct sched_param param;
+
+ status = pthread_getschedparam( pthread_self(), &policy, &param );
+ rtems_test_assert( status == 0 );
+
+ status = pthread_setschedprio( pthread_self(), INT_MAX );
+ rtems_test_assert( status == EINVAL );
+
+ status = pthread_setschedprio( 0xdeadbeef, param.sched_priority );
+ rtems_test_assert( status == ESRCH );
+
+ status = pthread_setschedprio( pthread_self(), param.sched_priority );
+ rtems_test_assert( status == 0 );
+}
+
void *POSIX_Init(
void *argument
)
@@ -232,6 +261,7 @@ void *POSIX_Init(
test_get_priority();
test_set_priority();
+ test_errors_pthread_setschedprio();
/* set the time of day, and print our buffer in multiple ways */