From: iant Date: Mon, 8 Oct 2007 07:24:21 +0000 (+0000) Subject: Make TLS test fail more reliably. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=821d4683816c84945e376053772d50816821a201;p=pf3gnuchains%2Fsourceware.git Make TLS test fail more reliably. --- diff --git a/gold/testsuite/tls_test_main.cc b/gold/testsuite/tls_test_main.cc index b029092e8e..dfa46c66ef 100644 --- a/gold/testsuite/tls_test_main.cc +++ b/gold/testsuite/tls_test_main.cc @@ -24,6 +24,7 @@ // more information. #include +#include #include #include "tls_test.h" @@ -43,6 +44,18 @@ Mutex_set mutexes2 = { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER } ; +bool failed = false; + +void +check(const char* name, bool val) +{ + if (!val) + { + fprintf(stderr, "Test %s failed\n", name); + failed = true; + } +} + // The body of the thread function. This gets a lock on the first // mutex, runs the tests, and then unlocks the second mutex. Then it // locks the third mutex, and the runs the verification test again. @@ -57,15 +70,15 @@ thread_routine(void* arg) assert(err == 0); // Run the tests. - assert(t1()); - assert(t2()); - assert(t3()); - assert(t4()); + check("t1", t1()); + check("t2", t2()); + check("t3", t3()); + check("t4", t4()); f5b(f5a()); - assert(t5()); + check("t5", t5()); f6b(f6a()); - assert(t6()); - assert(t7()); + check("t6", t6()); + check("t7", t7()); // Unlock the second mutex. err = pthread_mutex_unlock(&pms->mutex2); @@ -75,7 +88,7 @@ thread_routine(void* arg) err = pthread_mutex_lock(&pms->mutex3); assert(err == 0); - assert(t7()); + check("t7", t7()); return 0; } @@ -142,5 +155,5 @@ main() assert(thread_val == 0); // All done. - return 0; + return failed ? 1 : 0; }