diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-09-27 15:08:33 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-10-05 14:29:02 +0200 |
commit | de59c065c57cb8526662ee6da28a57ad16fdde66 (patch) | |
tree | 21f4a2adbd58f65f722051bca435572fbf5dcf05 /testsuites/psxtests/psxautoinit01 | |
parent | 5222488573e3ba8c2eceffe29f878a73a3a81694 (diff) |
posix: Implement self-contained POSIX mutex
POSIX mutexes are now available in all configurations and no longer
depend on --enable-posix.
Update #2514.
Update #3112.
Diffstat (limited to 'testsuites/psxtests/psxautoinit01')
-rw-r--r-- | testsuites/psxtests/psxautoinit01/init.c | 23 | ||||
-rw-r--r-- | testsuites/psxtests/psxautoinit01/psxautoinit01.scn | 7 |
2 files changed, 6 insertions, 24 deletions
diff --git a/testsuites/psxtests/psxautoinit01/init.c b/testsuites/psxtests/psxautoinit01/init.c index f22cb1dc9d..9001de2306 100644 --- a/testsuites/psxtests/psxautoinit01/init.c +++ b/testsuites/psxtests/psxautoinit01/init.c @@ -25,23 +25,17 @@ void *POSIX_Init( ) { int sc; - pthread_mutex_t mutex1; - pthread_mutex_t mutex2; + pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; int prioceiling; TEST_BEGIN(); /* path using mutex get with interrupts disabled */ - mutex1 = PTHREAD_MUTEX_INITIALIZER; - mutex2 = PTHREAD_MUTEX_INITIALIZER; puts( "Init - pthread_mutex_lock - auto initialize - OK" ); sc = pthread_mutex_lock( &mutex1 ); fatal_posix_service_status( sc, 0, "mutex lock OK" ); - puts( "Init - pthread_mutex_lock - auto initialize - EINVAL" ); - sc = pthread_mutex_lock( &mutex2 ); - fatal_posix_service_status( sc, EINVAL, "mutex lock EINVAL" ); - puts( "Init - pthread_mutex_unlock - OK" ); sc = pthread_mutex_unlock( &mutex1 ); fatal_posix_service_status( sc, 0, "mutex unlock OK" ); @@ -51,22 +45,14 @@ void *POSIX_Init( fatal_posix_service_status( sc, 0, "mutex destroy OK" ); /* path using mutex get with dispatching disabled */ - mutex1 = PTHREAD_MUTEX_INITIALIZER; - mutex2 = PTHREAD_MUTEX_INITIALIZER; puts( "Init - pthread_mutex_getprioceiling - auto initialize - OK" ); prioceiling = 1; - sc = pthread_mutex_getprioceiling( &mutex1, &prioceiling ); + sc = pthread_mutex_getprioceiling( &mutex2, &prioceiling ); fatal_posix_service_status( sc, 0, "mutex getprioceiling OK" ); rtems_test_assert( prioceiling == 0 ); - puts( "Init - pthread_mutex_getprioceiling - auto initialize - EINVAL" ); - prioceiling = 1; - sc = pthread_mutex_getprioceiling( &mutex2, &prioceiling ); - fatal_posix_service_status( sc, EINVAL, "mutex getprioceiling EINVAL" ); - rtems_test_assert( prioceiling == 1 ); - puts( "Init - pthread_mutex_destroy - OK" ); - sc = pthread_mutex_destroy( &mutex1 ); + sc = pthread_mutex_destroy( &mutex2 ); fatal_posix_service_status( sc, 0, "mutex destroy OK" ); TEST_END(); @@ -81,7 +67,6 @@ void *POSIX_Init( #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 -#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1 #define CONFIGURE_POSIX_INIT_THREAD_TABLE diff --git a/testsuites/psxtests/psxautoinit01/psxautoinit01.scn b/testsuites/psxtests/psxautoinit01/psxautoinit01.scn index 9293acc626..3638ac4e94 100644 --- a/testsuites/psxtests/psxautoinit01/psxautoinit01.scn +++ b/testsuites/psxtests/psxautoinit01/psxautoinit01.scn @@ -1,10 +1,7 @@ -*** POSIX TEST -- AUTOMATIC INITIALIZAITON 01 *** +*** BEGIN OF TEST PSXAUTOINIT 1 *** Init - pthread_mutex_lock - auto initialize - OK -Init - pthread_mutex_lock - auto initialize - EINVAL Init - pthread_mutex_unlock - OK Init - pthread_mutex_destroy - OK Init - pthread_mutex_getprioceiling - auto initialize - OK -Init - pthread_mutex_getprioceiling - auto initialize - EINVAL Init - pthread_mutex_destroy - OK -*** END OF POSIX TEST AUTOMATIC INITIALIZATION 01 *** - +*** END OF TEST PSXAUTOINIT 1 *** |