From 46f08961a22ff7ffc6196971c0ff04006689ded1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 7 Oct 2022 07:14:02 +0200 Subject: psxrwlock01: Use an initilized lock for tests Close #4738. --- testsuites/psxtests/psxrwlock01/test.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'testsuites/psxtests') diff --git a/testsuites/psxtests/psxrwlock01/test.c b/testsuites/psxtests/psxrwlock01/test.c index 5767aa7c07..f6954007c0 100644 --- a/testsuites/psxtests/psxrwlock01/test.c +++ b/testsuites/psxtests/psxrwlock01/test.c @@ -454,10 +454,6 @@ int main( status = pthread_rwlock_timedrdlock( NULL, &abstime); rtems_test_assert( status == EINVAL ); - puts( "pthread_rwlock_timedrdlock( &rwlock, NULL) -- EINVAL" ); - status = pthread_rwlock_timedrdlock( &rwlock, NULL); - rtems_test_assert( status == EINVAL ); - puts( "pthread_rwlock_tryrdlock(NULL) -- EINVAL" ); status = pthread_rwlock_tryrdlock(NULL); rtems_test_assert( status == EINVAL ); @@ -470,10 +466,6 @@ int main( status = pthread_rwlock_timedwrlock( NULL, &abstime ); rtems_test_assert( status == EINVAL ); - puts( "pthread_rwlock_timedwrlock( &rwlock, NULL) -- EINVAL" ); - status = pthread_rwlock_timedwrlock( &rwlock, NULL); - rtems_test_assert( status == EINVAL ); - puts( "pthread_rwlock_trywrlock(NULL) -- EINVAL" ); status = pthread_rwlock_trywrlock(NULL); rtems_test_assert( status == EINVAL ); @@ -482,6 +474,26 @@ int main( status = pthread_rwlock_unlock(NULL); rtems_test_assert( status == EINVAL ); + status = pthread_rwlock_init( &rwlock, NULL ); + rtems_test_assert( status == 0 ); + + status = pthread_rwlock_wrlock( &rwlock ); + rtems_test_assert( status == 0 ); + + puts( "pthread_rwlock_timedrdlock( &rwlock, NULL) -- EINVAL" ); + status = pthread_rwlock_timedrdlock( &rwlock, NULL); + rtems_test_assert( status == EINVAL ); + + puts( "pthread_rwlock_timedwrlock( &rwlock, NULL) -- EINVAL" ); + status = pthread_rwlock_timedwrlock( &rwlock, NULL); + rtems_test_assert( status == EINVAL ); + + status = pthread_rwlock_unlock( &rwlock ); + rtems_test_assert( status == 0 ); + + status = pthread_rwlock_destroy( &rwlock ); + rtems_test_assert( status == 0 ); + /*************** BAD ID CHECK *****************/ /* make a valid abstime */ puts( "clock_gettime(CLOCK_REALTIME, &abstime) -- OK" ); -- cgit v1.2.3