|
From: Florian K. <br...@ac...> - 2011-10-27 13:59:48
|
On 10/27/2011 03:07 AM, Julian Seward wrote:
>
> So I don't think there's a redir bug.
>
Oh, good. Thanks for the details.
> Now, why it's linked against librt instead of libpthread, I have no
> idea. Can you get any useful info from svn ann and then svn log of
> the relevant Makefile.am?
Actually, the way the testcase is written it does require linking
against -lrt. Otherwise, function clock_gettime will not be found.
When I was debugging it yesterday, I had compressed the testcase and
eliminated the clock_gettime call.
The testcase came into existence in r12164 calling clock_gettime on
all platforms.
In r12213 Bart made the testcase work on Darwin with this patch:
+
+#ifdef HAVE_CLOCK_GETTIME
assert(clock_gettime(CLOCK_REALTIME, &abstime)==0);
+#else
+ abstime.tv_sec = time(NULL) + 2;
+ abstime.tv_nsec = 0;
+#endif
Reading through the man pages suggests that we should be able to use the
#else clause on Linux as well and thereby eliminate the need for -lrt.
I'm suggesting this patch:
Index: helgrind/tests/cond_timedwait_invalid.c
===================================================================
--- helgrind/tests/cond_timedwait_invalid.c (revision 12237)
+++ helgrind/tests/cond_timedwait_invalid.c (working copy)
@@ -1,4 +1,4 @@
-#include "config.h"
+
#include <time.h>
#include <pthread.h>
#include <assert.h>
@@ -10,12 +10,12 @@
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-#ifdef HAVE_CLOCK_GETTIME
- assert(clock_gettime(CLOCK_REALTIME, &abstime)==0);
-#else
+
+
+
abstime.tv_sec = time(NULL) + 2;
abstime.tv_nsec = 0;
-#endif
+
abstime.tv_nsec += 1000000000;
assert(pthread_mutex_lock(&mutex)==0);
Index: helgrind/tests/Makefile.am
===================================================================
--- helgrind/tests/Makefile.am (revision 12237)
+++ helgrind/tests/Makefile.am (working copy)
@@ -185,8 +185,3 @@
else
annotate_hbefore_CFLAGS = $(AM_CFLAGS)
endif
-
-if VGCONF_OS_IS_LINUX
-cond_timedwait_invalid_LDADD = -lrt
-endif
-
With this patch is passes on x86 and also on that old s390x system I'm
using. The testcase was failing there as well with the same symptom.
Florian
|