diff options
Diffstat (limited to 'testsuites/psxtests/psxrwlock01/test.c')
-rw-r--r-- | testsuites/psxtests/psxrwlock01/test.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxrwlock01/test.c b/testsuites/psxtests/psxrwlock01/test.c index f91f9838c8..e201293328 100644 --- a/testsuites/psxtests/psxrwlock01/test.c +++ b/testsuites/psxtests/psxrwlock01/test.c @@ -104,6 +104,7 @@ int main( #endif { pthread_rwlock_t rwlock; + pthread_rwlock_t rwlock2; pthread_rwlockattr_t attr; int status; int p; @@ -153,6 +154,42 @@ int main( status = pthread_rwlockattr_setpshared( &attr, ~PTHREAD_PROCESS_PRIVATE ); rtems_test_assert( status == EINVAL ); + /*************** AUTO INITIALIZATION *****************/ + + rwlock = PTHREAD_RWLOCK_INITIALIZER; + rwlock2 = PTHREAD_RWLOCK_INITIALIZER; + + status = pthread_rwlock_rdlock( &rwlock ); + rtems_test_assert( status == 0 ); + + status = pthread_rwlock_rdlock( &rwlock2 ); + rtems_test_assert( status == EINVAL ); + + status = pthread_rwlock_destroy( &rwlock ); + rtems_test_assert( status == 0 ); + + status = pthread_rwlock_rdlock( &rwlock2 ); + rtems_test_assert( status == 0 ); + + status = pthread_rwlock_destroy( &rwlock ); + rtems_test_assert( status == 0 ); + + rwlock = PTHREAD_RWLOCK_INITIALIZER; + rwlock2 = PTHREAD_RWLOCK_INITIALIZER; + + status = pthread_rwlock_rdlock( &rwlock ); + rtems_test_assert( status == 0 ); + + status = pthread_rwlock_destroy( &rwlock2 ); + rtems_test_assert( status == EINVAL ); + + status = pthread_rwlock_destroy( &rwlock ); + rtems_test_assert( status == 0 ); + + status = pthread_rwlock_destroy( &rwlock2 ); + rtems_test_assert( status == 0 ); + rtems_test_assert( rwlock2 != PTHREAD_RWLOCK_INITIALIZER ); + /*************** ACTUALLY WORK THIS TIME *****************/ puts( "pthread_rwlockattr_init( &attr ) -- OK" ); status = pthread_rwlockattr_init( &attr ); |