summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psx05
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-14 06:50:38 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-22 14:00:27 +0200
commitce6e9ec22f3a4ba976c9de2b7b0fbe646f1b36de (patch)
tree1927796575a82887ae53875d7ceb05599f8a0264 /testsuites/psxtests/psx05
parentsparc: Optimize CPU counter support (diff)
downloadrtems-ce6e9ec22f3a4ba976c9de2b7b0fbe646f1b36de.tar.bz2
posix: pthread_mutexattr_setprioceiling()
Accept all priority values in pthread_mutexattr_setprioceiling(). This is in line with POSIX and FreeBSD. The priority is validated in pthread_mutex_init(). Validate the priority only for priority ceiling mutexes.
Diffstat (limited to 'testsuites/psxtests/psx05')
-rw-r--r--testsuites/psxtests/psx05/init.c23
-rw-r--r--testsuites/psxtests/psx05/psx05.scn13
2 files changed, 23 insertions, 13 deletions
diff --git a/testsuites/psxtests/psx05/init.c b/testsuites/psxtests/psx05/init.c
index bbc863afae..5f39b2f16a 100644
--- a/testsuites/psxtests/psx05/init.c
+++ b/testsuites/psxtests/psx05/init.c
@@ -16,6 +16,7 @@
#define CONFIGURE_INIT
#include "system.h"
#include <errno.h>
+#include <limits.h>
#include <rtems/score/todimpl.h>
@@ -375,11 +376,13 @@ void *POSIX_Init(
status = pthread_mutexattr_setprioceiling( NULL, 128 );
rtems_test_assert( status == EINVAL );
- puts( "Init: pthread_mutexattr_setprioceiling - EINVAL (invalid priority)" );
- status = pthread_mutexattr_setprioceiling( &attr, 512 );
- if ( status != EINVAL )
- printf( "status = %d\n", status );
- rtems_test_assert( status == EINVAL );
+ puts( "Init: pthread_mutexattr_setprioceiling - SUCCESSFUL (priority INT_MAX)" );
+ status = pthread_mutexattr_setprioceiling( &attr, INT_MAX );
+ rtems_test_assert( status == 0 );
+
+ puts( "Init: pthread_mutexattr_setprioceiling - SUCCESSFUL (priority INT_MIN)" );
+ status = pthread_mutexattr_setprioceiling( &attr, INT_MIN );
+ rtems_test_assert( status == 0 );
puts( "Init: pthread_mutexattr_setprioceiling - EINVAL (not initialized)" );
status = pthread_mutexattr_setprioceiling( &destroyed_attr, -1 );
@@ -409,9 +412,13 @@ void *POSIX_Init(
status = pthread_mutex_init( &Mutex_id, &attr );
rtems_test_assert( status == EINVAL );
- /* must get around error checks in attribute set routines */
- attr.protocol = PTHREAD_PRIO_INHERIT;
- attr.prio_ceiling = -1;
+ puts( "Init: pthread_mutexattr_setprotocol - SUCCESSFUL" );
+ status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT );
+ rtems_test_assert( !status );
+
+ puts( "Init: pthread_mutexattr_setprioceiling - SUCCESSFUL" );
+ status = pthread_mutexattr_setprioceiling( &attr, -1 );
+ rtems_test_assert( !status );
puts( "Init: pthread_mutex_init - EINVAL (bad priority ceiling)" );
status = pthread_mutex_init( &Mutex_id, &attr );
diff --git a/testsuites/psxtests/psx05/psx05.scn b/testsuites/psxtests/psx05/psx05.scn
index 8fa3e23fcd..4e66ceabf6 100644
--- a/testsuites/psxtests/psx05/psx05.scn
+++ b/testsuites/psxtests/psx05/psx05.scn
@@ -1,4 +1,4 @@
-*** POSIX TEST 5 ***
+*** BEGIN OF TEST PSX 5 ***
Init's ID is 0x0b010001
Init: pthread_mutexattr_init - EINVAL (NULL attr)
Init: pthread_mutexattr_init - SUCCESSFUL
@@ -26,12 +26,15 @@ Init: pthread_mutexattr_getprioceiling - EINVAL (NULL attr)
Init: pthread_mutexattr_getprioceiling - EINVAL (NULL prioceiling)
Init: pthread_mutexattr_getprioceiling - EINVAL (not initialized)
Init: pthread_mutexattr_setprioceiling - EINVAL (NULL attr)
-Init: pthread_mutexattr_setprioceiling - EINVAL (invalid priority)
+Init: pthread_mutexattr_setprioceiling - SUCCESSFUL (priority INT_MAX)
+Init: pthread_mutexattr_setprioceiling - SUCCESSFUL (priority INT_MIN)
Init: pthread_mutexattr_setprioceiling - EINVAL (not initialized)
Init: pthread_mutex_init - EINVAL (NULL mutex_id)
Init: pthread_mutex_init - EINVAL (not initialized attr)
Init: pthread_mutex_init - EINVAL (bad protocol)
+Init: pthread_mutexattr_setprotocol - SUCCESSFUL
+Init: pthread_mutexattr_setprioceiling - SUCCESSFUL
Init: pthread_mutex_init - EINVAL (bad priority ceiling)
Init: Resetting mutex attributes
Init: pthread_mutex_init - ENOSYS (process wide scope)
@@ -82,7 +85,7 @@ Init: pthread_mutex_init - SUCCESSFUL
Init: pthread_mutex_trylock - SUCCESSFUL
Init: pthread_setschedparam - Setting Task2 priority to highest
Task 2: pthread_mutex_lock unavailable (inherit case)
-Init: pthread_getschedparam - priority = 254
+Init: pthread_getschedparam - priority = 2
Init: pthread_mutex_unlock - SUCCESSFUL
Task 2: mutex acquired
Task 2: unlock Mutex 2
@@ -103,7 +106,7 @@ Init: pthread_mutex_setprioceiling - new ceiling = 200
Init: pthread_mutex_setprioceiling - old ceiling = 254
Init: pthread_getschedparam - priority = 2
Init: pthread_mutex_trylock - SUCCESSFUL
-Init: pthread_getschedparam - priority = 200
+Init: pthread_getschedparam - priority = 2
Init: pthread_setschedparam - set Task3 priority to highest
Init: Sleep 1 second
Task 3: pthread_mutex_lock unavailable (inherit case)
@@ -116,4 +119,4 @@ Init: pthread_mutex_getprioceiling- ceiling = 200
Init: pthread_setschedparam - set Init priority to highest
Init: pthread_mutex_lock - EINVAL (priority ceiling violation)
Init: Recursive Mutex
-*** END OF POSIX TEST 5 ***
+*** END OF TEST PSX 5 ***