From 0c34dbf341095f93a712bbe6d024c8c1d975b6f5 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 13 Jun 2016 15:22:47 +0200 Subject: posix: Add pthread_setschedprio() Close #2734. --- testsuites/psxtests/psx05/init.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'testsuites/psxtests') 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, ¶m ); + 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 */ -- cgit v1.2.3