From 3f72dda6ee518d3ea04341ad4df079ecb1895ef7 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 25 May 2016 08:37:28 +0200 Subject: posix: Fix pthread_spin_unlock() error status Update #2719. --- testsuites/psxtests/psxspin01/psxspin01.scn | 7 ++++--- testsuites/psxtests/psxspin01/test.c | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'testsuites') diff --git a/testsuites/psxtests/psxspin01/psxspin01.scn b/testsuites/psxtests/psxspin01/psxspin01.scn index 87ea2dbdbb..5c0e752969 100644 --- a/testsuites/psxtests/psxspin01/psxspin01.scn +++ b/testsuites/psxtests/psxspin01/psxspin01.scn @@ -1,4 +1,4 @@ -*** POSIX SPINLOCK TEST 01 *** +*** BEGIN OF TEST PSXSPIN 1 *** pthread_spin_init( NULL, PTHREAD_PROCESS_PRIVATE ) -- EINVAL pthread_spin_init( NULL, PTHREAD_PROCESS_SHARED ) -- EINVAL pthread_spin_init( &spinlock, 0x1234 ) -- EINVAL @@ -14,7 +14,7 @@ pthread_spin_lock( &spinlock ) -- EINVAL pthread_spin_trylock( &spinlock ) -- EINVAL pthread_spin_unlock( &spinlock ) -- EINVAL pthread_spin_destroy( &spinlock ) -- EINVAL -pthread_spin_unlock( &Spinlock ) -- already unlocked OK +pthread_spin_unlock( &Spinlock ) -- EPERM pthread_spin_lock( &Spinlock ) -- OK pthread_spin_lock( &Spinlock ) -- EDEADLK pthread_spin_trylock( &Spinlock ) -- EDEADLK @@ -23,9 +23,10 @@ pthread_spin_trylock( &Spinlock ) -- OK pthread_spin_unlock( &Spinlock ) -- OK pthread_spin_lock( &Spinlock ) from Thread -- OK sleep to allow main thread to run +pthread_spin_unlock( &Spinlock ) -- EPERM pthread_spin_lock( &Spinlock ) -- OK pthread_spin_unlock( &Spinlock ) from Thread -- OK pthread_spin_destroy( &Spinlock ) -- EBUSY pthread_spin_unlock( &Spinlock ) -- OK pthread_spin_destroy( &Spinlock ) -- OK -*** END OF POSIX SPINLOCK TEST 01 *** +*** END OF TEST PSXSPIN 1 *** diff --git a/testsuites/psxtests/psxspin01/test.c b/testsuites/psxtests/psxspin01/test.c index f6fda64c75..270cdcfc86 100644 --- a/testsuites/psxtests/psxspin01/test.c +++ b/testsuites/psxtests/psxspin01/test.c @@ -146,9 +146,9 @@ int main( status = pthread_spin_destroy( &spinlock ); rtems_test_assert( status == EINVAL ); - puts( "pthread_spin_unlock( &Spinlock ) -- already unlocked OK" ); + puts( "pthread_spin_unlock( &Spinlock ) -- EPERM" ); status = pthread_spin_unlock( &Spinlock ); - rtems_test_assert( status == 0 ); + rtems_test_assert( status == EPERM ); /* Now some basic locking and unlocking with a deadlock verification */ puts( "pthread_spin_lock( &Spinlock ) -- OK" ); @@ -200,6 +200,11 @@ int main( */ mainThreadSpinning = 1; + + puts( "pthread_spin_unlock( &Spinlock ) -- EPERM" ); + status = pthread_spin_unlock( &Spinlock ); + rtems_test_assert( status == EPERM ); + puts( "pthread_spin_lock( &Spinlock ) -- OK" ); status = pthread_spin_lock( &Spinlock ); rtems_test_assert( status == 0 ); -- cgit v1.2.3