diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 9 | ||||
-rw-r--r-- | tests/GNUmakefile | 16 | ||||
-rw-r--r-- | tests/Makefile | 28 | ||||
-rw-r--r-- | tests/cleanup1.c | 7 | ||||
-rw-r--r-- | tests/spin4.c | 5 | ||||
-rw-r--r-- | tests/test.h | 1 |
6 files changed, 48 insertions, 18 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index ce460e7..91f823e 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,12 @@ +2002-01-30 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * cleanup1.c (): Must be declared __cdecl when compiled
+ as C++ AND testing the standard C library version.
+
+2002-01-16 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * spin4.c (main): Fix renamed function call.
+
2002-01-14 Ross Johnson <rpj@special.ise.canberra.edu.au>
* exception3.c (main): Shorten wait time.
diff --git a/tests/GNUmakefile b/tests/GNUmakefile index 26b707c..0bf4102 100644 --- a/tests/GNUmakefile +++ b/tests/GNUmakefile @@ -61,8 +61,9 @@ BENCHRESULTS = $(BENCHTESTS:%=%.bench) default: @ $(ECHO) Run one of the following command lines: - @ $(ECHO) nmake clean GCE (to test using GNU C dll with C++ exception handling) - @ $(ECHO) nmake clean GC (to test using GNU C dll with C cleanup code) + @ $(ECHO) nmake clean GCE (to test using GCE dll with C++ (EH) applications) + @ $(ECHO) nmake clean GC (to test using GC dll with C (no EH) applications) + @ $(ECHO) nmake clean GCX (to test using GC dll with C++ (EH) applications) @ $(ECHO) nmake clean GCE-bench (to benchtest using GNU C dll with C++ exception handling) @ $(ECHO) nmake clean GC-bench (to benchtest using GNU C dll with C cleanup code) @@ -71,16 +72,19 @@ auto: @ $(MAKE) clean GC GC: - $(MAKE) GCX=GC XXCFLAGS="-x c" all-pass + $(MAKE) GCX=GC XXCFLAGS="-x c -D__CLEANUP_C" all-pass GCE: - $(MAKE) GCX=GCE XXCFLAGS="-mthreads -x c++" all-pass + $(MAKE) GCX=GCE XXCFLAGS="-mthreads -x c++ -D__CLEANUP_CXX" all-pass + +GCX: + $(MAKE) GCX=GC XXCFLAGS="-mthreads -x c++ -D__CLEANUP_C" all-pass GC-bench: - $(MAKE) GCX=GC XXCFLAGS="-x c" all-bench + $(MAKE) GCX=GC XXCFLAGS="-x c -D__CLEANUP_C" all-bench GCE-bench: - $(MAKE) GCX=GCE XXCFLAGS="-mthreads -x c++" all-bench + $(MAKE) GCX=GCE XXCFLAGS="-mthreads -x c++ -D__CLEANUP_CXX" all-bench all-pass: $(PASSES) @ $(ECHO) ALL TESTS PASSED! Congratulations! diff --git a/tests/Makefile b/tests/Makefile index 9eade03..74c9b8b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -18,10 +18,12 @@ VCEDLL = pthreadVCE.dll VSEFLAGS = /D__CLEANUP_SEH
VSELIB = pthreadVSE.lib
VSEDLL = pthreadVSE.dll
-#C cleanup code
+# C cleanup code
VCFLAGS = /D__CLEANUP_C
VCLIB = pthreadVC.lib
VCDLL = pthreadVC.dll
+# C++ Exceptions in application - using VC version of pthreads dll
+VCXFLAGS = /GX /TP /D__CLEANUP_C
CFLAGS= /W3 /WX /MT /nologo /Yd /Zi -D_WIN32_WINNT=0x400
LFLAGS= /INCREMENTAL:NO
@@ -67,17 +69,21 @@ BENCHRESULTS = \ all:
@ $(ECHO) Run one of the following command lines:
- @ $(ECHO) nmake clean VCE (to test using MSVC dll with C++ exception handling)
- @ $(ECHO) nmake clean VSE (to test using MSVC dll with structured exception handling)
- @ $(ECHO) nmake clean VC (to test using MSVC dll with C cleanup code)
- @ $(ECHO) nmake clean VCE-bench (to benchtest using MSVC dll with C++ exception handling)
- @ $(ECHO) nmake clean VSE-bench (to benchtest using MSVC dll with structured exception handling)
- @ $(ECHO) nmake clean VC-bench (to benchtest using MSVC dll with C cleanup code)
+ @ $(ECHO) nmake clean VCE (to test using the VCE dll with VC++ EH applications)
+ @ $(ECHO) nmake clean VSE (to test using VSE dll with VC (SEH) applications)
+ @ $(ECHO) nmake clean VC (to test using VC dll with VC (no EH) applications)
+ @ $(ECHO) nmake clean VCX (to test using VC dll with VC++ (EH) applications)
+ @ $(ECHO) nmake clean VCE-bench (to benchtest using VCE dll with C++ bench app)
+ @ $(ECHO) nmake clean VSE-bench (to benchtest using VSE dll with SEH bench app)
+ @ $(ECHO) nmake clean VC-bench (to benchtest using VC dll with C bench app)
+ @ $(ECHO) nmake clean VCX-bench (to benchtest using VC dll with C++ bench app)
auto:
@ nmake clean VCE
@ nmake clean VSE
@ nmake clean VC
+ @ nmake clean VCX
+ @ nmake clean VC-bench
tests: $(CPLIB) $(CPDLL) $(CPHDR) $(PASSES)
@ $(ECHO) ALL TESTS PASSED! Congratulations!
@@ -106,6 +112,9 @@ VSE: VC:
@ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" tests
+VCX:
+ @ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" tests
+
VCE-bench:
@ nmake TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" benchtests
@@ -115,8 +124,11 @@ VSE-bench: VC-bench:
@ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" benchtests
+VCX-bench:
+ @ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" benchtests
+
.c.exe:
- @ $(ECHO) Compiling $@
+ @ $(ECHO) $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB)
@ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB)
.c.pre:
diff --git a/tests/cleanup1.c b/tests/cleanup1.c index 0282379..2b2ffe4 100644 --- a/tests/cleanup1.c +++ b/tests/cleanup1.c @@ -86,6 +86,9 @@ static bag_t threadbag[NUMTHREADS + 1]; static int pop_count = 0; static void +#ifdef __CLEANUP_C +__cdecl +#endif increment_pop_count(void * arg) { int * c = (int *) arg; @@ -111,6 +114,8 @@ mythread(void * arg) pthread_cleanup_push(increment_pop_count, (void *) &pop_count); /* + * We don't have true async cancelation - it relies on the thread + * at least re-entering the run state at some point. * We wait up to 10 seconds, waking every 0.1 seconds, * for a cancelation to be applied to us. */ @@ -157,7 +162,7 @@ main() * Standard check that all threads started. */ for (i = 1; i <= NUMTHREADS; i++) - { + { if (!threadbag[i].started) { failed |= !threadbag[i].started; diff --git a/tests/spin4.c b/tests/spin4.c index b4d7305..4d8cc23 100644 --- a/tests/spin4.c +++ b/tests/spin4.c @@ -59,10 +59,9 @@ main() pthread_t t; int CPUs; - if (pthread_getprocessors_np(&CPUs) != 0 || CPUs == 1) + if ((CPUs = pthread_num_processors_np()) == 1) { - printf("This test is not applicable to this system.\n"); - printf("Either there is only 1 CPU or the no. could not be determined.\n"); + printf("Test not run - it requires multiple CPUs.\n"); exit(0); } diff --git a/tests/test.h b/tests/test.h index 2609030..07dc788 100644 --- a/tests/test.h +++ b/tests/test.h @@ -32,6 +32,7 @@ #include "pthread.h" #include "sched.h" #include "semaphore.h" +#include <windows.h> #include <stdio.h> char * error_string[] = { |