Skip to content

Commit

Permalink
Add more sem_timedwait tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Jul 19, 2009
1 parent 32c6c34 commit 3d77b26
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 2 additions & 0 deletions nptl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
16 changes: 15 additions & 1 deletion nptl/tst-sem5.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 3d77b26

Please sign in to comment.