From c6dc6db0743f49b765ac2d67e2734a0e27efb5f4 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sat, 4 Jul 2009 20:26:18 +0000 Subject: [PATCH] 2009-07-04 Santosh G Vattam * psxrwlock01/psxrwlock01.scn, psxrwlock01/test.c: Add test case for obtaining an rwlock and then releasing it twice. --- testsuites/psxtests/ChangeLog | 5 +++++ testsuites/psxtests/psxrwlock01/psxrwlock01.scn | 3 +++ testsuites/psxtests/psxrwlock01/test.c | 14 ++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index 584a9628b3..cde955bd33 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,3 +1,8 @@ +2009-07-04 Santosh G Vattam + + * psxrwlock01/psxrwlock01.scn, psxrwlock01/test.c: Add test case for + obtaining an rwlock and then releasing it twice. + 2009-07-03 Joel Sherrill * psxenosys/init.c, psxenosys/psxenosys.scn: Add test of vfork stub. diff --git a/testsuites/psxtests/psxrwlock01/psxrwlock01.scn b/testsuites/psxtests/psxrwlock01/psxrwlock01.scn index 4a4c7d05a8..578c5f54c7 100644 --- a/testsuites/psxtests/psxrwlock01/psxrwlock01.scn +++ b/testsuites/psxtests/psxrwlock01/psxrwlock01.scn @@ -79,4 +79,7 @@ pthread_rwlock_timedwrlock( &RWLock, &abstime) -- ETIMEDOUT pthread_rwlock_timedrdlock( &RWLock, &abstime) -- in past -- OK pthread_rwlock_timedwrlock( &RWLock, &abstime) -- in past -- OK pthread_rwlock_destroy( &RWLock ) -- OK +pthread_rwlock_init( &rwlock, NULL ) -- OK +pthread_rwlock_unlock ( &rwlock ) -- OK +pthread_rwlock_unlock ( &rwlock ) -- OK *** END OF POSIX RWLOCK TEST 01 *** diff --git a/testsuites/psxtests/psxrwlock01/test.c b/testsuites/psxtests/psxrwlock01/test.c index 404385e9a3..fa5a92bc1b 100644 --- a/testsuites/psxtests/psxrwlock01/test.c +++ b/testsuites/psxtests/psxrwlock01/test.c @@ -407,6 +407,20 @@ int main( status = pthread_rwlock_destroy( &RWLock ); assert( status == 0 ); + /*************** OBTAIN A LOCK AND THEN RELEASE IT TWICE ***************/ + + puts( "pthread_rwlock_init( &rwlock, NULL ) -- OK" ); + status = pthread_rwlock_init( &rwlock, NULL ); + assert( status == 0 ); + assert( rwlock != 0 ); + + puts( "pthread_rwlock_unlock ( &rwlock ) -- OK" ); + status = pthread_rwlock_unlock( &rwlock ); + assert( status == 0 ); + + puts( "pthread_rwlock_unlock ( &rwlock ) -- OK" ); + status = pthread_rwlock_unlock( &rwlock ); + assert( status == 0 ); /*************** END OF TEST *****************/ puts( "*** END OF POSIX RWLOCK TEST 01 ***" );