From 3d77b2687f984700f40e26e0fb06c99eeea1c033 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 18 Jul 2009 22:07:25 -0700 Subject: Add more sem_timedwait tests. --- nptl/ChangeLog | 3 +++ nptl/Makefile | 2 ++ nptl/tst-sem5.c | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 44f9846365..dc576a7d51 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,5 +1,8 @@ 2009-07-18 Ulrich Drepper + * 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. diff --git a/nptl/Makefile b/nptl/Makefile index 42a0b86282..f96ed458e6 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -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 diff --git a/nptl/tst-sem5.c b/nptl/tst-sem5.c index cb85b8e769..d3ebe26a40 100644 --- a/nptl/tst-sem5.c +++ b/nptl/tst-sem5.c @@ -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 , 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; } -- cgit v1.2.3