]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add more sem_timedwait tests.
authorUlrich Drepper <drepper@redhat.com>
Sun, 19 Jul 2009 05:07:25 +0000 (22:07 -0700)
committerUlrich Drepper <drepper@redhat.com>
Sun, 19 Jul 2009 05:07:25 +0000 (22:07 -0700)
nptl/ChangeLog
nptl/Makefile
nptl/tst-sem5.c

index 44f984636514068d58ae593798985bb7d48a1780..dc576a7d51e83a7409b5711ee7580944375e6db1 100644 (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.
index 42a0b86282a9f56da3514448be0ba4489d4c1740..f96ed458e6d01469c83631b201388eef7d799ee1 100644 (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
index cb85b8e7690de3696bda8eb09d0eb685553186bb..d3ebe26a403fe02ec4880de9ef9ceb42c0d8e528 100644 (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;
 }