aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-08 07:24:21 +0000
committerIan Lance Taylor <iant@google.com>2007-10-08 07:24:21 +0000
commite982104129f02cd7afe3ba33b77dd7c54e45c198 (patch)
tree1c92ad6c1105b86c0a466fdcb0753116189472f9 /gold
parente727fa71af6a46ff76ace26a73f8e17bb26559ec (diff)
downloadgdb-e982104129f02cd7afe3ba33b77dd7c54e45c198.zip
gdb-e982104129f02cd7afe3ba33b77dd7c54e45c198.tar.gz
gdb-e982104129f02cd7afe3ba33b77dd7c54e45c198.tar.bz2
Make TLS test fail more reliably.
Diffstat (limited to 'gold')
-rw-r--r--gold/testsuite/tls_test_main.cc31
1 files changed, 22 insertions, 9 deletions
diff --git a/gold/testsuite/tls_test_main.cc b/gold/testsuite/tls_test_main.cc
index b029092..dfa46c6 100644
--- a/gold/testsuite/tls_test_main.cc
+++ b/gold/testsuite/tls_test_main.cc
@@ -24,6 +24,7 @@
// more information.
#include <cassert>
+#include <cstdio>
#include <pthread.h>
#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;
}