Message ID | YKZbIRWyUtVwAlWg@redhat.com |
---|---|
State | New |
Headers | show |
Series | testsuite: Use libstdc++ macro to check for pthread_cond_clockwait [PR 100655] | expand |
On 20/05/21 13:50 +0100, Jonathan Wakely wrote: >Also add dg-shouldfail to ignore failures due to ulimit. > >gcc/testsuite/ChangeLog: > > PR testsuite/100655 > * g++.dg/tsan/pthread_cond_clockwait.C: Use libstdc++ macro to > check for availability of pthread_cond_clockwait. Add > dg-shouldfail. > >Tested x86_64-linux (glibc 2.23) and powerpc64le-linux (glibc 2.17) > Jakub pointed out on IRC that the shouldfail here is wrong. Path withdrawn (and I'm not working on this any more).
diff --git a/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C index 82d6a5c8329..c6c621bea51 100644 --- a/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C +++ b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C @@ -1,9 +1,14 @@ // Test pthread_cond_clockwait not generating false positives with tsan +/* { dg-shouldfail "tsan" } */ // { dg-do run { target { { *-*-linux* *-*-gnu* *-*-uclinux* } && pthread } } } // { dg-options "-fsanitize=thread -lpthread" } #include <pthread.h> +// Include this to get the libstdc++ _GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT +// macro that indicates pthread_cond_clockwait is available. +#include <type_traits> + pthread_cond_t cv; pthread_mutex_t mtx; @@ -23,7 +28,9 @@ int main() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += 10; +#ifdef _GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT pthread_cond_clockwait(&cv, &mtx, CLOCK_MONOTONIC, &ts); +#endif pthread_mutex_unlock(&mtx); pthread_join(tid, NULL);