summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorrpj <rpj>2006-12-22 02:36:40 +0000
committerrpj <rpj>2006-12-22 02:36:40 +0000
commit9e61bc0571b4812381cf89dd6f4bcbe3931f6acd (patch)
tree2b60eec9340369ed259a9d1de422ac5ec3eb9291 /tests
parent1beb00e609d241ee6c2048c476e2240f05033cbd (diff)
Diffstat (limited to 'tests')
-rw-r--r--tests/Bmakefile3
-rw-r--r--tests/GNUmakefile3
-rw-r--r--tests/Makefile3
-rw-r--r--tests/Wmakefile3
-rw-r--r--tests/once3.c11
5 files changed, 15 insertions, 8 deletions
diff --git a/tests/Bmakefile b/tests/Bmakefile
index c1c5805..9a2c2b4 100644
--- a/tests/Bmakefile
+++ b/tests/Bmakefile
@@ -95,7 +95,7 @@ PASSES= loadfree.pass \
once1.pass once2.pass once3.pass once4.pass \
self2.pass \
cancel1.pass cancel2.pass \
- semaphore4.pass semaphore4t.pass \
+ semaphore4.pass semaphore4t.pass semaphore5.pass \
barrier1.pass barrier2.pass barrier3.pass barrier4.pass barrier5.pass \
tsd1.pass tsd2.pass delay1.pass delay2.pass eyal1.pass \
condvar3.pass condvar3_1.pass condvar3_2.pass condvar3_3.pass \
@@ -337,6 +337,7 @@ semaphore2.pass:
semaphore3.pass: semaphore2.pass
semaphore4.pass: semaphore3.pass cancel1.pass
semaphore4t.pass: semaphore4.pass
+semaphore5.pass: semaphore4.pass
sizes.pass:
spin1.pass:
spin2.pass: spin1.pass
diff --git a/tests/GNUmakefile b/tests/GNUmakefile
index 31a514e..1762b6c 100644
--- a/tests/GNUmakefile
+++ b/tests/GNUmakefile
@@ -89,7 +89,7 @@ TESTS = sizes loadfree \
count1 \
once1 once2 once3 once4 self2 \
cancel1 cancel2 \
- semaphore4 semaphore4t \
+ semaphore4 semaphore4t semaphore5 \
barrier1 barrier2 barrier3 barrier4 barrier5 \
tsd1 tsd2 delay1 delay2 eyal1 \
condvar3 condvar3_1 condvar3_2 condvar3_3 \
@@ -302,6 +302,7 @@ semaphore2.pass:
semaphore3.pass: semaphore2.pass
semaphore4.pass: semaphore3.pass cancel1.pass
semaphore4t.pass: semaphore4.pass
+semaphore5.pass: semaphore4.pass
sizes.pass:
spin1.pass:
spin2.pass: spin1.pass
diff --git a/tests/Makefile b/tests/Makefile
index a1af003..69dc39c 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -99,7 +99,7 @@ PASSES= sizes.pass loadfree.pass \
once1.pass once2.pass once3.pass once4.pass \
self2.pass \
cancel1.pass cancel2.pass \
- semaphore4.pass semaphore4t.pass \
+ semaphore4.pass semaphore4t.pass semaphore5.pass \
barrier1.pass barrier2.pass barrier3.pass barrier4.pass barrier5.pass \
tsd1.pass tsd2.pass delay1.pass delay2.pass eyal1.pass \
condvar3.pass condvar3_1.pass condvar3_2.pass condvar3_3.pass \
@@ -391,6 +391,7 @@ semaphore2.pass:
semaphore3.pass: semaphore2.pass
semaphore4.pass: semaphore3.pass cancel1.pass
semaphore4t.pass: semaphore4.pass
+semaphore5.pass: semaphore4.pass
sizes.pass:
spin1.pass:
spin2.pass: spin1.pass
diff --git a/tests/Wmakefile b/tests/Wmakefile
index 06a755c..83cd34b 100644
--- a/tests/Wmakefile
+++ b/tests/Wmakefile
@@ -95,7 +95,7 @@ PASSES = sizes.pass loadfree.pass &
once1.pass once2.pass once3.pass once4.pass tsd1.pass &
self2.pass &
cancel1.pass cancel2.pass &
- semaphore4.pass semaphore4t.pass &
+ semaphore4.pass semaphore4t.pass semaphore5.pass &
delay1.pass delay2.pass eyal1.pass &
condvar3.pass condvar3_1.pass condvar3_2.pass condvar3_3.pass &
condvar4.pass condvar5.pass condvar6.pass &
@@ -333,6 +333,7 @@ semaphore2.pass:
semaphore3.pass: semaphore2.pass
semaphore4.pass: semaphore3.pass cancel1.pass
semaphore4t.pass: semaphore4.pass
+semaphore5.pass: semaphore4.pass
sizes.pass:
spin1.pass:
spin2.pass: spin1.pass
diff --git a/tests/once3.c b/tests/once3.c
index 51d2daa..981bbf7 100644
--- a/tests/once3.c
+++ b/tests/once3.c
@@ -34,7 +34,7 @@
* --------------------------------------------------------------------------
*
* Create several pthread_once objects and channel several threads
- * through each. Make the init_routine cancelable and cancel them
+ * through each. Make the init_routine cancelable and cancel them with
* waiters waiting.
*
* Depends on API functions:
@@ -45,6 +45,8 @@
* pthread_once()
*/
+#define ASSERT_TRACE
+
#include "test.h"
#define NUM_THREADS 100 /* Targeting each once control */
@@ -66,6 +68,7 @@ myfunc(void)
{
EnterCriticalSection(&numOnce.cs);
numOnce.i++;
+ assert(numOnce.i > 0);
LeaveCriticalSection(&numOnce.cs);
/* Simulate slow once routine so that following threads pile up behind it */
Sleep(10);
@@ -78,11 +81,11 @@ mythread(void * arg)
{
/*
* Cancel every thread. These threads are deferred cancelable only, so
- * only the thread performing the init_routine will see it (there are
+ * only the thread performing the once routine (my_func) will see it (there are
* no other cancelation points here). The result will be that every thread
- * eventually cancels only when it becomes the new initter.
+ * eventually cancels only when it becomes the new once thread.
*/
- pthread_cancel(pthread_self());
+ assert(pthread_cancel(pthread_self()) == 0);
assert(pthread_once(&once[(int) arg], myfunc) == 0);
EnterCriticalSection(&numThreads.cs);
numThreads.i++;