From: Bart Van Assche Date: Thu, 23 Jul 2009 17:22:11 +0000 (+0000) Subject: Reverted r10523 and r10540: since sem_init() is not yet supported on Darwin, revert... X-Git-Tag: svn/VALGRIND_3_5_0~287 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9937aaa0d34377c8054e6162f229a1372b3a3746;p=thirdparty%2Fvalgrind.git Reverted r10523 and r10540: since sem_init() is not yet supported on Darwin, revert the attempts to compensate for the different return values on Darwin. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10561 --- diff --git a/drd/tests/tc23_bogus_condwait.stderr.exp-linux-ppc b/drd/tests/tc23_bogus_condwait.stderr.exp-linux-ppc index e217b91567..0159ba8c41 100644 --- a/drd/tests/tc23_bogus_condwait.stderr.exp-linux-ppc +++ b/drd/tests/tc23_bogus_condwait.stderr.exp-linux-ppc @@ -1,16 +1,16 @@ The object at address 0x........ is not a mutex. at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:75) + by 0x........: main (tc23_bogus_condwait.c:69) The object at address 0x........ is not a mutex. at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:75) + by 0x........: main (tc23_bogus_condwait.c:69) Process terminating with default action of signal 7 (SIGBUS) Invalid address alignment at address 0x........ at 0x........: (within libpthread-?.?.so) - by 0x........: pthread_cond_wait@@GLIBC_2.3.2(within libpthread-?.?.so) - by 0x........: main (tc23_bogus_condwait.c:75) + by 0x........: pthread_cond_wait@@@GLIBC_2.3.2(within libpthread-?.?.so) + by 0x........: main (tc23_bogus_condwait.c:69) ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) diff --git a/drd/tests/tc23_bogus_condwait.stderr.exp-linux-x86 b/drd/tests/tc23_bogus_condwait.stderr.exp-linux-x86 index 2efe5485a9..268051de9a 100644 --- a/drd/tests/tc23_bogus_condwait.stderr.exp-linux-x86 +++ b/drd/tests/tc23_bogus_condwait.stderr.exp-linux-x86 @@ -1,96 +1,96 @@ The object at address 0x........ is not a mutex. - at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:75) + at 0x........: pthread_cond_wait@* (drd_pthread_intercepts.c:?) + by 0x........: main (tc23_bogus_condwait.c:69) The object at address 0x........ is not a mutex. - at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:75) + at 0x........: pthread_cond_wait@* (drd_pthread_intercepts.c:?) + by 0x........: main (tc23_bogus_condwait.c:69) Thread 3: Probably a race condition: condition variable 0x........ has been signaled but the associated mutex 0x........ is not locked by the signalling thread. at 0x........: pthread_cond_signal@* (drd_pthread_intercepts.c:?) - by 0x........: rescue_me (tc23_bogus_condwait.c:26) + by 0x........: rescue_me (tc23_bogus_condwait.c:20) by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?) cond 0x........ was first observed at: at 0x........: pthread_cond_init* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:62) + by 0x........: main (tc23_bogus_condwait.c:56) Thread 1: Mutex not locked: mutex 0x........, recursion count 0, owner 0. - at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:78) + at 0x........: pthread_cond_wait@* (drd_pthread_intercepts.c:?) + by 0x........: main (tc23_bogus_condwait.c:72) mutex 0x........ was first observed at: at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:57) + by 0x........: main (tc23_bogus_condwait.c:51) Thread 3: Probably a race condition: condition variable 0x........ has been signaled but the associated mutex 0x........ is not locked by the signalling thread. at 0x........: pthread_cond_signal@* (drd_pthread_intercepts.c:?) - by 0x........: rescue_me (tc23_bogus_condwait.c:30) + by 0x........: rescue_me (tc23_bogus_condwait.c:24) by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?) cond 0x........ was first observed at: at 0x........: pthread_cond_init* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:62) + by 0x........: main (tc23_bogus_condwait.c:56) mutex 0x........ was first observed at: at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:57) + by 0x........: main (tc23_bogus_condwait.c:51) Thread 1: The object at address 0x........ is not a mutex. - at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:81) + at 0x........: pthread_cond_wait@* (drd_pthread_intercepts.c:?) + by 0x........: main (tc23_bogus_condwait.c:75) rwlock 0x........ was first observed at: at 0x........: pthread_rwlock_init* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:63) + by 0x........: main (tc23_bogus_condwait.c:57) The object at address 0x........ is not a mutex. - at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:81) + at 0x........: pthread_cond_wait@* (drd_pthread_intercepts.c:?) + by 0x........: main (tc23_bogus_condwait.c:75) rwlock 0x........ was first observed at: at 0x........: pthread_rwlock_init* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:63) + by 0x........: main (tc23_bogus_condwait.c:57) Thread 3: Probably a race condition: condition variable 0x........ has been signaled but the associated mutex 0x........ is not locked by the signalling thread. at 0x........: pthread_cond_signal@* (drd_pthread_intercepts.c:?) - by 0x........: rescue_me (tc23_bogus_condwait.c:34) + by 0x........: rescue_me (tc23_bogus_condwait.c:28) by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?) cond 0x........ was first observed at: at 0x........: pthread_cond_init* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:62) + by 0x........: main (tc23_bogus_condwait.c:56) rwlock 0x........ was first observed at: at 0x........: pthread_rwlock_init* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:63) + by 0x........: main (tc23_bogus_condwait.c:57) Thread 1: Mutex not locked by calling thread: mutex 0x........, recursion count 1, owner 2. - at 0x........: pthread_cond_wait* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:84) + at 0x........: pthread_cond_wait@* (drd_pthread_intercepts.c:?) + by 0x........: main (tc23_bogus_condwait.c:78) mutex 0x........ was first observed at: at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:59) + by 0x........: main (tc23_bogus_condwait.c:53) Thread 3: Probably a race condition: condition variable 0x........ has been signaled but the associated mutex 0x........ is not locked by the signalling thread. at 0x........: pthread_cond_signal@* (drd_pthread_intercepts.c:?) - by 0x........: rescue_me (tc23_bogus_condwait.c:38) + by 0x........: rescue_me (tc23_bogus_condwait.c:32) by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?) cond 0x........ was first observed at: at 0x........: pthread_cond_init* (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:62) + by 0x........: main (tc23_bogus_condwait.c:56) mutex 0x........ was first observed at: at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:59) + by 0x........: main (tc23_bogus_condwait.c:53) The impossible happened: mutex 0x........ is locked simultaneously by two threads (recursion count 1, owners 2 and 1) ! Thread 2: Mutex not locked by calling thread: mutex 0x........, recursion count 2, owner 1. at 0x........: pthread_mutex_unlock (drd_pthread_intercepts.c:?) - by 0x........: grab_the_lock (tc23_bogus_condwait.c:48) + by 0x........: grab_the_lock (tc23_bogus_condwait.c:42) by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?) mutex 0x........ was first observed at: at 0x........: pthread_mutex_init (drd_pthread_intercepts.c:?) - by 0x........: main (tc23_bogus_condwait.c:59) + by 0x........: main (tc23_bogus_condwait.c:53) ERROR SUMMARY: 11 errors from 11 contexts (suppressed: 0 from 0) diff --git a/helgrind/tests/tc23_bogus_condwait.c b/helgrind/tests/tc23_bogus_condwait.c index b45ff0ad4d..a0fad5d5d7 100644 --- a/helgrind/tests/tc23_bogus_condwait.c +++ b/helgrind/tests/tc23_bogus_condwait.c @@ -7,12 +7,6 @@ #include #include -#ifdef __APPLE__ -#define OS_IS_DARWIN 1 -#else -#define OS_IS_DARWIN 0 -#endif - pthread_mutex_t mx[4]; pthread_cond_t cv; pthread_rwlock_t rwl; @@ -62,7 +56,7 @@ int main ( void ) r= pthread_cond_init(&cv, NULL); assert(!r); r= pthread_rwlock_init(&rwl, NULL); assert(!r); - r= sem_init( &quit_now, 0,0 ); assert(OS_IS_DARWIN || !r); + r= sem_init( &quit_now, 0,0 ); assert(!r); r= pthread_create( &grabber, NULL, grab_the_lock, NULL ); assert(!r); sleep(1); /* let the grabber get there first */ @@ -83,8 +77,8 @@ int main ( void ) /* mx is held by someone else. */ r= pthread_cond_wait(&cv, &mx[2] ); - r= sem_post( &quit_now ); assert(OS_IS_DARWIN || !r); - r= sem_post( &quit_now ); assert(OS_IS_DARWIN || !r); + r= sem_post( &quit_now ); assert(!r); + r= sem_post( &quit_now ); assert(!r); r= pthread_join( my_rescuer, NULL ); assert(!r); r= pthread_join( grabber, NULL ); assert(!r); diff --git a/helgrind/tests/tc23_bogus_condwait.stderr.exp b/helgrind/tests/tc23_bogus_condwait.stderr.exp index 7a2739fbfe..d80ee1a2c4 100644 --- a/helgrind/tests/tc23_bogus_condwait.stderr.exp +++ b/helgrind/tests/tc23_bogus_condwait.stderr.exp @@ -3,18 +3,18 @@ Thread #x is the program's root thread Thread #x: pthread_cond_{timed}wait called with invalid mutex at 0x........: pthread_cond_wait@* (hg_intercepts.c:...) - by 0x........: main (tc23_bogus_condwait.c:75) + by 0x........: main (tc23_bogus_condwait.c:69) Thread #x: pthread_cond_{timed}wait called with un-held mutex at 0x........: pthread_cond_wait@* (hg_intercepts.c:...) - by 0x........: main (tc23_bogus_condwait.c:78) + by 0x........: main (tc23_bogus_condwait.c:72) Thread #x: pthread_cond_{timed}wait called with mutex of type pthread_rwlock_t* at 0x........: pthread_cond_wait@* (hg_intercepts.c:...) - by 0x........: main (tc23_bogus_condwait.c:81) + by 0x........: main (tc23_bogus_condwait.c:75) Thread #x: pthread_cond_{timed}wait called with mutex held by a different thread at 0x........: pthread_cond_wait@* (hg_intercepts.c:...) - by 0x........: main (tc23_bogus_condwait.c:84) + by 0x........: main (tc23_bogus_condwait.c:78) ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0) diff --git a/helgrind/tests/tc24_nonzero_sem.c b/helgrind/tests/tc24_nonzero_sem.c index c6176a3a79..01c23e811a 100644 --- a/helgrind/tests/tc24_nonzero_sem.c +++ b/helgrind/tests/tc24_nonzero_sem.c @@ -8,19 +8,13 @@ #include #include -#ifdef __APPLE__ -#define OS_IS_DARWIN 1 -#else -#define OS_IS_DARWIN 0 -#endif - #define N_THREADS 3 void* child_fn ( void* semV ) { int r; sem_t* sem = (sem_t*)semV; - r= sem_wait(sem); assert(OS_IS_DARWIN || !r); + r= sem_wait(sem); assert(!r); return NULL; } @@ -30,7 +24,7 @@ int main ( void ) sem_t sem; pthread_t child[N_THREADS]; - r= sem_init(&sem, 0, N_THREADS); assert(OS_IS_DARWIN || !r); + r= sem_init(&sem, 0, N_THREADS); assert(!r); for (i = 0; i < N_THREADS; i++) { r= pthread_create( &child[i], NULL, child_fn, (void*)&sem );