(tests): Add tst-rwlock2a.

This commit is contained in:
Ulrich Drepper 2008-05-31 08:56:14 +00:00
parent e4d6e7f5c0
commit 10bb97c793
3 changed files with 32 additions and 4 deletions

View File

@ -210,9 +210,9 @@ tests = tst-typesizes \
tst-robust6 tst-robust7 tst-robust8 tst-robust9 \
tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 tst-robustpi5 \
tst-robustpi6 tst-robustpi7 tst-robustpi8 tst-robustpi9 \
tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \
tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \
tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
tst-rwlock1 tst-rwlock2 tst-rwlock2a tst-rwlock3 tst-rwlock4 \
tst-rwlock5 tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 \
tst-rwlock10 tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
tst-once1 tst-once2 tst-once3 tst-once4 \
tst-key1 tst-key2 tst-key3 tst-key4 \
tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \

View File

@ -26,15 +26,41 @@ static int
do_test (void)
{
pthread_rwlock_t r;
pthread_rwlockattr_t at;
int e;
if (pthread_rwlock_init (&r, NULL) != 0)
if (pthread_rwlockattr_init (&at) != 0)
{
puts ("rwlockattr_init failed");
return 1;
}
puts ("rwlockattr_init succeeded");
#ifndef TYPE
# define TYPE PTHREAD_RWLOCK_PREFER_READER_NP
#endif
if (pthread_rwlockattr_setkind_np (&at, TYPE) != 0)
{
puts ("rwlockattr_setkind failed");
return 1;
}
puts ("rwlockattr_setkind succeeded");
if (pthread_rwlock_init (&r, &at) != 0)
{
puts ("rwlock_init failed");
return 1;
}
puts ("rwlock_init succeeded");
if (pthread_rwlockattr_destroy (&at) != 0)
{
puts ("rwlockattr_destroy failed");
return 1;
}
puts ("rwlockattr_destroy succeeded");
if (pthread_rwlock_wrlock (&r) != 0)
{
puts ("1st rwlock_wrlock failed");

2
nptl/tst-rwlock2a.c Normal file
View File

@ -0,0 +1,2 @@
#define TYPE PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
#include "tst-rwlock2.c"