diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-10-08 10:31:36 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-10-08 11:26:27 +0200 |
commit | b9f952254b7f9afeb287ab6d846a56a512a480d3 (patch) | |
tree | 67d466d323a07abad18465bbfa1572097bb645ab /testsuites | |
parent | posix: Fix mutex auto initialization (diff) | |
download | rtems-b9f952254b7f9afeb287ab6d846a56a512a480d3.tar.bz2 |
posix: Add auto initializaton for rwlock
Diffstat (limited to 'testsuites')
-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 ); |