Add more sem_timedwait tests.

This commit is contained in:
Ulrich Drepper 2009-07-18 22:07:25 -07:00
parent 32c6c342b6
commit 3d77b2687f
3 changed files with 20 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2009-07-18 Ulrich Drepper <drepper@redhat.com>
* tst-sem5.c (do_test): Add test for premature timeout.
* Makefile: Linu tst-sem5 with librt.
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
(pthread_rwlock_timedwrlock): If possible use FUTEX_WAIT_BITSET to
directly use absolute timeout.

View File

@ -479,6 +479,7 @@ $(objpfx)tst-fini1: $(shared-thread-library) $(objpfx)tst-fini1mod.so
ifeq (yes,$(build-shared))
$(objpfx)tst-cond11: $(common-objpfx)rt/librt.so
$(objpfx)tst-cond19: $(common-objpfx)rt/librt.so
$(objpfx)tst-sem5: $(common-objpfx)rt/librt.so
$(objpfx)tst-cancel17: $(common-objpfx)rt/librt.so
$(objpfx)tst-cancelx17: $(common-objpfx)rt/librt.so
$(objpfx)tst-cancel18: $(common-objpfx)rt/librt.so
@ -492,6 +493,7 @@ $(objpfx)tst-_res1: $(objpfx)tst-_res1mod2.so $(shared-thread-library)
else
$(objpfx)tst-cond11: $(common-objpfx)rt/librt.a
$(objpfx)tst-cond19: $(common-objpfx)rt/librt.a
$(objpfx)tst-sem5: $(common-objpfx)rt/librt.a
$(objpfx)tst-cancel17: $(common-objpfx)rt/librt.a
$(objpfx)tst-cancelx17: $(common-objpfx)rt/librt.a
$(objpfx)tst-cancel18: $(common-objpfx)rt/librt.a

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -73,6 +73,20 @@ do_test (void)
return 1;
}
struct timespec ts2;
if (clock_gettime (CLOCK_REALTIME, &ts2) != 0)
{
puts ("clock_gettime failed");
return 1;
}
if (ts2.tv_sec < ts.tv_sec
|| (ts2.tv_sec == ts.tv_sec && ts2.tv_nsec < ts.tv_nsec))
{
puts ("timeout too short");
return 1;
}
return 0;
}