From f9ff8cea68a7884a2dd88fa71270570750351ef2 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 1 Jul 2009 16:15:21 +0000 Subject: 2009-07-01 Santosh G Vattam * psxrwlock01/psxrwlock01.scn, psxrwlock01/test.c: Add test case for obtaining rwlock for write with a timed lock operation when the abstime timeout is in the past. --- testsuites/psxtests/ChangeLog | 6 ++++++ testsuites/psxtests/psxrwlock01/psxrwlock01.scn | 2 ++ testsuites/psxtests/psxrwlock01/test.c | 14 ++++++++++++++ 3 files changed, 22 insertions(+) (limited to 'testsuites/psxtests') diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index 2517771a65..214a565925 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,3 +1,9 @@ +2009-07-01 Santosh G Vattam + + * psxrwlock01/psxrwlock01.scn, psxrwlock01/test.c: Add test case for + obtaining rwlock for write with a timed lock operation when the + abstime timeout is in the past. + 2009-06-30 Joel Sherrill * psxrwlock01/psxrwlock01.scn, psxrwlock01/test.c: Add test case for diff --git a/testsuites/psxtests/psxrwlock01/psxrwlock01.scn b/testsuites/psxtests/psxrwlock01/psxrwlock01.scn index 4f563d7a70..4a4c7d05a8 100644 --- a/testsuites/psxtests/psxrwlock01/psxrwlock01.scn +++ b/testsuites/psxtests/psxrwlock01/psxrwlock01.scn @@ -75,6 +75,8 @@ pthread_rwlock_timedwrlock( &RWLock, &abstime) -- OK WriteThread - pthread_rwlock_unlock(RWLock) -- OK pthread_rwlock_timedrdlock( &RWLock, &abstime) -- ETIMEDOUT pthread_rwlock_timedrdlock( &RWLock, &abstime) -- ETIMEDOUT +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 *** END OF POSIX RWLOCK TEST 01 *** diff --git a/testsuites/psxtests/psxrwlock01/test.c b/testsuites/psxtests/psxrwlock01/test.c index 75f84eab66..404385e9a3 100644 --- a/testsuites/psxtests/psxrwlock01/test.c +++ b/testsuites/psxtests/psxrwlock01/test.c @@ -379,6 +379,11 @@ int main( status = pthread_rwlock_timedrdlock( &RWLock, &abstime ); assert( status == ETIMEDOUT ); + abstime.tv_sec -= 1; + puts( "pthread_rwlock_timedwrlock( &RWLock, &abstime) -- ETIMEDOUT" ); + status = pthread_rwlock_timedwrlock( &RWLock, &abstime ); + assert( status == ETIMEDOUT ); + /*************** OBTAIN RWLOCK WITH ABSTIME IN PAST ***************/ status = pthread_rwlock_unlock(&RWLock); assert( !status ); @@ -388,6 +393,15 @@ int main( status = pthread_rwlock_timedrdlock( &RWLock, &abstime ); assert( status == 0 ); + /*************** OBTAIN RWLOCK FOR WRITE WITH ABSTIME IN PAST ***************/ + status = pthread_rwlock_unlock(&RWLock); + assert( !status ); + + abstime.tv_sec -= 1; + puts( "pthread_rwlock_timedwrlock( &RWLock, &abstime) -- in past -- OK" ); + status = pthread_rwlock_timedwrlock( &RWLock, &abstime ); + assert( status == 0 ); + /*************** DESTROY RWLOCK ***************/ puts( "pthread_rwlock_destroy( &RWLock ) -- OK" ); status = pthread_rwlock_destroy( &RWLock ); -- cgit v1.2.3