diff options
Diffstat (limited to 'tests')
47 files changed, 1845 insertions, 1373 deletions
| diff --git a/tests/ChangeLog b/tests/ChangeLog index 27f4eea..abc8260 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,4 +1,17 @@ -2004-10-23  Ross Johnson  <rpj@callisto.canberra.edu.au>
 +2004-10-29  Ross Johnson  <rpj@callisto.canberra.edu.au> + +	* semaphore4.c: New test. +	* semaphore4t.c: New test. +	* Debug.dsp (et al): Created MSVC Workspace project to aid debugging. +	* All: Many tests have been modified to work with the new pthread +	ID type; some other corrections were made after some library +	functions were semantically strengthened. For example, +	pthread_cond_destroy() no longer destroys a busy CV, which +	required minor redesigns of some tests, including some where +	the mutex associated with the CV was not locked during +	signaling and broadcasting. + +2004-10-23  Ross Johnson  <rpj@callisto.canberra.edu.au>  	* condvar3.c: Fixed mutex operations that were incorrectly  	placed in relation to their condition variable operations. @@ -15,791 +28,791 @@  	* condvar8.c: Likewise.  	* condvar9.c: Likewise. -2004-10-19  Ross Johnson  <rpj@callisto.canberra.edu.au>
 +2004-10-19  Ross Johnson  <rpj@callisto.canberra.edu.au>  	* semaphore3.c: New test. -2004-10-14  Ross Johnson  <rpj@callisto.canberra.edu.au>
 +2004-10-14  Ross Johnson  <rpj@callisto.canberra.edu.au> + +	* rwlock7.c (main): Tidy up statistics reporting; randomise +	update accesses. +	* rwlock8.c: New test. + +2004-09-08  Alexandre Girao  <alexgirao@gmail.com> + +	* cancel7.c (main): Win98 wants a valid (non-NULL) location +	for the last arg of _beginthreadex(). +	* cancel8.c (main): Likewise. +	* exit4.c (main): Likewise. +	* exit5.c (main): Likewise. + +2004-08-26  Ross Johnson  <rpj@callisto.canberra.edu.au> + +	* create3.c: New test. + +2004-06-21  Ross Johnson  <rpj@callisto.canberra.edu.au> + +	* mutex2r.c: New test. +	* mutex2e.c: New test. +	* mutex3r.c: New test. +	* mutex3e.c: New test. +	* mutex6s.c: New test. +	* mutex6rs.c: New test. +	* mutex6es.c: New test. + +2004-05-21  Ross Johnson  <rpj@callisto.canberra.edu.au> + +	* join3.c: New test. + +2004-05-16  Ross Johnson  <rpj@callisto.canberra.edu.au> + +	* condvar2.c (WIN32_WINNT): Define to avoid redefinition warning +	from inclusion of implement.h. +	* convar2_1.c: Likewise. +	* condvar3_1.c: Likewise. +	* condvar3_2.c: Likewise. +	* context1.c: Likewise. +	* sizes.c: Likewise. +	* Makefile: Don't define _WIN32_WINNT on compiler command line. +	* GNUmakefile: Likewise. +	* priority1.c (main): Add column to output for actual win32 +	priority. + +2004-05-16  Ross Johnson  <rpj@callisto.canberra.edu.au> + +	* cancel9.c: New test. +	* cancel3.c: Remove inappropriate conditional compilation; +	GNU C version of test suite no longer quietly skips this test. +	* cancel5.c: Likewise. +	* GNUmakefile: Can now build individual test app using default +	C version of library using 'make clean testname.c'. +	* Makefile: Likewise for VC using 'nmake clean test testname.c'. + +2003-10-14  Ross Johnson  <rpj@callisto.canberra.edu.au> + +	* Wmakefile: New makefile for Watcom testing. + +2003-09-18  Ross Johnson  <rpj@callisto.canberra.edu.au> + +	* benchtest.h: Move old mutex code into benchlib.c. +	* benchlib.c: New statically linked module to ensure that +	bench apps don't inline the code and therefore have an unfair +	advantage over the pthreads lib routines. Made little or no +	difference. +	* benchtest1.c: Minor change to avoid compiler warnings. +	* benchtest5.c: Likewise. +	* benchtest2.c: Fix misinformation in output report. +	* README.BENCH: Add comments on results. + +2003-09-14  Ross Johnson  <rpj@callisto.canberra.edu.au> + +	* priority1.c: Reworked to comply with modified priority +	management and provide additional output. +	* priority2.c: Likewise. +	* inherit1.c: Likewise. + +2003-09-03  Ross Johnson  <rpj@callisto.canberra.edu.au> + +	* exit4.c: New test. +	* exit5.c: New test. +	* cancel7.c: New test. +	* cancel8.c: New test. + +2003-08-13  Ross Johnson  <rpj@ise.canberra.edu.au> + +	* reuse1.c: New test. +	* reuse1.c: New test. +	* valid1.c: New test. +	* valid2.c: New test. +	* kill1.c: New test. + 	* create2.c: Now included in test regime. + +2003-07-19  Ross Johnson  <rpj@ise.canberra.edu.au> + +	* eyal1.c (waste_time): Make threads do more work to ensure that +	all threads get to do some work. +	* semaphore1.c: Make it clear that certain errors are expected. +	* exception2.c (non_MSVC code sections): Change to include +	C++ standard include file, i.e. change <new.h> to <exception>. +	* exception3.c (non_MSVC code sections): Likewise; qualify std:: +	namespace entities where necessary. +	* GNUmakefile: modified to work in the MsysDTK (newer MinGW) +	environment; define CC as gcc or g++ as appropriate because +	using gcc -x c++ doesn't link with required c++ libs by default, +	but g++ does. + +2002-12-11  Ross Johnson  <ross@special.ise.canberra.edu.au> + +	* mutex7e.c: Assert EBUSY return instead of EDEADLK. + +2002-06-03  Ross Johnson  <rpj@digit.ise.canberra.edu.au> + +	* semaphore2.c: New test. + +2002-03-02  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* Makefile (CFLAGS): Changed /MT to /MD to link with +	the correct library MSVCRT.LIB. Otherwise errno doesn't +	work. + +2002-02-28  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* exception3.c: Correct recent change. + +	* semaphore1.c: New test. + +	* Makefile: Add rule to generate pre-processor output. + +2002-02-28  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* exception3.c (terminateFunction): For MSVC++, call +	exit() rather than pthread_exit(). Add comments to explain +	why. +	   * Notes from the MSVC++ manual: +	   *       1) A term_func() should call exit(), otherwise +	   *          abort() will be called on return to the caller. +	   *          abort() raises SIGABRT. The default signal handler +	   *          for all signals terminates the calling program with +	   *          exit code 3. +	   *       2) A term_func() must not throw an exception. Therefore +	   *          term_func() should not call pthread_exit() if an +	   *          an exception-using version of pthreads-win32 library +	   *          is being used (i.e. either pthreadVCE or pthreadVSE). + + +2002-02-23  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* rwlock2_t.c: New test. +	* rwlock3_t.c: New test. +	* rwlock4_t.c: New test. +	* rwlock5_t.c: New test. +	* rwlock6_t.c: New test. +	* rwlock6_t2.c: New test. +	* rwlock6.c (main): Swap thread and result variables +	to correspond to actual thread functions. +	* rwlock1.c: Change test description comment to correspond +	to the actual test. + +	* condvar1_2.c: Loop over the test many times in the hope +	of detecting any intermittent deadlocks. This is to +	test a fixed problem in pthread_cond_destroy.c. + +	* spin4.c: Remove unused variable. + +2002-02-17  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* condvar1_1.c: New test. +	* condvar1_2.c: New test. + +2002-02-07  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* delay1.c: New test. +	* delay2.c: New test. +	* exit4.c: New test. + +2002-02-02  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* mutex8: New test. +	* mutex8n: New test. +	* mutex8e: New test. +	* mutex8r: New test. +	* cancel6a: New test. +	* cancel6d: New test. +	* cleanup0.c: Add pragmas for inline optimisation control. +	* cleanup1.c: Add pragmas for inline optimisation control. +	* cleanup2.c: Add pragmas for inline optimisation control. +	* cleanup3.c: Add pragmas for inline optimisation control. +	* condvar7.c: Add pragmas for inline optimisation control. +	* condvar8.c: Add pragmas for inline optimisation control. +	* condvar9.c: Add pragmas for inline optimisation control. + +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. + +2002-01-09  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* mutex7.c: New test. +	* mutex7n.c: New test. +	* mutex7e.c: New test. +	* mutex7r.c: New test. +	* mutex6.c: Modified to avoid leaving the locked mutex +	around on exit. + +2001-10-25  Ross Johnson  <rpj@setup1.ise.canberra.edu.au> + +	* condvar2.c: Remove reference to cv->nWaitersUnblocked. +	* condvar2_1.c: Likewise; lower NUMTHREADS from 60 to 30. +	* condvar3_1.c: Likewise. +	* condvar3_2.c: Likewise. +	* count1.c: lower NUMTHREADS from 60 to 30. +	* inherit1.c: Determine valid priority values and then +	assert values returned by POSIX routines are the same. +	* priority1.c: Likewise. +	* priority2.c: Likewise. +	 +2001-07-12  Ross Johnson  <rpj@setup1.ise.canberra.edu.au> + +	* barrier5.c: Assert that precisely one thread receives +	PTHREAD_BARRIER_SERIAL_THREAD at each barrier. + +2001-07-09  Ross Johnson  <rpj@setup1.ise.canberra.edu.au> + +	* barrier3.c: Fixed. +	* barrier4.c: Fixed. +	* barrier5.c: New; proves that all threads in the group +	reaching the barrier wait and then resume together. Repeats the test +	using groups of 1 to 16 threads. Each group of threads must negotiate +	a large number of barriers (10000). +	* spin4.c: Fixed. +	* test.h (error_string): Modified the success (0) value. + +2001-07-07  Ross Johnson  <rpj@setup1.ise.canberra.edu.au> + +	* spin3.c: Changed test and fixed. +	* spin4.c: Fixed. +	* barrier3.c: Fixed. +	* barrier4.c: Fixed. + +2001-07-05  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* spin1.c: New; testing spinlocks. +	* spin2.c: New; testing spinlocks. +	* spin3.c: New; testing spinlocks. +	* spin4.c: New; testing spinlocks. +	* barrier1.c: New; testing barriers. +	* barrier2.c: New; testing barriers. +	* barrier3.c: New; testing barriers. +	* barrier4.c: New; testing barriers. +	* GNUmakefile: Add new tests. +	* Makefile: Add new tests. + +2001-07-01  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* benchtest3.c: New; timing mutexes. +	* benchtest4.c: New; time mutexes. +	* condvar3_1.c: Fixed bug - Alexander Terekhov +	* condvar3_3.c: New test. + +2001-06-25  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* priority1.c: New test. +	* priority2.c: New test. +	* inherit1.c: New test. +	* benchtest1.c: New; timing mutexes. +	* benchtest2.c: New; timing mutexes. +	* mutex4.c: Modified to test all mutex types. + +2001-06-8  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* mutex5.c: Insert inert change to quell compiler warnings. +	* condvar3_2.c: Remove unused variable. +	 +2001-06-3  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* condvar2_1.c: New test. +	* condvar3_1.c: New test. +	* condvar3_2.c: New test. + +2001-05-30  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* mutex1n.c: New test. +	* mutex1e.c: New test. +	* mutex1r.c: New test. +	* mutex4.c: Now locks and unlocks a mutex. +	* mutex5.c: New test. +	* mutex6.c: New test. +	* mutex6n.c: New test. +	* mutex6e.c: New test. +	* mutex6r.c: New test. +	* Makefile: Added new tests; reorganised. +	* GNUmakefile: Likewise. +	* rwlock6.c: Fix to properly prove read-while-write locking +	and single writer locking. + +2001-05-29  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* Makefile: Reorganisation. +	* GNUmakefile: Likewise. +	- Thomas Pfaff <tpfaff@gmx.net> + +	* exception1.c: Add stdio.h include to define fprintf and stderr +	in non-exception C version of main(). +	* exception2.c: Likewise. +	* exception3.c: Likewise. + +	* Makefile (rwlock7): Add new test. +	* GNUmakefile (rwlock7): Add new test. +	* rwlock7.c: New test. +	* rwlock6.c: Changed to test that writer has priority. + +	* eyal1.c (main): Unlock each mutex_start lock before destroying +	it. + +2000-12-29  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* GNUmakefile: Add mutex4 test; ensure libpthreadw32.a is +	removed for "clean" target. +	* Makefile: Add mutex4 test. + +	* exception3.c: Remove SEH code; automatically pass the test +	under SEH (which is an N/A environment). + +	* mutex4.c: New test. + +	* eyal1.c (do_work_unit): Add a dummy "if" to force the +	optimiser to retain code; reduce thread work loads. + +	* condvar8.c (main): Add an additional "assert" for debugging; +	increase pthread_cond_signal timeout. + +2000-12-28  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* eyal1.c: Increase thread work loads. +	* exception2.c: New test. +	* exception3.c: New test. +	* Makefile: Add new tests exception2.c and exception3.c. +	* GNUmakefile: Likewise. + +2000-12-11  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* cleanup3.c: Remove unused variable. +	* cleanup2.c: Likewise. +	* exception1.c: Throw an exception rather than use +	a deliberate zero divide so that catch(...) will +	handle it under Mingw32. Mingw32 now builds the +	library correctly to pass all tests - see Thomas +	Pfaff's detailed instructions re needed changes +	to Mingw32 in the Pthreads-Win32 FAQ. + +2000-09-08  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* cancel5.c: New; tests calling pthread_cancel() +	from the main thread without first creating a +	POSIX thread struct for the non-POSIX main thread +	- this forces pthread_cancel() to create one via +	pthread_self(). +	* Makefile (cancel5): Add new test. +	* GNUmakefile (cancel5): Likewise. + +2000-08-17  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* create2.c: New; Test that pthread_t contains +	the W32 HANDLE before it calls the thread routine +	proper. + +2000-08-13  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* condvar3.c: Minor change to eliminate compiler +	warning. + +	* condvar4.c: ditto. + +	* condvar5.c: ditto. + +	* condvar6.c: ditto. + +	* condvar7.c: ditto. + +	* condvar8.c: ditto. + +	* condvar9.c: ditto. + +	* exit1.c: Function needed return statement. + +	* cleanup1.c: Remove unnecessary printf arg. + +	* cleanup2.c: Fix cast. + +	* rwlock6.c: Fix casts. + +	* exception1.c (PtW32CatchAll): Had the wrong name; +	fix casts. + +	* cancel3.c: Remove unused waitLock variable. + +	* GNUmakefile: Change library/dll naming; add new tests; +	general minor changes. + +	* Makefile: Change library/dll naming; add targets for +	testing each of the two VC++ EH scheme versions; +	default target now issues help message; compile warnings +	now interpreted as errors to stop the make; add new +	tests; restructure to remove prerequisites needed +	otherwise. + +	* README: Updated. + + +2000-08-10  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* eyal1.c (main): Change implicit cast to explicit +	cast when passing "print_server" function pointer; +	G++ no longer allows implicit func parameter casts. + +	* cleanup1.c: Remove unused "waitLock". +	(main): Fix implicit parameter cast. + +	* cancel2.c (main): Fix implicit parameter cast. + +	* cancel4.c (main): Fix implicit parameter cast. + +	* cancel3.c (main): Fix implicit parameter cast. + +	* GNUmakefile: Renamed from Makefile; Add missing +	cancel1 and cancel2 test targets. + +	* Makefile: Converted for use with MS nmake. + +2000-08-06  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* ccl.bat: Add /nologo to remove extraneous output. + +	* exception1.c (exceptionedThread): Init 'dummy'; +	put expression into if condition to prevent optimising away; +	remove unused variable. + +	* cancel4.c (mythread): Cast return value to avoid warnings. + +	* cancel2.c (mythread): Missing #endif. + +	* condvar9.c (mythread): Cast return value to avoid warnings. + +	* condvar8.c (mythread): Cast return value to avoid warnings. + +	* condvar7.c (mythread): Cast return value to avoid warnings. + +	* cleanup3.c (mythread): Cast return value to avoid warnings. + +	* cleanup2.c (mythread): Cast return value to avoid warnings. + +	* cleanup1.c (mythread): Cast return value to avoid warnings. + +	* condvar5.c (mythread): Cast return value to avoid warnings. + +	* condvar3.c (mythread): Cast return value to avoid warnings. + +	* condvar6.c (mythread): Cast return value to avoid warnings. + +	* condvar4.c (mythread): Cast return value to avoid warnings. + +2000-08-05  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* cancel2.c: Use PtW32CatchAll macro if defined. + +	* exception1.c: Use PtW32CatchAll macro if defined. + +2000-08-02  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* tsd1.c: Fix typecasts of &result [g++ is now very fussy]. +	 +	* test.h (assert): Return 0's explicitly to allay +	g++ errors. +	 +	* join2.c: Add explicit typecasts. +	 +	* join1.c: Add explicit typecasts. +	 +	* join0.c: Add explicit typecasts. +	 +	* eyal1.c: Add explicit typecasts. +	 +	* count1.c (main): Add type cast to remove g++ parse warning +	[gcc-2.95.2 seems to have tightened up on this]. + +	* Makefile (GLANG): Use c++ explicitly. +	Remove MSVC sections (was commented out). +	Add target to generate cpp output. + +2000-07-25  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* runtest.bat: modified to work under W98. +	 +	* runall.bat: Add new tests; modified to work under W98. +	It was ok under NT. + +	* Makefile: Add new tests. + +	* exception1.c: New; Test passing exceptions back to the +	application and retaining library internal exceptions. + +	* join0.c: New; Test a single join. + +2000-01-06  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* cleanup1.c: New; Test cleanup handler executes (when thread is +	canceled). + +	* cleanup2.c: New; Test cleanup handler executes (when thread is +	not canceled). + +	* cleanup3.c: New; Test cleanup handler does not execute +	(when thread is not canceled). + +2000-01-04  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* cancel4.c: New; Test cancelation does not occur in deferred +	cancelation threads with no cancelation points. + +	* cancel3.c: New; Test asynchronous cancelation. + +	* context1.c: New; Test context switching method for async +	cancelation. + +1999-11-23  Ross Johnson  <rpj@special.ise.canberra.edu.au> + +	* test.h: Add header includes; include local header versions rather +	than system versions; rearrange the assert macro defines. + +1999-11-07  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* loadfree.c: New. Test loading and freeing the library (DLL). + +1999-10-30  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* cancel1.c: New. Test pthread_setcancelstate and +	pthread_setcanceltype functions. +	* eyal1.c (waste_time): Change calculation to avoid FP exception +	on Aplhas +	- Rich Peters <rpeters@micro-magic.com> + +Oct 14 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* condvar7.c: New. Test broadcast after waiting thread is canceled. +	* condvar8.c: New. Test multiple broadcasts. +	* condvar9.c: New. Test multiple broadcasts with thread +	cancelation. +	 +Sep 16 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* rwlock6.c: New test. + +Sep 15 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* rwlock1.c: New test. +	* rwlock2.c: New test. +	* rwlock3.c: New test. +	* rwlock4.c: New test. +	* rwlock5.c: New test. + +Aug 22 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* runall.bat (join2): Add test. + +Aug 19 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* join2.c: New test. + +Wed Aug 12 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* Makefile (LIBS): Add -L. + +Mon May 31 10:25:01 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* Makefile (GLANG): Add GCC language option. + +Sat May 29 23:29:04 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* runall.bat (condvar5): Add new test. + +	* runall.bat (condvar6): Add new test. + +	* Makefile (condvar5) : Add new test. +	 +	* Makefile (condvar6) : Add new test. +	 +	* condvar5.c: New test for pthread_cond_broadcast(). + +	* condvar6.c: New test for pthread_cond_broadcast(). + +Sun Apr  4 12:04:28 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* tsd1.c (mythread): Change Sleep(0) to sched_yield(). +	(sched.h): Include. + +	* condvar3.c (mythread): Remove redundant Sleep(). + +	* runtest.bat: Re-organised to make more informative. + +Fri Mar 19 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* *.bat: redirect unwanted output to nul: + +	* runall.bat: new. + +	* cancel1.c: new. Not part of suite yet. +	 +Mon Mar 15 00:17:55 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* mutex1.c: only test mutex init and destroy; add assertions. + +	* count1.c: raise number of spawned threads to 60 (appears to +	be the limit under Win98). + +Sun Mar 14 21:31:02 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* test.h (assert): add assertion trace option. +	Use: +	"#define ASSERT_TRACE 1" to turn it on, +	"#define ASSERT_TRACE 0" to turn it off (default). + +	* condvar3.c (main): add more assertions. + +	* condvar4.c (main): add more assertions. + +	* condvar1.c (main): add more assertions. + +Fri Mar 12 08:34:15 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* condvar4.c (cvthing): switch the order of the INITIALIZERs. + +	* eyal1.c (main): Fix trylock loop; was not waiting for thread to lock +	the "started" mutex. + +Wed Mar 10 10:41:52 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* tryentercs.c: Apply typo patch from bje. + +	* tryentercs2.c: Ditto. + +Sun Mar  7 10:41:52 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* Makefile (condvar3, condvar4): Add tests. + +	* condvar4.c (General): Reduce to simple test case; prerequisite +	is condvar3.c; add description. + +	* condvar3.c (General): Reduce to simple test case; prerequisite +	is condvar2.c; add description. + +	* condvar2.c (General): Reduce to simple test case; prerequisite +	is condvar1.c; add description. + +	* condvar1.c (General): Reduce to simple test case; add +	description. + +	* Template.c (Comments): Add generic test detail. + +1999-02-23  Ross Johnson  <rpj@ise.canberra.edu.au> + +        * Template.c: Revamp. + +        * condvar1.c: Add. + +        * condvar2.c: Add. + +        * Makefile: Add condvar1 condvar2 tests. + +        * exit1.c, exit2.c, exit3.c: Cosmetic changes. + +1999-02-23  Ross Johnson  <rpj@ise.canberra.edu.au> + +	* Makefile: Some refinement. + +	* *.c: More exhaustive checking through assertions; clean up; +	add some more tests. + +	* Makefile: Now actually runs the tests. + +	* tests.h: Define our own assert macro. The Mingw32 +	version pops up a dialog but we want to run non-interactively. + +	* equal1.c: use assert a little more directly so that it +	prints the actual call statement. + +	* exit1.c: Modify to return 0 on success, 1 on failure. + +1999-02-22  Ross Johnson  <rpj@ise.canberra.edu.au> + +	* self2.c: Bring up to date. + +	* self3.c: Ditto. + +1999-02-21  Ben Elliston  <bje@cygnus.com> + +	* README: Update. + +	* Makefile: New file. Run all tests automatically. Primitive tests +	are run first; more complex tests are run last. + +	* count1.c: New test. Validate the thread count. + +	* exit2.c: Perform a simpler test. +	 +	* exit3.c: New test. Replaces exit2.c, since exit2.c needs to +	perform simpler checking first. + +	* create1.c: Update to use the new testsuite exiting convention. +	 +	* equal1.c: Likewise. + +	* mutex1.c: Likewise. + +	* mutex2.c: Likewise. + +	* once1.c: Likewise. + +	* self2.c: Likewise. + +	* self3.c: Likewise. + +	* tsd1.c: Likewise. + +1999-02-20  Ross Johnson  <rpj@ise.canberra.edu.au> + +	* mutex2.c: Test static mutex initialisation. + +	* test.h: New. Declares a table mapping error numbers to +	error names. + +1999-01-17  Ross Johnson  <rpj@ise.canberra.edu.au> + +	* runtest: New script to build and run a test in the tests directory. + +Wed Dec 30 11:22:44 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* tsd1.c: Re-written. See comments at start of file. +	* Template.c: New. Contains skeleton code and comment template +	intended to fully document the test. + +Fri Oct 16 17:59:49 1998  Ross Johnson  <rpj@swan.canberra.edu.au> + +	* tsd1.c (destroy_key): Add function. Change diagnostics. + +Thu Oct 15 17:42:37 1998  Ross Johnson  <rpj@swan.canberra.edu.au> + +	* tsd1.c (mythread): Fix some casts and add some message +	output. Fix inverted conditional. + +Mon Oct 12 02:12:29 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au> + +	* tsd1.c: New. Test TSD using 1 key and 2 threads. + +1998-09-13  Ben Elliston  <bje@cygnus.com> + +	* eyal1.c: New file; contributed by Eyal Lebedinsky +	<eyal@eyal.emu.id.au>. + +1998-09-12  Ben Elliston  <bje@cygnus.com> + +	* exit2.c (func): Return a value. +	(main): Call the right thread entry function. + +1998-07-22  Ben Elliston  <bje@cygnus.com> + +	* exit2.c (main): Fix size of pthread_t array. + +1998-07-10  Ben Elliston  <bje@cygnus.com> -	* rwlock7.c (main): Tidy up statistics reporting; randomise
 -	update accesses.
 -	* rwlock8.c: New test.
 +	* exit2.c: New file; test pthread_exit() harder. -2004-09-08  Alexandre Girao  <alexgirao@gmail.com>
 - -	* cancel7.c (main): Win98 wants a valid (non-NULL) location
 -	for the last arg of _beginthreadex().
 -	* cancel8.c (main): Likewise.
 -	* exit4.c (main): Likewise.
 -	* exit5.c (main): Likewise.
 - -2004-08-26  Ross Johnson  <rpj@callisto.canberra.edu.au>
 - -	* create3.c: New test.
 - -2004-06-21  Ross Johnson  <rpj@callisto.canberra.edu.au>
 - -	* mutex2r.c: New test.
 -	* mutex2e.c: New test.
 -	* mutex3r.c: New test.
 -	* mutex3e.c: New test.
 -	* mutex6s.c: New test.
 -	* mutex6rs.c: New test.
 -	* mutex6es.c: New test.
 - -2004-05-21  Ross Johnson  <rpj@callisto.canberra.edu.au>
 - -	* join3.c: New test.
 - -2004-05-16  Ross Johnson  <rpj@callisto.canberra.edu.au>
 - -	* condvar2.c (WIN32_WINNT): Define to avoid redefinition warning
 -	from inclusion of implement.h.
 -	* convar2_1.c: Likewise.
 -	* condvar3_1.c: Likewise.
 -	* condvar3_2.c: Likewise.
 -	* context1.c: Likewise.
 -	* sizes.c: Likewise.
 -	* Makefile: Don't define _WIN32_WINNT on compiler command line.
 -	* GNUmakefile: Likewise.
 -	* priority1.c (main): Add column to output for actual win32
 -	priority.
 - -2004-05-16  Ross Johnson  <rpj@callisto.canberra.edu.au>
 - -	* cancel9.c: New test.
 -	* cancel3.c: Remove inappropriate conditional compilation;
 -	GNU C version of test suite no longer quietly skips this test.
 -	* cancel5.c: Likewise.
 -	* GNUmakefile: Can now build individual test app using default
 -	C version of library using 'make clean testname.c'.
 -	* Makefile: Likewise for VC using 'nmake clean test testname.c'.
 - -2003-10-14  Ross Johnson  <rpj@callisto.canberra.edu.au>
 - -	* Wmakefile: New makefile for Watcom testing.
 - -2003-09-18  Ross Johnson  <rpj@callisto.canberra.edu.au>
 - -	* benchtest.h: Move old mutex code into benchlib.c.
 -	* benchlib.c: New statically linked module to ensure that
 -	bench apps don't inline the code and therefore have an unfair
 -	advantage over the pthreads lib routines. Made little or no
 -	difference.
 -	* benchtest1.c: Minor change to avoid compiler warnings.
 -	* benchtest5.c: Likewise.
 -	* benchtest2.c: Fix misinformation in output report.
 -	* README.BENCH: Add comments on results.
 - -2003-09-14  Ross Johnson  <rpj@callisto.canberra.edu.au>
 - -	* priority1.c: Reworked to comply with modified priority
 -	management and provide additional output.
 -	* priority2.c: Likewise.
 -	* inherit1.c: Likewise.
 - -2003-09-03  Ross Johnson  <rpj@callisto.canberra.edu.au>
 - -	* exit4.c: New test.
 -	* exit5.c: New test.
 -	* cancel7.c: New test.
 -	* cancel8.c: New test.
 - -2003-08-13  Ross Johnson  <rpj@ise.canberra.edu.au>
 - -	* reuse1.c: New test.
 -	* reuse1.c: New test.
 -	* valid1.c: New test.
 -	* valid2.c: New test.
 -	* kill1.c: New test.
 - 	* create2.c: Now included in test regime.
 - -2003-07-19  Ross Johnson  <rpj@ise.canberra.edu.au>
 - -	* eyal1.c (waste_time): Make threads do more work to ensure that
 -	all threads get to do some work.
 -	* semaphore1.c: Make it clear that certain errors are expected.
 -	* exception2.c (non_MSVC code sections): Change to include
 -	C++ standard include file, i.e. change <new.h> to <exception>.
 -	* exception3.c (non_MSVC code sections): Likewise; qualify std::
 -	namespace entities where necessary.
 -	* GNUmakefile: modified to work in the MsysDTK (newer MinGW)
 -	environment; define CC as gcc or g++ as appropriate because
 -	using gcc -x c++ doesn't link with required c++ libs by default,
 -	but g++ does.
 - -2002-12-11  Ross Johnson  <ross@special.ise.canberra.edu.au>
 -
 -	* mutex7e.c: Assert EBUSY return instead of EDEADLK.
 -
 -2002-06-03  Ross Johnson  <rpj@digit.ise.canberra.edu.au>
 -
 -	* semaphore2.c: New test.
 -
 -2002-03-02  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* Makefile (CFLAGS): Changed /MT to /MD to link with
 -	the correct library MSVCRT.LIB. Otherwise errno doesn't
 -	work.
 -
 -2002-02-28  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* exception3.c: Correct recent change.
 -
 -	* semaphore1.c: New test.
 -
 -	* Makefile: Add rule to generate pre-processor output.
 -
 -2002-02-28  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* exception3.c (terminateFunction): For MSVC++, call
 -	exit() rather than pthread_exit(). Add comments to explain
 -	why.
 -	   * Notes from the MSVC++ manual:
 -	   *       1) A term_func() should call exit(), otherwise
 -	   *          abort() will be called on return to the caller.
 -	   *          abort() raises SIGABRT. The default signal handler
 -	   *          for all signals terminates the calling program with
 -	   *          exit code 3.
 -	   *       2) A term_func() must not throw an exception. Therefore
 -	   *          term_func() should not call pthread_exit() if an
 -	   *          an exception-using version of pthreads-win32 library
 -	   *          is being used (i.e. either pthreadVCE or pthreadVSE).
 -
 -
 -2002-02-23  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* rwlock2_t.c: New test.
 -	* rwlock3_t.c: New test.
 -	* rwlock4_t.c: New test.
 -	* rwlock5_t.c: New test.
 -	* rwlock6_t.c: New test.
 -	* rwlock6_t2.c: New test.
 -	* rwlock6.c (main): Swap thread and result variables
 -	to correspond to actual thread functions.
 -	* rwlock1.c: Change test description comment to correspond
 -	to the actual test.
 -
 -	* condvar1_2.c: Loop over the test many times in the hope
 -	of detecting any intermittent deadlocks. This is to
 -	test a fixed problem in pthread_cond_destroy.c.
 -
 -	* spin4.c: Remove unused variable.
 -
 -2002-02-17  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* condvar1_1.c: New test.
 -	* condvar1_2.c: New test.
 -
 -2002-02-07  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* delay1.c: New test.
 -	* delay2.c: New test.
 -	* exit4.c: New test.
 -
 -2002-02-02  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* mutex8: New test.
 -	* mutex8n: New test.
 -	* mutex8e: New test.
 -	* mutex8r: New test.
 -	* cancel6a: New test.
 -	* cancel6d: New test.
 -	* cleanup0.c: Add pragmas for inline optimisation control.
 -	* cleanup1.c: Add pragmas for inline optimisation control.
 -	* cleanup2.c: Add pragmas for inline optimisation control.
 -	* cleanup3.c: Add pragmas for inline optimisation control.
 -	* condvar7.c: Add pragmas for inline optimisation control.
 -	* condvar8.c: Add pragmas for inline optimisation control.
 -	* condvar9.c: Add pragmas for inline optimisation control.
 -
 -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.
 -
 -2002-01-09  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* mutex7.c: New test.
 -	* mutex7n.c: New test.
 -	* mutex7e.c: New test.
 -	* mutex7r.c: New test.
 -	* mutex6.c: Modified to avoid leaving the locked mutex
 -	around on exit.
 -
 -2001-10-25  Ross Johnson  <rpj@setup1.ise.canberra.edu.au>
 -
 -	* condvar2.c: Remove reference to cv->nWaitersUnblocked.
 -	* condvar2_1.c: Likewise; lower NUMTHREADS from 60 to 30.
 -	* condvar3_1.c: Likewise.
 -	* condvar3_2.c: Likewise.
 -	* count1.c: lower NUMTHREADS from 60 to 30.
 -	* inherit1.c: Determine valid priority values and then
 -	assert values returned by POSIX routines are the same.
 -	* priority1.c: Likewise.
 -	* priority2.c: Likewise.
 -	
 -2001-07-12  Ross Johnson  <rpj@setup1.ise.canberra.edu.au>
 -
 -	* barrier5.c: Assert that precisely one thread receives
 -	PTHREAD_BARRIER_SERIAL_THREAD at each barrier.
 -
 -2001-07-09  Ross Johnson  <rpj@setup1.ise.canberra.edu.au>
 -
 -	* barrier3.c: Fixed.
 -	* barrier4.c: Fixed.
 -	* barrier5.c: New; proves that all threads in the group
 -	reaching the barrier wait and then resume together. Repeats the test
 -	using groups of 1 to 16 threads. Each group of threads must negotiate
 -	a large number of barriers (10000).
 -	* spin4.c: Fixed.
 -	* test.h (error_string): Modified the success (0) value.
 -
 -2001-07-07  Ross Johnson  <rpj@setup1.ise.canberra.edu.au>
 -
 -	* spin3.c: Changed test and fixed.
 -	* spin4.c: Fixed.
 -	* barrier3.c: Fixed.
 -	* barrier4.c: Fixed.
 -
 -2001-07-05  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* spin1.c: New; testing spinlocks.
 -	* spin2.c: New; testing spinlocks.
 -	* spin3.c: New; testing spinlocks.
 -	* spin4.c: New; testing spinlocks.
 -	* barrier1.c: New; testing barriers.
 -	* barrier2.c: New; testing barriers.
 -	* barrier3.c: New; testing barriers.
 -	* barrier4.c: New; testing barriers.
 -	* GNUmakefile: Add new tests.
 -	* Makefile: Add new tests.
 -
 -2001-07-01  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* benchtest3.c: New; timing mutexes.
 -	* benchtest4.c: New; time mutexes.
 -	* condvar3_1.c: Fixed bug - Alexander Terekhov
 -	* condvar3_3.c: New test.
 -
 -2001-06-25  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* priority1.c: New test.
 -	* priority2.c: New test.
 -	* inherit1.c: New test.
 -	* benchtest1.c: New; timing mutexes.
 -	* benchtest2.c: New; timing mutexes.
 -	* mutex4.c: Modified to test all mutex types.
 -
 -2001-06-8  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* mutex5.c: Insert inert change to quell compiler warnings.
 -	* condvar3_2.c: Remove unused variable.
 -	
 -2001-06-3  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* condvar2_1.c: New test.
 -	* condvar3_1.c: New test.
 -	* condvar3_2.c: New test.
 -
 -2001-05-30  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* mutex1n.c: New test.
 -	* mutex1e.c: New test.
 -	* mutex1r.c: New test.
 -	* mutex4.c: Now locks and unlocks a mutex.
 -	* mutex5.c: New test.
 -	* mutex6.c: New test.
 -	* mutex6n.c: New test.
 -	* mutex6e.c: New test.
 -	* mutex6r.c: New test.
 -	* Makefile: Added new tests; reorganised.
 -	* GNUmakefile: Likewise.
 -	* rwlock6.c: Fix to properly prove read-while-write locking
 -	and single writer locking.
 -
 -2001-05-29  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* Makefile: Reorganisation.
 -	* GNUmakefile: Likewise.
 -	- Thomas Pfaff <tpfaff@gmx.net>
 -
 -	* exception1.c: Add stdio.h include to define fprintf and stderr
 -	in non-exception C version of main().
 -	* exception2.c: Likewise.
 -	* exception3.c: Likewise.
 -
 -	* Makefile (rwlock7): Add new test.
 -	* GNUmakefile (rwlock7): Add new test.
 -	* rwlock7.c: New test.
 -	* rwlock6.c: Changed to test that writer has priority.
 -
 -	* eyal1.c (main): Unlock each mutex_start lock before destroying
 -	it.
 -
 -2000-12-29  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* GNUmakefile: Add mutex4 test; ensure libpthreadw32.a is
 -	removed for "clean" target.
 -	* Makefile: Add mutex4 test.
 -
 -	* exception3.c: Remove SEH code; automatically pass the test
 -	under SEH (which is an N/A environment).
 -
 -	* mutex4.c: New test.
 -
 -	* eyal1.c (do_work_unit): Add a dummy "if" to force the
 -	optimiser to retain code; reduce thread work loads.
 -
 -	* condvar8.c (main): Add an additional "assert" for debugging;
 -	increase pthread_cond_signal timeout.
 -
 -2000-12-28  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* eyal1.c: Increase thread work loads.
 -	* exception2.c: New test.
 -	* exception3.c: New test.
 -	* Makefile: Add new tests exception2.c and exception3.c.
 -	* GNUmakefile: Likewise.
 -
 -2000-12-11  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* cleanup3.c: Remove unused variable.
 -	* cleanup2.c: Likewise.
 -	* exception1.c: Throw an exception rather than use
 -	a deliberate zero divide so that catch(...) will
 -	handle it under Mingw32. Mingw32 now builds the
 -	library correctly to pass all tests - see Thomas
 -	Pfaff's detailed instructions re needed changes
 -	to Mingw32 in the Pthreads-Win32 FAQ.
 -
 -2000-09-08  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* cancel5.c: New; tests calling pthread_cancel()
 -	from the main thread without first creating a
 -	POSIX thread struct for the non-POSIX main thread
 -	- this forces pthread_cancel() to create one via
 -	pthread_self().
 -	* Makefile (cancel5): Add new test.
 -	* GNUmakefile (cancel5): Likewise.
 -
 -2000-08-17  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* create2.c: New; Test that pthread_t contains
 -	the W32 HANDLE before it calls the thread routine
 -	proper.
 -
 -2000-08-13  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* condvar3.c: Minor change to eliminate compiler
 -	warning.
 -
 -	* condvar4.c: ditto.
 -
 -	* condvar5.c: ditto.
 -
 -	* condvar6.c: ditto.
 -
 -	* condvar7.c: ditto.
 -
 -	* condvar8.c: ditto.
 -
 -	* condvar9.c: ditto.
 -
 -	* exit1.c: Function needed return statement.
 -
 -	* cleanup1.c: Remove unnecessary printf arg.
 -
 -	* cleanup2.c: Fix cast.
 -
 -	* rwlock6.c: Fix casts.
 -
 -	* exception1.c (PtW32CatchAll): Had the wrong name;
 -	fix casts.
 -
 -	* cancel3.c: Remove unused waitLock variable.
 -
 -	* GNUmakefile: Change library/dll naming; add new tests;
 -	general minor changes.
 -
 -	* Makefile: Change library/dll naming; add targets for
 -	testing each of the two VC++ EH scheme versions;
 -	default target now issues help message; compile warnings
 -	now interpreted as errors to stop the make; add new
 -	tests; restructure to remove prerequisites needed
 -	otherwise.
 -
 -	* README: Updated.
 -
 -
 -2000-08-10  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* eyal1.c (main): Change implicit cast to explicit
 -	cast when passing "print_server" function pointer;
 -	G++ no longer allows implicit func parameter casts.
 -
 -	* cleanup1.c: Remove unused "waitLock".
 -	(main): Fix implicit parameter cast.
 -
 -	* cancel2.c (main): Fix implicit parameter cast.
 -
 -	* cancel4.c (main): Fix implicit parameter cast.
 -
 -	* cancel3.c (main): Fix implicit parameter cast.
 -
 -	* GNUmakefile: Renamed from Makefile; Add missing
 -	cancel1 and cancel2 test targets.
 -
 -	* Makefile: Converted for use with MS nmake.
 -
 -2000-08-06  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* ccl.bat: Add /nologo to remove extraneous output.
 -
 -	* exception1.c (exceptionedThread): Init 'dummy';
 -	put expression into if condition to prevent optimising away;
 -	remove unused variable.
 -
 -	* cancel4.c (mythread): Cast return value to avoid warnings.
 -
 -	* cancel2.c (mythread): Missing #endif.
 -
 -	* condvar9.c (mythread): Cast return value to avoid warnings.
 -
 -	* condvar8.c (mythread): Cast return value to avoid warnings.
 -
 -	* condvar7.c (mythread): Cast return value to avoid warnings.
 -
 -	* cleanup3.c (mythread): Cast return value to avoid warnings.
 -
 -	* cleanup2.c (mythread): Cast return value to avoid warnings.
 -
 -	* cleanup1.c (mythread): Cast return value to avoid warnings.
 -
 -	* condvar5.c (mythread): Cast return value to avoid warnings.
 -
 -	* condvar3.c (mythread): Cast return value to avoid warnings.
 -
 -	* condvar6.c (mythread): Cast return value to avoid warnings.
 -
 -	* condvar4.c (mythread): Cast return value to avoid warnings.
 -
 -2000-08-05  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* cancel2.c: Use PtW32CatchAll macro if defined.
 -
 -	* exception1.c: Use PtW32CatchAll macro if defined.
 -
 -2000-08-02  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* tsd1.c: Fix typecasts of &result [g++ is now very fussy].
 -	
 -	* test.h (assert): Return 0's explicitly to allay
 -	g++ errors.
 -	
 -	* join2.c: Add explicit typecasts.
 -	
 -	* join1.c: Add explicit typecasts.
 -	
 -	* join0.c: Add explicit typecasts.
 -	
 -	* eyal1.c: Add explicit typecasts.
 -	
 -	* count1.c (main): Add type cast to remove g++ parse warning
 -	[gcc-2.95.2 seems to have tightened up on this].
 -
 -	* Makefile (GLANG): Use c++ explicitly.
 -	Remove MSVC sections (was commented out).
 -	Add target to generate cpp output.
 -
 -2000-07-25  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* runtest.bat: modified to work under W98.
 -	
 -	* runall.bat: Add new tests; modified to work under W98.
 -	It was ok under NT.
 -
 -	* Makefile: Add new tests.
 -
 -	* exception1.c: New; Test passing exceptions back to the
 -	application and retaining library internal exceptions.
 -
 -	* join0.c: New; Test a single join.
 -
 -2000-01-06  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* cleanup1.c: New; Test cleanup handler executes (when thread is
 -	canceled).
 -
 -	* cleanup2.c: New; Test cleanup handler executes (when thread is
 -	not canceled).
 -
 -	* cleanup3.c: New; Test cleanup handler does not execute
 -	(when thread is not canceled).
 -
 -2000-01-04  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* cancel4.c: New; Test cancelation does not occur in deferred
 -	cancelation threads with no cancelation points.
 -
 -	* cancel3.c: New; Test asynchronous cancelation.
 -
 -	* context1.c: New; Test context switching method for async
 -	cancelation.
 -
 -1999-11-23  Ross Johnson  <rpj@special.ise.canberra.edu.au>
 -
 -	* test.h: Add header includes; include local header versions rather
 -	than system versions; rearrange the assert macro defines.
 -
 -1999-11-07  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* loadfree.c: New. Test loading and freeing the library (DLL).
 -
 -1999-10-30  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* cancel1.c: New. Test pthread_setcancelstate and
 -	pthread_setcanceltype functions.
 -	* eyal1.c (waste_time): Change calculation to avoid FP exception
 -	on Aplhas
 -	- Rich Peters <rpeters@micro-magic.com>
 -
 -Oct 14 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* condvar7.c: New. Test broadcast after waiting thread is canceled.
 -	* condvar8.c: New. Test multiple broadcasts.
 -	* condvar9.c: New. Test multiple broadcasts with thread
 -	cancelation.
 -	
 -Sep 16 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* rwlock6.c: New test.
 -
 -Sep 15 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* rwlock1.c: New test.
 -	* rwlock2.c: New test.
 -	* rwlock3.c: New test.
 -	* rwlock4.c: New test.
 -	* rwlock5.c: New test.
 -
 -Aug 22 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* runall.bat (join2): Add test.
 -
 -Aug 19 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* join2.c: New test.
 -
 -Wed Aug 12 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* Makefile (LIBS): Add -L.
 -
 -Mon May 31 10:25:01 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* Makefile (GLANG): Add GCC language option.
 -
 -Sat May 29 23:29:04 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* runall.bat (condvar5): Add new test.
 -
 -	* runall.bat (condvar6): Add new test.
 -
 -	* Makefile (condvar5) : Add new test.
 -	
 -	* Makefile (condvar6) : Add new test.
 -	
 -	* condvar5.c: New test for pthread_cond_broadcast().
 -
 -	* condvar6.c: New test for pthread_cond_broadcast().
 -
 -Sun Apr  4 12:04:28 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* tsd1.c (mythread): Change Sleep(0) to sched_yield().
 -	(sched.h): Include.
 -
 -	* condvar3.c (mythread): Remove redundant Sleep().
 -
 -	* runtest.bat: Re-organised to make more informative.
 -
 -Fri Mar 19 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* *.bat: redirect unwanted output to nul:
 -
 -	* runall.bat: new.
 -
 -	* cancel1.c: new. Not part of suite yet.
 -	
 -Mon Mar 15 00:17:55 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* mutex1.c: only test mutex init and destroy; add assertions.
 -
 -	* count1.c: raise number of spawned threads to 60 (appears to
 -	be the limit under Win98).
 -
 -Sun Mar 14 21:31:02 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* test.h (assert): add assertion trace option.
 -	Use:
 -	"#define ASSERT_TRACE 1" to turn it on,
 -	"#define ASSERT_TRACE 0" to turn it off (default).
 -
 -	* condvar3.c (main): add more assertions.
 -
 -	* condvar4.c (main): add more assertions.
 -
 -	* condvar1.c (main): add more assertions.
 -
 -Fri Mar 12 08:34:15 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* condvar4.c (cvthing): switch the order of the INITIALIZERs.
 -
 -	* eyal1.c (main): Fix trylock loop; was not waiting for thread to lock
 -	the "started" mutex.
 -
 -Wed Mar 10 10:41:52 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* tryentercs.c: Apply typo patch from bje.
 -
 -	* tryentercs2.c: Ditto.
 -
 -Sun Mar  7 10:41:52 1999  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* Makefile (condvar3, condvar4): Add tests.
 -
 -	* condvar4.c (General): Reduce to simple test case; prerequisite
 -	is condvar3.c; add description.
 -
 -	* condvar3.c (General): Reduce to simple test case; prerequisite
 -	is condvar2.c; add description.
 -
 -	* condvar2.c (General): Reduce to simple test case; prerequisite
 -	is condvar1.c; add description.
 -
 -	* condvar1.c (General): Reduce to simple test case; add
 -	description.
 -
 -	* Template.c (Comments): Add generic test detail.
 -
 -1999-02-23  Ross Johnson  <rpj@ise.canberra.edu.au>
 -
 -        * Template.c: Revamp.
 -
 -        * condvar1.c: Add.
 -
 -        * condvar2.c: Add.
 -
 -        * Makefile: Add condvar1 condvar2 tests.
 -
 -        * exit1.c, exit2.c, exit3.c: Cosmetic changes.
 -
 -1999-02-23  Ross Johnson  <rpj@ise.canberra.edu.au>
 -
 -	* Makefile: Some refinement.
 -
 -	* *.c: More exhaustive checking through assertions; clean up;
 -	add some more tests.
 -
 -	* Makefile: Now actually runs the tests.
 -
 -	* tests.h: Define our own assert macro. The Mingw32
 -	version pops up a dialog but we want to run non-interactively.
 -
 -	* equal1.c: use assert a little more directly so that it
 -	prints the actual call statement.
 -
 -	* exit1.c: Modify to return 0 on success, 1 on failure.
 -
 -1999-02-22  Ross Johnson  <rpj@ise.canberra.edu.au>
 -
 -	* self2.c: Bring up to date.
 -
 -	* self3.c: Ditto.
 -
 -1999-02-21  Ben Elliston  <bje@cygnus.com>
 -
 -	* README: Update.
 -
 -	* Makefile: New file. Run all tests automatically. Primitive tests
 -	are run first; more complex tests are run last.
 -
 -	* count1.c: New test. Validate the thread count.
 -
 -	* exit2.c: Perform a simpler test.
 -	
 -	* exit3.c: New test. Replaces exit2.c, since exit2.c needs to
 -	perform simpler checking first.
 -
 -	* create1.c: Update to use the new testsuite exiting convention.
 -	
 -	* equal1.c: Likewise.
 -
 -	* mutex1.c: Likewise.
 -
 -	* mutex2.c: Likewise.
 -
 -	* once1.c: Likewise.
 -
 -	* self2.c: Likewise.
 -
 -	* self3.c: Likewise.
 -
 -	* tsd1.c: Likewise.
 -
 -1999-02-20  Ross Johnson  <rpj@ise.canberra.edu.au>
 -
 -	* mutex2.c: Test static mutex initialisation.
 -
 -	* test.h: New. Declares a table mapping error numbers to
 -	error names.
 -
 -1999-01-17  Ross Johnson  <rpj@ise.canberra.edu.au>
 -
 -	* runtest: New script to build and run a test in the tests directory.
 -
 -Wed Dec 30 11:22:44 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* tsd1.c: Re-written. See comments at start of file.
 -	* Template.c: New. Contains skeleton code and comment template
 -	intended to fully document the test.
 -
 -Fri Oct 16 17:59:49 1998  Ross Johnson  <rpj@swan.canberra.edu.au>
 -
 -	* tsd1.c (destroy_key): Add function. Change diagnostics.
 -
 -Thu Oct 15 17:42:37 1998  Ross Johnson  <rpj@swan.canberra.edu.au>
 -
 -	* tsd1.c (mythread): Fix some casts and add some message
 -	output. Fix inverted conditional.
 -
 -Mon Oct 12 02:12:29 1998  Ross Johnson  <rpj@ixobrychus.canberra.edu.au>
 -
 -	* tsd1.c: New. Test TSD using 1 key and 2 threads.
 -
 -1998-09-13  Ben Elliston  <bje@cygnus.com>
 -
 -	* eyal1.c: New file; contributed by Eyal Lebedinsky
 -	<eyal@eyal.emu.id.au>.
 -
 -1998-09-12  Ben Elliston  <bje@cygnus.com>
 -
 -	* exit2.c (func): Return a value.
 -	(main): Call the right thread entry function.
 -
 -1998-07-22  Ben Elliston  <bje@cygnus.com>
 -
 -	* exit2.c (main): Fix size of pthread_t array.
 -
 -1998-07-10  Ben Elliston  <bje@cygnus.com>
 -
 -	* exit2.c: New file; test pthread_exit() harder.
 -
 -	* exit1.c: New file; test pthread_exit().
 +	* exit1.c: New file; test pthread_exit(). diff --git a/tests/Debug.dsp b/tests/Debug.dsp new file mode 100644 index 0000000..0ba51bb --- /dev/null +++ b/tests/Debug.dsp @@ -0,0 +1,93 @@ +# Microsoft Developer Studio Project File - Name="Debug" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=Debug - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE  +!MESSAGE NMAKE /f "Debug.mak". +!MESSAGE  +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE  +!MESSAGE NMAKE /f "Debug.mak" CFG="Debug - Win32 Debug" +!MESSAGE  +!MESSAGE Possible choices for configuration are: +!MESSAGE  +!MESSAGE "Debug - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "Debug - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE  + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF  "$(CFG)" == "Debug - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0xc09 /d "NDEBUG" +# ADD RSC /l 0xc09 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF  "$(CFG)" == "Debug - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /Ze /W3 /WX /Gm /vd1 /GR- /GX- /ZI /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "CLEANUP_C" /FR /YX /FD /GZ /c +# ADD BASE RSC /l 0xc09 /d "_DEBUG" +# ADD RSC /l 0xc09 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib pthreadVC.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:".." + +!ENDIF  + +# Begin Target + +# Name "Debug - Win32 Release" +# Name "Debug - Win32 Debug" +# Begin Source File + +SOURCE=.\Debug.txt +# End Source File +# Begin Source File + +SOURCE=.\semaphore4.c +# End Source File +# End Target +# End Project diff --git a/tests/Debug.dsw b/tests/Debug.dsw new file mode 100644 index 0000000..5fd6af3 --- /dev/null +++ b/tests/Debug.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "Debug"=.\Debug.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/tests/Debug.ncb b/tests/Debug.ncbBinary files differ new file mode 100644 index 0000000..68ecb6d --- /dev/null +++ b/tests/Debug.ncb diff --git a/tests/Debug.opt b/tests/Debug.optBinary files differ new file mode 100644 index 0000000..f263d4f --- /dev/null +++ b/tests/Debug.opt diff --git a/tests/Debug.plg b/tests/Debug.plg new file mode 100644 index 0000000..9b26377 --- /dev/null +++ b/tests/Debug.plg @@ -0,0 +1,35 @@ +<html> +<body> +<pre> +<h1>Build Log</h1> +<h3> +--------------------Configuration: Debug - Win32 Debug-------------------- +</h3> +<h3>Command Lines</h3> +Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP8EA.tmp" with contents +[ +/nologo /MDd /Ze /W3 /WX /Gm /vd1 /GR- /GX- /ZI /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "CLEANUP_C" /FR"Debug/" /Fp"Debug/Debug.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c  +"E:\PTHREADS\pthreads\tests\semaphore4.c" +] +Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP8EA.tmp"  +Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP8EB.tmp" with contents +[ +kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib pthreadVC.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/Debug.pdb" /debug /machine:I386 /out:"Debug/Debug.exe" /pdbtype:sept /libpath:".."  +.\Debug\semaphore4.obj +] +Creating command line "link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP8EB.tmp" +<h3>Output Window</h3> +Compiling... +semaphore4.c +Linking... +Creating command line "bscmake.exe /nologo /o"Debug/Debug.bsc"  .\Debug\semaphore4.sbr" +Creating browse info file... +<h3>Output Window</h3> + + + +<h3>Results</h3> +Debug.exe - 0 error(s), 0 warning(s) +</pre> +</body> +</html> diff --git a/tests/Debug.txt b/tests/Debug.txt new file mode 100644 index 0000000..5323874 --- /dev/null +++ b/tests/Debug.txt @@ -0,0 +1,6 @@ +This project is used to debug individual test case programs. + +To build and debug a test case: +- add the .c file to this project; +- remove any .c files from other test cases from this project. +- build and debug as usual.
\ No newline at end of file diff --git a/tests/GNUmakefile b/tests/GNUmakefile index aecd718..0e07abf 100644 --- a/tests/GNUmakefile +++ b/tests/GNUmakefile @@ -50,8 +50,8 @@ MAKE	= make  #  XXCFLAGS	=   XXLIBS	= -lws2_32 -CFLAGS	= -O3 -UNDEBUG -Wall $(XXCFLAGS) -#CFLAGS	= -g -O0 -UNDEBUG -Wall $(XXCFLAGS) +#CFLAGS	= -O3 -UNDEBUG -Wall $(XXCFLAGS) +CFLAGS	= -g -UNDEBUG -Wall $(XXCFLAGS)  BUILD_DIR	= ..  INCLUDES	= -I. @@ -81,7 +81,9 @@ TESTS	= sizes loadfree \  	  mutex4 mutex6 mutex6n mutex6e mutex6r \  	  mutex6s mutex6es mutex6rs \  	  mutex7 mutex7n mutex7e mutex7r mutex8 mutex8n mutex8e mutex8r \ -	  count1 once1 tsd1 self2 cancel1 cancel2 \ +	  count1 once1 tsd1 self2 \ +	  cancel1 cancel2 \ +	  semaphore4 semaphore4t \  	  delay1 delay2 eyal1 \  	  condvar3 condvar3_1 condvar3_2 condvar3_3 \  	  condvar4 condvar5 condvar6 condvar7 condvar8 condvar9 \ @@ -253,6 +255,8 @@ self2.pass: create1.pass  semaphore1.pass:  semaphore2.pass:  semaphore3.pass: semaphore2.pass +semaphore4.pass: semaphore3.pass cancel1.pass +semaphore4t.pass: semaphore4.pass  sizes.pass:  spin1.pass:  spin2.pass: spin1.pass diff --git a/tests/Makefile b/tests/Makefile index 71154b3..10dd7fe 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,349 +1,353 @@ -# Makefile for the pthreads test suite.
 -# If all of the .pass files can be created, the test suite has passed.
 -#
 -# --------------------------------------------------------------------------
 -#
 -#      Pthreads-win32 - POSIX Threads Library for Win32
 -#      Copyright(C) 1998 John E. Bossom
 -#      Copyright(C) 1999,2003 Pthreads-win32 contributors
 -# 
 -#      Contact Email: rpj@callisto.canberra.edu.au
 -# 
 -#      The current list of contributors is contained
 -#      in the file CONTRIBUTORS included with the source
 -#      code distribution. The list can also be seen at the
 -#     following World Wide Web location:
 -#      http://sources.redhat.com/pthreads-win32/contributors.html
 -# 
 -#      This library is free software; you can redistribute it and/or
 -#      modify it under the terms of the GNU Lesser General Public
 -#      License as published by the Free Software Foundation; either
 -#      version 2 of the License, or (at your option) any later version.
 -# 
 -#      This library is distributed in the hope that it will be useful,
 -#      but WITHOUT ANY WARRANTY; without even the implied warranty of
 -#      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 -#      Lesser General Public License for more details.
 -# 
 -#      You should have received a copy of the GNU Lesser General Public
 -#      License along with this library in the file COPYING.LIB;
 -#      if not, write to the Free Software Foundation, Inc.,
 -#      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 -#
 -
 -
 -CP	= copy
 -RM	= erase
 -CAT	= type
 -MKDIR	= mkdir
 -TOUCH	= echo Passed >
 -ECHO	= @echo
 -
 -QAPC	= ..\QueueUserAPCEx\User\quserex.dll
 -
 -CPHDR	= pthread.h semaphore.h sched.h
 -
 -OPTIM	= /O2 /Ob0
 -
 -XXLIBS	= ws2_32.lib
 -
 -# C++ Exceptions
 -VCEFLAGS	= /GX /TP /DPtW32NoCatchWarn /D__CLEANUP_CXX
 -VCELIB	= pthreadVCE.lib
 -VCEDLL	= pthreadVCE.dll
 -# Structured Exceptions
 -VSEFLAGS	= /D__CLEANUP_SEH
 -VSELIB	= pthreadVSE.lib
 -VSEDLL	= pthreadVSE.dll
 -# 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
 -
 -# Defaults
 -CPLIB	= pthreadVC.lib
 -CPDLL	= pthreadVC.dll
 -
 -CFLAGS= $(OPTIM) /W3 /WX /MD /nologo /Yd /Zi
 -LFLAGS= /INCREMENTAL:NO
 -INCLUDES=-I.
 -BUILD_DIR=..
 -
 -COPYFILES	= $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC)
 -
 -TEST		=
 -EHFLAGS	=
 -
 -# If a test case returns a non-zero exit code to the shell, make will
 -# stop.
 -
 -PASSES= sizes.pass  loadfree.pass \
 -	  self1.pass  mutex5.pass  \
 +# Makefile for the pthreads test suite. +# If all of the .pass files can be created, the test suite has passed. +# +# -------------------------------------------------------------------------- +# +#      Pthreads-win32 - POSIX Threads Library for Win32 +#      Copyright(C) 1998 John E. Bossom +#      Copyright(C) 1999,2003 Pthreads-win32 contributors +#  +#      Contact Email: rpj@callisto.canberra.edu.au +#  +#      The current list of contributors is contained +#      in the file CONTRIBUTORS included with the source +#      code distribution. The list can also be seen at the +#     following World Wide Web location: +#      http://sources.redhat.com/pthreads-win32/contributors.html +#  +#      This library is free software; you can redistribute it and/or +#      modify it under the terms of the GNU Lesser General Public +#      License as published by the Free Software Foundation; either +#      version 2 of the License, or (at your option) any later version. +#  +#      This library is distributed in the hope that it will be useful, +#      but WITHOUT ANY WARRANTY; without even the implied warranty of +#      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU +#      Lesser General Public License for more details. +#  +#      You should have received a copy of the GNU Lesser General Public +#      License along with this library in the file COPYING.LIB; +#      if not, write to the Free Software Foundation, Inc., +#      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +# + + +CP	= copy +RM	= erase +CAT	= type +MKDIR	= mkdir +TOUCH	= echo Passed > +ECHO	= @echo + +QAPC	= ..\QueueUserAPCEx\User\quserex.dll + +CPHDR	= pthread.h semaphore.h sched.h + +OPTIM	= /O2 /Ob0 + +XXLIBS	= ws2_32.lib + +# C++ Exceptions +VCEFLAGS	= /GX /TP /DPtW32NoCatchWarn /D__CLEANUP_CXX +VCELIB	= pthreadVCE.lib +VCEDLL	= pthreadVCE.dll +# Structured Exceptions +VSEFLAGS	= /D__CLEANUP_SEH +VSELIB	= pthreadVSE.lib +VSEDLL	= pthreadVSE.dll +# 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 + +# Defaults +CPLIB	= pthreadVC.lib +CPDLL	= pthreadVC.dll + +CFLAGS= $(OPTIM) /W3 /WX /MD /nologo /Yd /Zi +LFLAGS= /INCREMENTAL:NO +INCLUDES=-I. +BUILD_DIR=.. + +COPYFILES	= $(CPHDR) $(CPLIB) $(CPDLL) $(QAPC) + +TEST		= +EHFLAGS	= + +# If a test case returns a non-zero exit code to the shell, make will +# stop. + +PASSES= sizes.pass  loadfree.pass \ +	  self1.pass  mutex5.pass  \  	  mutex1.pass  mutex1n.pass  mutex1e.pass  mutex1r.pass  \  	  semaphore1.pass  semaphore2.pass  semaphore3.pass  \ -	  mutex2.pass  mutex3.pass  \
 -	  mutex2r.pass  mutex2e.pass  mutex3r.pass  mutex3e.pass  \
 -	  condvar1.pass  condvar1_1.pass  condvar1_2.pass  condvar2.pass  condvar2_1.pass  \
 -	  exit1.pass  create1.pass  create2.pass  reuse1.pass  reuse2.pass  equal1.pass  \
 -	  kill1.pass  valid1.pass  valid2.pass  \
 -	  exit2.pass  exit3.pass  exit4  exit5  \
 -	  join0.pass  join1.pass  join2.pass join3.pass  \
 -	  mutex4.pass  mutex6.pass  mutex6n.pass  mutex6e.pass  mutex6r.pass  \
 -	  mutex6s.pass  mutex6es.pass  mutex6rs.pass  \
 -	  mutex7.pass  mutex7n.pass  mutex7e.pass  mutex7r.pass  \
 -	  mutex8.pass  mutex8n.pass  mutex8e.pass  mutex8r.pass  \
 -	  count1.pass  once1.pass  tsd1.pass  \
 -	  self2.pass  \
 -	  cancel1.pass  cancel2.pass  \
 -	  delay1.pass  delay2.pass  eyal1.pass  \
 -	  condvar3.pass  condvar3_1.pass  condvar3_2.pass  condvar3_3.pass  \
 -	  condvar4.pass  condvar5.pass  condvar6.pass  \
 -	  condvar7.pass  condvar8.pass  condvar9.pass  \
 -	  errno1.pass  \
 -	  rwlock1.pass  rwlock2.pass  rwlock3.pass  rwlock4.pass  \
 -	  rwlock5.pass  rwlock6.pass  rwlock7.pass  rwlock8.pass  \
 -	  rwlock2_t.pass  rwlock3_t.pass  rwlock4_t.pass  rwlock5_t.pass  rwlock6_t.pass  rwlock6_t2.pass  \
 -	  context1.pass  \
 -	  cancel3.pass  cancel4.pass  cancel5.pass  cancel6a.pass  cancel6d.pass  \
 -	  cancel7  cancel8  \
 -	  cleanup0.pass  cleanup1.pass  cleanup2.pass  cleanup3.pass  \
 -	  priority1.pass priority2.pass inherit1.pass  \
 -	  spin1.pass  spin2.pass  spin3.pass  spin4.pass  \
 -	  barrier1.pass  barrier2.pass  barrier3.pass  barrier4.pass  barrier5.pass  \
 -	  exception1.pass  exception2.pass  exception3.pass  \
 -	  cancel9 create3
 -
 -BENCHRESULTS = \
 -	  benchtest1.bench benchtest2.bench benchtest3.bench benchtest4.bench benchtest5.bench
 -
 -help:
 -	@ $(ECHO) Run one of the following command lines:
 -	@ $(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   (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-bench    (to benchtest using VC dll with C bench app)
 -	@ $(ECHO) nmake clean VCX-bench   (to benchtest using VC dll with C++ bench app)
 -	@ $(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)
 -
 -all:
 -	@ nmake clean VC
 -	@ nmake clean VCX
 -	@ nmake clean VCE
 -	@ nmake clean VSE
 -	@ nmake clean VC-bench
 -
 -# This allows an individual test application to be made using the default lib.
 -# e.g. nmake clean test cancel3.exe
 -test: $(CPLIB) $(CPDLL) $(CPHDR) $(QAPC)
 -
 -tests: $(CPLIB) $(CPDLL) $(CPHDR) $(QAPC) $(PASSES)
 -	@ $(ECHO) ALL TESTS PASSED! Congratulations!
 -
 -benchtests: $(CPLIB) $(CPDLL) $(CPHDR) $(XXLIBS) $(BENCHRESULTS)
 -	@ $(ECHO) ALL BENCH TESTS DONE.
 -
 -sizes.pass: sizes.exe
 -	@ $(ECHO) ... Running $(TEST) test: $*.exe
 -	@ .\$*.exe > SIZES.$(TEST)
 -	@ $(CAT) SIZES.$(TEST)
 -	@ $(ECHO) ...... Passed
 -	@ $(TOUCH) $*.pass
 -
 -$(PASSES): $*.exe
 -	@ $(ECHO) ... Running $(TEST) test: $*.exe
 -	@ .\$*.exe
 -	@ $(ECHO) ...... Passed
 -	@ $(TOUCH) $*.pass
 -
 -$(BENCHRESULTS): $*.exe
 -	@ $(ECHO) ... Running $(TEST) benchtest: $*.exe
 -	@ .\$*.exe
 -	@ $(ECHO) ...... Done
 -	@ $(TOUCH) $*.bench
 -
 -VCE:
 -	@ nmake TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" tests
 -
 -VSE:	
 -	@ nmake TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" tests
 -
 -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)" XXLIBS="benchlib.o" benchtests
 -
 -VSE-bench:
 -	@ nmake TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" XXLIBS="benchlib.o" benchtests
 -
 -VC-bench:
 -	@ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" XXLIBS="benchlib.o" benchtests
 -
 -VCX-bench:
 -	@ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" XXLIBS="benchlib.o" benchtests
 -
 -.c.exe:
 -	@ $(ECHO) $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS)
 -	@ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS)
 -
 -.c.o:
 -	@ $(ECHO) $(CC) $(EHFLAGS) /c $(CFLAGS) $(INCLUDES) $< /Fo$@
 -	@ $(CC) $(EHFLAGS) $(CFLAGS) /c $(INCLUDES) $< /Fo$@
 -
 -.c.i:
 -	@ $(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $<
 -
 -$(COPYFILES):
 -	@ $(ECHO) Copying $@
 -	@ $(CP) $(BUILD_DIR)\$@ .
 -
 -pthread.dll: $(CPDLL)
 -	@ $(CP) $(CPDLL) pthread.dll
 -	@ $(CP) $(CPLIB) pthread.lib
 -
 -clean:
 -	- $(RM) *.dll
 -	- $(RM) *.lib
 -	- $(RM) pthread.h
 -	- $(RM) semaphore.h
 -	- $(RM) sched.h
 -	- $(RM) *.e
 -	- $(RM) *.i
 -	- $(RM) *.obj
 -	- $(RM) *.pdb
 -	- $(RM) *.o
 -	- $(RM) *.asm
 -	- $(RM) *.exe
 -	- $(RM) *.pass
 -	- $(RM) *.bench
 -	- $(RM) *.log
 -
 -benchtest1.bench:
 -benchtest2.bench:
 -benchtest3.bench:
 -benchtest4.bench:
 -benchtest5.bench:
 -barrier1.pass:
 -barrier2.pass: barrier1.pass
 -barrier3.pass: barrier2.pass
 -barrier4.pass: barrier3.pass
 -barrier5.pass: barrier4.pass
 -cancel1.pass: create1.pass
 -cancel2.pass: cancel1.pass
 -cancel3.pass: context1.pass
 -cancel4.pass: cancel3.pass
 -cancel5.pass: cancel3.pass
 -cancel6a.pass: cancel3.pass
 -cancel6d.pass: cancel3.pass
 -cancel7.pass: kill1.pass
 -cancel8.pass: cancel7.pass
 -cleanup0.pass: cancel5.pass
 -cleanup1.pass: cleanup0.pass
 -cleanup2.pass: cleanup1.pass
 -cleanup3.pass: cleanup2.pass
 -condvar1.pass:
 -condvar1_1.pass: condvar1.pass
 -condvar1_2.pass: join2.pass
 -condvar2.pass: condvar1.pass
 -condvar2_1.pass: condvar2.pass join2.pass
 -condvar3.pass: create1.pass condvar2.pass
 -condvar3_1.pass: condvar3.pass join2.pass
 -condvar3_2.pass: condvar3_1.pass
 -condvar3_3.pass: condvar3_2.pass
 -condvar4.pass: create1.pass
 -condvar5.pass: condvar4.pass
 -condvar6.pass: condvar5.pass
 -condvar7.pass: condvar6.pass cleanup1.pass
 -condvar8.pass: condvar7.pass
 -condvar9.pass: condvar8.pass
 -context1.pass: cancel2.pass
 -count1.pass: join1.pass
 -create1.pass: mutex2.pass
 -create2.pass: create1.pass
 -create3.pass:
 -delay1.pass:
 -delay2.pass: delay1.pass
 -equal1.pass: create1.pass
 -errno1.pass: mutex3.pass
 -exception1.pass: cancel4.pass
 -exception2.pass: exception1.pass
 -exception3.pass: exception2.pass
 -exit1.pass:
 -exit2.pass: create1.pass
 -exit3.pass: create1.pass
 -exit4.pass:
 -exit5.pass: kill1.pass
 -eyal1.pass: tsd1.pass
 -inherit1.pass: join1.pass priority1.pass
 -join0.pass: create1.pass
 -join1.pass: create1.pass
 -join2.pass: create1.pass
 -join3.pass: join2.pass
 -kill1.pass: 
 -loadfree.pass: pthread.dll
 -mutex1.pass: self1.pass
 -mutex1n.pass: mutex1.pass
 -mutex1e.pass: mutex1.pass
 -mutex1r.pass: mutex1.pass
 -mutex2.pass: mutex1.pass
 -mutex2r.pass: mutex2.pass
 -mutex2e.pass: mutex2.pass
 -mutex3.pass: create1.pass
 -mutex3r.pass: mutex3.pass
 -mutex3e.pass: mutex3.pass
 -mutex4.pass: mutex3.pass
 -mutex5.pass:
 -mutex6.pass: mutex4.pass
 -mutex6n.pass: mutex4.pass
 -mutex6e.pass: mutex4.pass
 -mutex6r.pass: mutex4.pass
 -mutex6s.pass: mutex6.pass
 -mutex6rs.pass: mutex6r.pass
 -mutex6es.pass: mutex6e.pass
 -mutex7.pass: mutex6.pass
 -mutex7n.pass: mutex6n.pass
 -mutex7e.pass: mutex6e.pass
 -mutex7r.pass: mutex6r.pass
 -mutex8.pass: mutex7.pass
 -mutex8n.pass: mutex7n.pass
 -mutex8e.pass: mutex7e.pass
 -mutex8r.pass: mutex7r.pass
 -once1.pass: create1.pass
 -priority1.pass: join1.pass
 -priority2.pass: priority1.pass barrier3.pass
 -reuse1.pass: create2.pass
 -reuse2.pass: reuse1.pass
 -rwlock1.pass: condvar6.pass
 -rwlock2.pass: rwlock1.pass
 -rwlock3.pass: rwlock2.pass
 -rwlock4.pass: rwlock3.pass
 -rwlock5.pass: rwlock4.pass
 -rwlock6.pass: rwlock5.pass
 -rwlock7.pass: rwlock6.pass
 -rwlock8.pass: rwlock7.pass
 -rwlock2_t.pass: rwlock2.pass
 -rwlock3_t.pass: rwlock2_t.pass
 -rwlock4_t.pass: rwlock3_t.pass
 -rwlock5_t.pass: rwlock4_t.pass
 -rwlock6_t.pass: rwlock5_t.pass
 -rwlock6_t2.pass: rwlock6_t.pass
 -self1.pass:
 -self2.pass: create1.pass
 -semaphore1.pass:
 -semaphore2.pass:
 -sizes.pass:
 -spin1.pass:
 -spin2.pass: spin1.pass
 -spin3.pass: spin2.pass
 -spin4.pass: spin3.pass
 -tsd1.pass: join1.pass
 -valid1.pass: join1.pass
 -valid2.pass: valid1.pass
 -cancel9.pass: cancel8.pass
 +	  mutex2.pass  mutex3.pass  \ +	  mutex2r.pass  mutex2e.pass  mutex3r.pass  mutex3e.pass  \ +	  condvar1.pass  condvar1_1.pass  condvar1_2.pass  condvar2.pass  condvar2_1.pass  \ +	  exit1.pass  create1.pass  create2.pass  reuse1.pass  reuse2.pass  equal1.pass  \ +	  kill1.pass  valid1.pass  valid2.pass  \ +	  exit2.pass  exit3.pass  exit4  exit5  \ +	  join0.pass  join1.pass  join2.pass join3.pass  \ +	  mutex4.pass  mutex6.pass  mutex6n.pass  mutex6e.pass  mutex6r.pass  \ +	  mutex6s.pass  mutex6es.pass  mutex6rs.pass  \ +	  mutex7.pass  mutex7n.pass  mutex7e.pass  mutex7r.pass  \ +	  mutex8.pass  mutex8n.pass  mutex8e.pass  mutex8r.pass  \ +	  count1.pass  once1.pass  tsd1.pass  \ +	  self2.pass  \ +	  cancel1.pass  cancel2.pass  \ +	  semaphore4.pass  semaphore4t.pass  \ +	  delay1.pass  delay2.pass  eyal1.pass  \ +	  condvar3.pass  condvar3_1.pass  condvar3_2.pass  condvar3_3.pass  \ +	  condvar4.pass  condvar5.pass  condvar6.pass  \ +	  condvar7.pass  condvar8.pass  condvar9.pass  \ +	  errno1.pass  \ +	  rwlock1.pass  rwlock2.pass  rwlock3.pass  rwlock4.pass  \ +	  rwlock5.pass  rwlock6.pass  rwlock7.pass  rwlock8.pass  \ +	  rwlock2_t.pass  rwlock3_t.pass  rwlock4_t.pass  rwlock5_t.pass  rwlock6_t.pass  rwlock6_t2.pass  \ +	  context1.pass  \ +	  cancel3.pass  cancel4.pass  cancel5.pass  cancel6a.pass  cancel6d.pass  \ +	  cancel7  cancel8  \ +	  cleanup0.pass  cleanup1.pass  cleanup2.pass  cleanup3.pass  \ +	  priority1.pass priority2.pass inherit1.pass  \ +	  spin1.pass  spin2.pass  spin3.pass  spin4.pass  \ +	  barrier1.pass  barrier2.pass  barrier3.pass  barrier4.pass  barrier5.pass  \ +	  exception1.pass  exception2.pass  exception3.pass  \ +	  cancel9 create3 + +BENCHRESULTS = \ +	  benchtest1.bench benchtest2.bench benchtest3.bench benchtest4.bench benchtest5.bench + +help: +	@ $(ECHO) Run one of the following command lines: +	@ $(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   (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-bench    (to benchtest using VC dll with C bench app) +	@ $(ECHO) nmake clean VCX-bench   (to benchtest using VC dll with C++ bench app) +	@ $(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) + +all: +	@ nmake clean VC +	@ nmake clean VCX +	@ nmake clean VCE +	@ nmake clean VSE +	@ nmake clean VC-bench + +# This allows an individual test application to be made using the default lib. +# e.g. nmake clean test cancel3.exe +test: $(CPLIB) $(CPDLL) $(CPHDR) $(QAPC) + +tests: $(CPLIB) $(CPDLL) $(CPHDR) $(QAPC) $(PASSES) +	@ $(ECHO) ALL TESTS PASSED! Congratulations! + +benchtests: $(CPLIB) $(CPDLL) $(CPHDR) $(XXLIBS) $(BENCHRESULTS) +	@ $(ECHO) ALL BENCH TESTS DONE. + +sizes.pass: sizes.exe +	@ $(ECHO) ... Running $(TEST) test: $*.exe +	@ .\$*.exe > SIZES.$(TEST) +	@ $(CAT) SIZES.$(TEST) +	@ $(ECHO) ...... Passed +	@ $(TOUCH) $*.pass + +$(PASSES): $*.exe +	@ $(ECHO) ... Running $(TEST) test: $*.exe +	@ .\$*.exe +	@ $(ECHO) ...... Passed +	@ $(TOUCH) $*.pass + +$(BENCHRESULTS): $*.exe +	@ $(ECHO) ... Running $(TEST) benchtest: $*.exe +	@ .\$*.exe +	@ $(ECHO) ...... Done +	@ $(TOUCH) $*.bench + +VCE: +	@ nmake TEST="$@" CPLIB="$(VCELIB)" CPDLL="$(VCEDLL)" EHFLAGS="$(VCEFLAGS)" tests + +VSE:	 +	@ nmake TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" tests + +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)" XXLIBS="benchlib.o" benchtests + +VSE-bench: +	@ nmake TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" XXLIBS="benchlib.o" benchtests + +VC-bench: +	@ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" XXLIBS="benchlib.o" benchtests + +VCX-bench: +	@ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCXFLAGS)" XXLIBS="benchlib.o" benchtests + +.c.exe: +	@ $(ECHO) $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS) +	@ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB) $(XXLIBS) + +.c.o: +	@ $(ECHO) $(CC) $(EHFLAGS) /c $(CFLAGS) $(INCLUDES) $< /Fo$@ +	@ $(CC) $(EHFLAGS) $(CFLAGS) /c $(INCLUDES) $< /Fo$@ + +.c.i: +	@ $(CC) /P $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< + +$(COPYFILES): +	@ $(ECHO) Copying $@ +	@ $(CP) $(BUILD_DIR)\$@ . + +pthread.dll: $(CPDLL) +	@ $(CP) $(CPDLL) pthread.dll +	@ $(CP) $(CPLIB) pthread.lib + +clean: +	- $(RM) *.dll +	- $(RM) *.lib +	- $(RM) pthread.h +	- $(RM) semaphore.h +	- $(RM) sched.h +	- $(RM) *.e +	- $(RM) *.i +	- $(RM) *.obj +	- $(RM) *.pdb +	- $(RM) *.o +	- $(RM) *.asm +	- $(RM) *.exe +	- $(RM) *.pass +	- $(RM) *.bench +	- $(RM) *.log + +benchtest1.bench: +benchtest2.bench: +benchtest3.bench: +benchtest4.bench: +benchtest5.bench: +barrier1.pass: +barrier2.pass: barrier1.pass +barrier3.pass: barrier2.pass +barrier4.pass: barrier3.pass +barrier5.pass: barrier4.pass +cancel1.pass: create1.pass +cancel2.pass: cancel1.pass +cancel3.pass: context1.pass +cancel4.pass: cancel3.pass +cancel5.pass: cancel3.pass +cancel6a.pass: cancel3.pass +cancel6d.pass: cancel3.pass +cancel7.pass: kill1.pass +cancel8.pass: cancel7.pass +cleanup0.pass: cancel5.pass +cleanup1.pass: cleanup0.pass +cleanup2.pass: cleanup1.pass +cleanup3.pass: cleanup2.pass +condvar1.pass: +condvar1_1.pass: condvar1.pass +condvar1_2.pass: join2.pass +condvar2.pass: condvar1.pass +condvar2_1.pass: condvar2.pass join2.pass +condvar3.pass: create1.pass condvar2.pass +condvar3_1.pass: condvar3.pass join2.pass +condvar3_2.pass: condvar3_1.pass +condvar3_3.pass: condvar3_2.pass +condvar4.pass: create1.pass +condvar5.pass: condvar4.pass +condvar6.pass: condvar5.pass +condvar7.pass: condvar6.pass cleanup1.pass +condvar8.pass: condvar7.pass +condvar9.pass: condvar8.pass +context1.pass: cancel2.pass +count1.pass: join1.pass +create1.pass: mutex2.pass +create2.pass: create1.pass +create3.pass: +delay1.pass: +delay2.pass: delay1.pass +equal1.pass: create1.pass +errno1.pass: mutex3.pass +exception1.pass: cancel4.pass +exception2.pass: exception1.pass +exception3.pass: exception2.pass +exit1.pass: +exit2.pass: create1.pass +exit3.pass: create1.pass +exit4.pass: +exit5.pass: kill1.pass +eyal1.pass: tsd1.pass +inherit1.pass: join1.pass priority1.pass +join0.pass: create1.pass +join1.pass: create1.pass +join2.pass: create1.pass +join3.pass: join2.pass +kill1.pass:  +loadfree.pass: pthread.dll +mutex1.pass: self1.pass +mutex1n.pass: mutex1.pass +mutex1e.pass: mutex1.pass +mutex1r.pass: mutex1.pass +mutex2.pass: mutex1.pass +mutex2r.pass: mutex2.pass +mutex2e.pass: mutex2.pass +mutex3.pass: create1.pass +mutex3r.pass: mutex3.pass +mutex3e.pass: mutex3.pass +mutex4.pass: mutex3.pass +mutex5.pass: +mutex6.pass: mutex4.pass +mutex6n.pass: mutex4.pass +mutex6e.pass: mutex4.pass +mutex6r.pass: mutex4.pass +mutex6s.pass: mutex6.pass +mutex6rs.pass: mutex6r.pass +mutex6es.pass: mutex6e.pass +mutex7.pass: mutex6.pass +mutex7n.pass: mutex6n.pass +mutex7e.pass: mutex6e.pass +mutex7r.pass: mutex6r.pass +mutex8.pass: mutex7.pass +mutex8n.pass: mutex7n.pass +mutex8e.pass: mutex7e.pass +mutex8r.pass: mutex7r.pass +once1.pass: create1.pass +priority1.pass: join1.pass +priority2.pass: priority1.pass barrier3.pass +reuse1.pass: create2.pass +reuse2.pass: reuse1.pass +rwlock1.pass: condvar6.pass +rwlock2.pass: rwlock1.pass +rwlock3.pass: rwlock2.pass +rwlock4.pass: rwlock3.pass +rwlock5.pass: rwlock4.pass +rwlock6.pass: rwlock5.pass +rwlock7.pass: rwlock6.pass +rwlock8.pass: rwlock7.pass +rwlock2_t.pass: rwlock2.pass +rwlock3_t.pass: rwlock2_t.pass +rwlock4_t.pass: rwlock3_t.pass +rwlock5_t.pass: rwlock4_t.pass +rwlock6_t.pass: rwlock5_t.pass +rwlock6_t2.pass: rwlock6_t.pass +self1.pass: +self2.pass: create1.pass +semaphore1.pass: +semaphore2.pass: +semaphore3.pass: semaphore2.pass +semaphore4.pass: semaphore3.pass cancel1.pass +semaphore4t.pass: semaphore4.pass +sizes.pass: +spin1.pass: +spin2.pass: spin1.pass +spin3.pass: spin2.pass +spin4.pass: spin3.pass +tsd1.pass: join1.pass +valid1.pass: join1.pass +valid2.pass: valid1.pass +cancel9.pass: cancel8.pass diff --git a/tests/README b/tests/README index b767f89..784c4f7 100644 --- a/tests/README +++ b/tests/README @@ -5,19 +5,19 @@ These make scripts expect to be able to copy the dll, libarary  and header files from this directory's parent directory,  which should be the pthreads-win32 source directory. -MS VC++ nmake +MS VC nmake  -------------  Run the target corresponding to the DLL version being tested: -nmake clean VCE +nmake clean VC  or: -nmake clean VSE +nmake clean VS -GNU G++ make +GNU GCC make  ------------  Run "make clean" and then "make". See the "Known bugs" section @@ -36,3 +36,9 @@ Tests written in this test suite should behave in the following manner:  	* No diagnostic output should appear when the test is succeeding.  	  Diagnostic output may be emitted if something in the test  	  fails, to help determine the cause of the test failure. + +Notes: +------ + +Many test cases use knowledge of implementation internals which are supposed +to be opaque to portable applications. diff --git a/tests/README.benchtests b/tests/README.benchtests index 01051a2..e02cb3e 100644 --- a/tests/README.benchtests +++ b/tests/README.benchtests @@ -1,97 +1,97 @@ -
 -------------
 -Benchmarking
 -------------
 -There is a new but growing set a benchmarking programs in the
 -"tests" directory. These should be runnable using the
 -following command-lines corresponding to each of the possible
 -library builds:
 -
 -MSVC:
 -nmake clean VC-bench
 -nmake clean VCE-bench
 -nmake clean VSE-bench
 -
 -Mingw32:
 -make clean GC-bench
 -make clean GCE-bench
 -
 -UWIN:
 -The benchtests are run as part of the testsuite.
 -
 -
 -Mutex benchtests
 -----------------
 -
 -benchtest1 - Lock plus unlock on an unlocked mutex.
 -benchtest2 - Lock plus unlock on a locked mutex.
 -benchtest3 - Trylock on a locked mutex.
 -benchtest4 - Trylock plus unlock on an unlocked mutex.
 -
 -
 -Each test times up to three alternate synchronisation
 -implementations as a reference, and then times each of
 -the four mutex types provided by the library. Each is
 -described below:
 -
 -Simple Critical Section
 -- uses a simple Win32 critical section. There is no
 -additional overhead for this case as there is in the
 -remaining cases.
 -
 -POSIX mutex implemented using a Critical Section
 -- The old implementation which uses runtime adaptation
 -depending on the Windows variant being run on. When
 -the pthreads DLL was run on WinNT or higher then
 -POSIX mutexes would use Win32 Critical Sections.
 -
 -POSIX mutex implemented using a Win32 Mutex
 -- The old implementation which uses runtime adaptation
 -depending on the Windows variant being run on. When
 -the pthreads DLL was run on Win9x then POSIX mutexes
 -would use Win32 Mutexes (because TryEnterCriticalSection
 -is not implemented on Win9x).
 -
 -PTHREAD_MUTEX_DEFAULT
 -PTHREAD_MUTEX_NORMAL
 -PTHREAD_MUTEX_ERRORCHECK
 -PTHREAD_MUTEX_RECURSIVE
 -- The current implementation supports these mutex types.
 -The underlying basis of POSIX mutexes is now the same
 -irrespective of the Windows variant, and should therefore
 -have consistent performance.
 -
 -
 -In all benchtests, the operation is repeated a large
 -number of times and an average is calculated. Loop
 -overhead is measured and subtracted from all test times.
 -
 -Comment on the results
 -----------------------
 -The gain in performance for Win9x systems is enormous - up to
 -40 times faster for unlocked mutexes (2 times faster for locked
 -mutexes).
 -
 -Pthread_mutex_trylock also appears to be faster for locked mutexes.
 -
 -The price for the new consistency between WinNT and Win9x is
 -slower performance (up to twice as long) across a lock/unlock
 -sequence. It is difficult to get a good split timing for lock
 -and unlock operations, but by code inspection, it is the unlock
 -operation that is slowing the pair down in comparison with the
 -old-style CS mutexes, even for the fast PTHREAD_MUTEX_NORMAL mutex
 -type with no other waiting threads. However, comparitive
 -performance for operations on already locked mutexes is very close.
 -
 -When this is translated to real-world applications, the overall
 -camparitive performance should be almost identical on NT class
 -systems. That is, applications with heavy mutex contention should
 -have almost equal performance, while applications with only light
 -mutex contention should also have almost equal performance because
 -the most critical operation in this case is the lock operation.
 -
 -Overall, the newer pthreads-win32 mutex routines are only slower
 -(on NT class systems) where and when it is least critical.
 -
 -Thanks go to Thomas Pfaff for the current implementation of mutex
 -routines.
 + +------------ +Benchmarking +------------ +There is a new but growing set a benchmarking programs in the +"tests" directory. These should be runnable using the +following command-lines corresponding to each of the possible +library builds: + +MSVC: +nmake clean VC-bench +nmake clean VCE-bench +nmake clean VSE-bench + +Mingw32: +make clean GC-bench +make clean GCE-bench + +UWIN: +The benchtests are run as part of the testsuite. + + +Mutex benchtests +---------------- + +benchtest1 - Lock plus unlock on an unlocked mutex. +benchtest2 - Lock plus unlock on a locked mutex. +benchtest3 - Trylock on a locked mutex. +benchtest4 - Trylock plus unlock on an unlocked mutex. + + +Each test times up to three alternate synchronisation +implementations as a reference, and then times each of +the four mutex types provided by the library. Each is +described below: + +Simple Critical Section +- uses a simple Win32 critical section. There is no +additional overhead for this case as there is in the +remaining cases. + +POSIX mutex implemented using a Critical Section +- The old implementation which uses runtime adaptation +depending on the Windows variant being run on. When +the pthreads DLL was run on WinNT or higher then +POSIX mutexes would use Win32 Critical Sections. + +POSIX mutex implemented using a Win32 Mutex +- The old implementation which uses runtime adaptation +depending on the Windows variant being run on. When +the pthreads DLL was run on Win9x then POSIX mutexes +would use Win32 Mutexes (because TryEnterCriticalSection +is not implemented on Win9x). + +PTHREAD_MUTEX_DEFAULT +PTHREAD_MUTEX_NORMAL +PTHREAD_MUTEX_ERRORCHECK +PTHREAD_MUTEX_RECURSIVE +- The current implementation supports these mutex types. +The underlying basis of POSIX mutexes is now the same +irrespective of the Windows variant, and should therefore +have consistent performance. + + +In all benchtests, the operation is repeated a large +number of times and an average is calculated. Loop +overhead is measured and subtracted from all test times. + +Comment on the results +---------------------- +The gain in performance for Win9x systems is enormous - up to +40 times faster for unlocked mutexes (2 times faster for locked +mutexes). + +Pthread_mutex_trylock also appears to be faster for locked mutexes. + +The price for the new consistency between WinNT and Win9x is +slower performance (up to twice as long) across a lock/unlock +sequence. It is difficult to get a good split timing for lock +and unlock operations, but by code inspection, it is the unlock +operation that is slowing the pair down in comparison with the +old-style CS mutexes, even for the fast PTHREAD_MUTEX_NORMAL mutex +type with no other waiting threads. However, comparitive +performance for operations on already locked mutexes is very close. + +When this is translated to real-world applications, the overall +camparitive performance should be almost identical on NT class +systems. That is, applications with heavy mutex contention should +have almost equal performance, while applications with only light +mutex contention should also have almost equal performance because +the most critical operation in this case is the lock operation. + +Overall, the newer pthreads-win32 mutex routines are only slower +(on NT class systems) where and when it is least critical. + +Thanks go to Thomas Pfaff for the current implementation of mutex +routines. diff --git a/tests/cancel1.c b/tests/cancel1.c index 390db9f..55409d6 100644 --- a/tests/cancel1.c +++ b/tests/cancel1.c @@ -129,7 +129,7 @@ main()    int i;    pthread_t t[NUMTHREADS + 1]; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    for (i = 1; i <= NUMTHREADS; i++)      { diff --git a/tests/cancel2.c b/tests/cancel2.c index d317ef9..dbc8c85 100644 --- a/tests/cancel2.c +++ b/tests/cancel2.c @@ -167,7 +167,7 @@ main()    int i;    pthread_t t[NUMTHREADS + 1]; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    assert(pthread_mutex_lock(&waitLock) == 0);    for (i = 1; i <= NUMTHREADS; i++) diff --git a/tests/cancel3.c b/tests/cancel3.c index c3657d6..3258fd0 100644 --- a/tests/cancel3.c +++ b/tests/cancel3.c @@ -126,7 +126,7 @@ main ()    int i;    pthread_t t[NUMTHREADS + 1]; -  assert ((t[0] = pthread_self ()) != NULL); +  assert ((t[0] = pthread_self ()).p != NULL);    for (i = 1; i <= NUMTHREADS; i++)      { diff --git a/tests/cancel4.c b/tests/cancel4.c index b77f921..5b1b7e7 100644 --- a/tests/cancel4.c +++ b/tests/cancel4.c @@ -128,7 +128,7 @@ main()    int i;    pthread_t t[NUMTHREADS + 1]; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    for (i = 1; i <= NUMTHREADS; i++)      { diff --git a/tests/cancel6a.c b/tests/cancel6a.c index 4aea81a..644cd4a 100644 --- a/tests/cancel6a.c +++ b/tests/cancel6a.c @@ -115,7 +115,7 @@ main()    int i;    pthread_t t[NUMTHREADS + 1]; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    for (i = 1; i <= NUMTHREADS; i++)      { diff --git a/tests/cancel6d.c b/tests/cancel6d.c index 9a69adb..d0ad7ac 100644 --- a/tests/cancel6d.c +++ b/tests/cancel6d.c @@ -119,7 +119,7 @@ main()    int i;    pthread_t t[NUMTHREADS + 1]; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    for (i = 1; i <= NUMTHREADS; i++)      { @@ -167,11 +167,6 @@ main()        int fail = 0;        int result = 0; -      /* -       * The thread does not contain any cancelation points, so -       * a return value of PTHREAD_CANCELED confirms that async -       * cancelation succeeded. -       */        assert(pthread_join(t[i], (void **) &result) == 0);        fail = (result != (int) PTHREAD_CANCELED); diff --git a/tests/cancel7.c b/tests/cancel7.c index 9ad7db0..0609710 100644 --- a/tests/cancel7.c +++ b/tests/cancel7.c @@ -109,7 +109,7 @@ Win32thread(void * arg)    assert(bag->started == 0);    bag->started = 1; -  assert((bag->self = pthread_self()) != NULL); +  assert((bag->self = pthread_self()).p != NULL);    assert(pthread_kill(bag->self, 0) == 0);    for (i = 0; i < 100; i++) @@ -191,7 +191,7 @@ main()        result = (int) PTHREAD_CANCELED;  #endif -      assert(threadbag[i].self != NULL); +      assert(threadbag[i].self.p != NULL);        assert(pthread_kill(threadbag[i].self, 0) == ESRCH);        fail = (result != (int) PTHREAD_CANCELED); diff --git a/tests/cancel8.c b/tests/cancel8.c index 484472e..1a99640 100644 --- a/tests/cancel8.c +++ b/tests/cancel8.c @@ -111,7 +111,7 @@ Win32thread(void * arg)    assert(bag->started == 0);    bag->started = 1; -  assert((bag->self = pthread_self()) != NULL); +  assert((bag->self = pthread_self()).p != NULL);    assert(pthread_kill(bag->self, 0) == 0);    assert(pthread_mutex_lock(&CVLock) == 0); @@ -192,7 +192,7 @@ main()        result = (int) PTHREAD_CANCELED;  #endif -      assert(threadbag[i].self != NULL); +      assert(threadbag[i].self.p != NULL);        assert(pthread_kill(threadbag[i].self, 0) == ESRCH);        fail = (result != (int) PTHREAD_CANCELED); diff --git a/tests/cleanup0.c b/tests/cleanup0.c index 03098d3..8171e8c 100644 --- a/tests/cleanup0.c +++ b/tests/cleanup0.c @@ -140,7 +140,7 @@ main()    int i;    pthread_t t[NUMTHREADS + 1]; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    for (i = 1; i <= NUMTHREADS; i++)      { diff --git a/tests/cleanup1.c b/tests/cleanup1.c index 5397297..18518da 100644 --- a/tests/cleanup1.c +++ b/tests/cleanup1.c @@ -98,7 +98,6 @@ static void  #ifdef __CLEANUP_C  __cdecl  #endif -  increment_pop_count(void * arg)  {    int * c = (int *) arg; @@ -150,7 +149,7 @@ main()    int i;    pthread_t t[NUMTHREADS + 1]; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    for (i = 1; i <= NUMTHREADS; i++)      { diff --git a/tests/cleanup2.c b/tests/cleanup2.c index 2549b0c..3f0f445 100644 --- a/tests/cleanup2.c +++ b/tests/cleanup2.c @@ -134,7 +134,7 @@ main()    int i;    pthread_t t[NUMTHREADS + 1]; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    for (i = 1; i <= NUMTHREADS; i++)      { diff --git a/tests/cleanup3.c b/tests/cleanup3.c index dd43ccc..9c29be7 100644 --- a/tests/cleanup3.c +++ b/tests/cleanup3.c @@ -137,7 +137,7 @@ main()    int i;    pthread_t t[NUMTHREADS + 1]; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    for (i = 1; i <= NUMTHREADS; i++)      { diff --git a/tests/condvar1_2.c b/tests/condvar1_2.c index 07b3816..884832a 100644 --- a/tests/condvar1_2.c +++ b/tests/condvar1_2.c @@ -79,8 +79,8 @@  #include "test.h"  enum { -  NUM_CV = 100, -  NUM_LOOPS = 100 +  NUM_CV = 5, +  NUM_LOOPS = 5  };  static pthread_cond_t cv[NUM_CV]; diff --git a/tests/condvar3.c b/tests/condvar3.c index 8fa9ef7..7a30531 100644 --- a/tests/condvar3.c +++ b/tests/condvar3.c @@ -120,7 +120,7 @@ main()    assert(pthread_attr_init(&attr) == 0);    assert(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0); -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    assert(pthread_cond_init(&cv, NULL) == 0); diff --git a/tests/condvar4.c b/tests/condvar4.c index 15a32ba..2da6708 100644 --- a/tests/condvar4.c +++ b/tests/condvar4.c @@ -119,7 +119,7 @@ main()    cvthing.shared = 0; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); diff --git a/tests/condvar5.c b/tests/condvar5.c index ff5ad70..3b016b9 100644 --- a/tests/condvar5.c +++ b/tests/condvar5.c @@ -118,7 +118,7 @@ main()    cvthing.shared = 0; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); diff --git a/tests/condvar6.c b/tests/condvar6.c index d642f9c..0cf92a4 100644 --- a/tests/condvar6.c +++ b/tests/condvar6.c @@ -149,7 +149,7 @@ main()    cvthing.shared = 0; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); @@ -164,7 +164,7 @@ main()    abstime.tv_sec += 5; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    awoken = 0; diff --git a/tests/condvar7.c b/tests/condvar7.c index a5bf4bf..9e0b29c 100644 --- a/tests/condvar7.c +++ b/tests/condvar7.c @@ -159,7 +159,7 @@ main()    cvthing.shared = 0; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); @@ -174,7 +174,7 @@ main()    abstime.tv_sec += 10; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    awoken = 0; @@ -196,15 +196,15 @@ main()     */    Sleep(1000); -  assert(pthread_mutex_lock(&cvthing.lock) == 0); - -  cvthing.shared++; -    /*     * Cancel one of the threads.     */ -  assert(pthread_cancel(t[3]) == 0); -  Sleep(500); +  assert(pthread_cancel(t[1]) == 0); +  assert(pthread_join(t[1], NULL) == 0); + +  assert(pthread_mutex_lock(&cvthing.lock) == 0); + +  cvthing.shared++;    /*     * Signal all remaining waiting threads. @@ -214,9 +214,10 @@ main()    assert(pthread_mutex_unlock(&cvthing.lock) == 0);    /* -   * Give threads time to complete. +   * Wait for all threads to complete.     */ -  Sleep(2000); +  for (i = 2; i <= NUMTHREADS; i++) +    assert(pthread_join(t[i], NULL) == 0);    /*      * Cleanup the CV. diff --git a/tests/condvar8.c b/tests/condvar8.c index 2ab67b3..572a5ac 100644 --- a/tests/condvar8.c +++ b/tests/condvar8.c @@ -158,7 +158,7 @@ main()    struct _timeb currSysTime;    const DWORD NANOSEC_PER_MILLISEC = 1000000; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); @@ -171,7 +171,7 @@ main()    abstime.tv_sec += 10; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    awoken = 0; diff --git a/tests/condvar9.c b/tests/condvar9.c index b24d71e..7eb9035 100644 --- a/tests/condvar9.c +++ b/tests/condvar9.c @@ -86,6 +86,7 @@ typedef struct bag_t_ bag_t;  struct bag_t_ {    int threadnum;    int started; +  int finished;    /* Add more per-thread state variables here */  }; @@ -127,8 +128,8 @@ mythread(void * arg)    assert(pthread_mutex_lock(&cvthing.lock) == 0);    /* -   * pthread_cond_timedwait is a cancelation point and we -   * going to cancel one deliberately. +   * pthread_cond_timedwait is a cancelation point and we're +   * going to cancel some threads deliberately.     */  #ifdef _MSC_VER  #pragma inline_depth(0) @@ -146,6 +147,7 @@ mythread(void * arg)    assert(cvthing.shared > 0);    awoken++; +  bag->finished = 1;    assert(pthread_mutex_unlock(&cvthing.lock) == 0); @@ -164,7 +166,7 @@ main()    struct _timeb currSysTime;    const DWORD NANOSEC_PER_MILLISEC = 1000000; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    assert(cvthing.notbusy == PTHREAD_COND_INITIALIZER); @@ -177,7 +179,7 @@ main()    abstime.tv_sec += 5; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    awoken = 0; @@ -185,14 +187,15 @@ main()         first < NUMTHREADS;         first = last + 1, last = NUMTHREADS)      { +      int ct; +        assert(pthread_mutex_lock(&start_flag) == 0);        for (i = first; i <= last; i++)  	{ -	  threadbag[i].started = 0; +	  threadbag[i].started = threadbag[i].finished = 0;  	  threadbag[i].threadnum = i;  	  assert(pthread_create(&t[i], NULL, mythread, (void *) &threadbag[i]) == 0); -	  assert(pthread_detach(t[i]) == 0);  	}        /* @@ -207,46 +210,47 @@ main()         */        Sleep(1000); +      ct = (first + last) / 2; +      assert(pthread_cancel(t[ct]) == 0); +      canceledThreads++; +      assert(pthread_join(t[ct], NULL) == 0); +        assert(pthread_mutex_lock(&cvthing.lock) == 0);        cvthing.shared++; -      assert(pthread_cancel(t[(first + last) / 2]) == 0); -      canceledThreads++; -        assert(pthread_cond_broadcast(&cvthing.notbusy) == 0);        assert(pthread_mutex_unlock(&cvthing.lock) == 0);        /* -       * Give threads time to complete. +       * Standard check that all threads started - and wait for them to finish.         */ -      Sleep(1000); -    } - - -  /* -   * Standard check that all threads started. -   */ -  for (i = 1; i <= NUMTHREADS; i++) -    {  -      failed = !threadbag[i].started; - -      if (failed) -	{ -	  fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); +      for (i = first; i <= last; i++) +	{  +	  failed = !threadbag[i].started; + +          if (failed) +	    { +	      fprintf(stderr, "Thread %d: started %d\n", i, threadbag[i].started); +	    } +	  else +	    { +	      assert(pthread_join(t[i], NULL) == 0 || threadbag[i].finished == 0); +//	      fprintf(stderr, "Thread %d: finished %d\n", i, threadbag[i].finished); +	    }  	}      }    /*      * Cleanup the CV.     */ -   +    assert(pthread_mutex_destroy(&cvthing.lock) == 0);    assert(cvthing.lock == NULL); -  assert(pthread_cond_destroy(&cvthing.notbusy) == 0); +  assert_e(pthread_cond_destroy(&cvthing.notbusy), ==, 0);    assert(cvthing.notbusy == NULL); diff --git a/tests/context1.c b/tests/context1.c index 405f9da..fe36695 100644 --- a/tests/context1.c +++ b/tests/context1.c @@ -106,7 +106,7 @@ main()    assert(pthread_create(&t, NULL, func, NULL) == 0); -  hThread = t->threadH; +  hThread = ((ptw32_thread_t *)t.p)->threadH;    Sleep(500); diff --git a/tests/errno1.c b/tests/errno1.c index f3231f5..9e6b46d 100644 --- a/tests/errno1.c +++ b/tests/errno1.c @@ -125,7 +125,7 @@ main()    pthread_mutex_lock(&stop_here);    errno = 0; -  assert((t[0] = pthread_self()) != NULL); +  assert((t[0] = pthread_self()).p != NULL);    for (i = 1; i <= NUMTHREADS; i++)      { diff --git a/tests/exception1.c b/tests/exception1.c index 9b52636..0e63806 100644 --- a/tests/exception1.c +++ b/tests/exception1.c @@ -196,7 +196,7 @@ main()    pthread_t et[NUMTHREADS];    pthread_t ct[NUMTHREADS]; -  assert((mt = pthread_self()) != NULL); +  assert((mt = pthread_self()).p != NULL);    for (i = 0; i < NUMTHREADS; i++)      { diff --git a/tests/exception2.c b/tests/exception2.c index ed54a57..da835b5 100644 --- a/tests/exception2.c +++ b/tests/exception2.c @@ -129,7 +129,7 @@ main(int argc, char argv[])        exit(0);      } -  assert((mt = pthread_self()) != NULL); +  assert((mt = pthread_self()).p != NULL);    for (i = 0; i < NUMTHREADS; i++)      { diff --git a/tests/exception3.c b/tests/exception3.c index af47705..428cf5b 100644 --- a/tests/exception3.c +++ b/tests/exception3.c @@ -158,7 +158,7 @@ main()    pthread_t et[NUMTHREADS];    pthread_mutexattr_t ma; -  assert((mt = pthread_self()) != NULL); +  assert((mt = pthread_self()).p != NULL);    printf("See the notes inside of exception3.c re term_funcs.\n"); diff --git a/tests/exit5.c b/tests/exit5.c index e896bf4..4812cac 100644 --- a/tests/exit5.c +++ b/tests/exit5.c @@ -109,7 +109,7 @@ Win32thread(void * arg)    assert(bag->started == 0);    bag->started = 1; -  assert((bag->self = pthread_self()) != NULL); +  assert((bag->self = pthread_self()).p != NULL);    assert(pthread_kill(bag->self, 0) == 0);    /* @@ -181,7 +181,7 @@ main()        result = 1;  #endif -      assert(threadbag[i].self != NULL && pthread_kill(threadbag[i].self, 0) == ESRCH); +      assert(threadbag[i].self.p != NULL && pthread_kill(threadbag[i].self, 0) == ESRCH);        fail = (result != 1); diff --git a/tests/reuse1.c b/tests/reuse1.c index 2b74955..8e8ca54 100644 --- a/tests/reuse1.c +++ b/tests/reuse1.c @@ -82,7 +82,7 @@ static int washere = 0;  void * func(void * arg)  {    washere = 1; -  return (void *) 0;  +  return arg;   }  int @@ -107,11 +107,16 @@ main()    for (i = 1; i < NUMTHREADS; i++)      {        washere = 0; -      assert(pthread_create(&t, &attr, func, NULL) == 0); +      assert(pthread_create(&t, &attr, func, (void *) i) == 0);        pthread_join(t, &result); -      assert(result == 0); +      assert((int) result == i);        assert(washere == 1); -      assert(t == last_t); +      /* thread IDs should be unique */ +      assert(!pthread_equal(t, last_t)); +      /* thread struct pointers should be the same */ +      assert(t.p == last_t.p); +      /* thread handle reuse counter should be different by one */ +      assert(t.x == last_t.x+1);        last_t = t;      } diff --git a/tests/reuse2.c b/tests/reuse2.c index 625611e..12aaa5f 100644 --- a/tests/reuse2.c +++ b/tests/reuse2.c @@ -53,7 +53,9 @@   * -   *   * Environment: - * - + * - This test is implementation specific + * because it uses knowledge of internals that should be + * opaque to an application.   *   * Input:   * - None. @@ -74,6 +76,9 @@  #include "test.h" +/* + */ +  enum {  	NUMTHREADS = 10000  }; @@ -95,11 +100,11 @@ main()  {    pthread_t t[NUMTHREADS];    pthread_attr_t attr; -  int i, j; -  int reuse, -      reuseMax = 0, -      reuseMin = NUMTHREADS, -      idTotal = 0; +  int i; +  unsigned int notUnique = 0, +	       totalHandles = 0, +	       reuseMax = 0, +	       reuseMin = NUMTHREADS;    assert(pthread_attr_init(&attr) == 0);    assert(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) == 0); @@ -120,43 +125,39 @@ main()     */    for (i = 0; i < NUMTHREADS; i++)      { -      reuse = 0; +      if (t[i].p != NULL) +        { +          unsigned int j, thisMax; -      if (t[i] == NULL) -        continue; +          thisMax = t[i].x; -      for (j = 0; j < i; j++) -        { -          if (t[j] == t[i]) -            { -              reuse++; -              t[j] = NULL; -            } -        } -      for (j = i + 1; j < NUMTHREADS; j++) -        { -          if (t[j] == t[i]) -            { -              reuse++; -              t[j] = NULL; -            } +          for (j = i+1; j < NUMTHREADS; j++) +            if (t[i].p == t[j].p) +              { +		if (t[i].x == t[j].x) +		  notUnique++; +                if (thisMax < t[j].x) +                  thisMax = t[j].x; +                t[j].p = NULL; +              } + +          if (reuseMin > thisMax) +            reuseMin = thisMax; + +          if (reuseMax < thisMax) +            reuseMax = thisMax;          } -      if (reuseMax < reuse) -        reuseMax = reuse; -      if (reuseMin > reuse) -        reuseMin = reuse;      }    for (i = 0; i < NUMTHREADS; i++) -    { -      if (t[i] != NULL) -        idTotal++; -    } +    if (t[i].p != NULL) +      totalHandles++;    printf("For %d total threads:\n", NUMTHREADS); -  printf("Reuse maximum = %d\n", reuseMax); -  printf("Reuse minimum = %d\n", reuseMin); -  printf("Total thread IDs allocated = %d\n", idTotal); +  printf("Non-unique IDs = %d\n", notUnique); +  printf("Reuse maximum  = %d\n", reuseMax); +  printf("Reuse minimum  = %d\n", reuseMin); +  printf("Total handles  = %d\n", totalHandles);    return 0;  } diff --git a/tests/self1.c b/tests/self1.c index 5cffac8..347fa79 100644 --- a/tests/self1.c +++ b/tests/self1.c @@ -52,7 +52,11 @@ main(int argc, char * argv[])  	 * This should always succeed unless the system has no  	 * resources (memory) left.  	 */ -	assert(pthread_self() != NULL); +	pthread_t self; + +	self = pthread_self(); + +	assert(self.p != NULL);  	return 0;  } diff --git a/tests/self2.c b/tests/self2.c index f8a68c9..93be0c7 100644 --- a/tests/self2.c +++ b/tests/self2.c @@ -64,14 +64,9 @@ main()    assert(pthread_create(&t, NULL, entry, NULL) == 0); -  Sleep(2000); +  Sleep(100); -  /* -   * Not much more we can do here but bytewise compare t with -   * what pthread_self returned. -   */ -  assert(t == me); -  assert(memcmp((const void *) t, (const void *) me, sizeof t) == 0); +  assert(pthread_equal(t, me) != 0);    /* Success. */    return 0; diff --git a/tests/semaphore3.c b/tests/semaphore3.c index c6570f8..1b19494 100644 --- a/tests/semaphore3.c +++ b/tests/semaphore3.c @@ -80,9 +80,8 @@ sem_t s;  void *  thr (void * arg)  { -  assert(pthread_detach(pthread_self()) == 0);    assert(sem_wait(&s) == 0); - +  assert(pthread_detach(pthread_self()) == 0);    return NULL;  } @@ -91,19 +90,21 @@ main()  {  	int value = 0;  	int i; -	pthread_t t[MAX_COUNT]; +	pthread_t t[MAX_COUNT+1]; -  assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0); +	assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0);  	assert(sem_getvalue(&s, &value) == 0); +//	printf("Value = %d\n", value);	fflush(stdout);  	assert(value == 0); -//	  printf("Value = %ld\n", value);  	for (i = 1; i <= MAX_COUNT; i++)  		{ -			assert(pthread_create(&t[i-1], NULL, thr, NULL) == 0); -			sched_yield(); -			assert(sem_getvalue(&s, &value) == 0); -//			  printf("Value = %ld\n", value); +			assert(pthread_create(&t[i], NULL, thr, NULL) == 0); +			do { +			  sched_yield(); +			  assert(sem_getvalue(&s, &value) == 0); +			} while (value != -i); +//			printf("Value = %d\n", value); fflush(stdout);  			assert(-value == i);  		} @@ -111,7 +112,7 @@ main()  		{  			assert(sem_post(&s) == 0);  			assert(sem_getvalue(&s, &value) == 0); -//			  printf("Value = %ld\n", value); +//			printf("Value = %d\n", value);	fflush(stdout);  			assert(-value == i);  		} diff --git a/tests/semaphore4.c b/tests/semaphore4.c new file mode 100644 index 0000000..3ea0568 --- /dev/null +++ b/tests/semaphore4.c @@ -0,0 +1,138 @@ +/* + * File: semaphore4.c + * + * + * -------------------------------------------------------------------------- + * + *      Pthreads-win32 - POSIX Threads Library for Win32 + *      Copyright(C) 1998 John E. Bossom + *      Copyright(C) 1999,2003 Pthreads-win32 contributors + *  + *      Contact Email: rpj@callisto.canberra.edu.au + *  + *      The current list of contributors is contained + *      in the file CONTRIBUTORS included with the source + *      code distribution. The list can also be seen at the + *      following World Wide Web location: + *      http://sources.redhat.com/pthreads-win32/contributors.html + *  + *      This library is free software; you can redistribute it and/or + *      modify it under the terms of the GNU Lesser General Public + *      License as published by the Free Software Foundation; either + *      version 2 of the License, or (at your option) any later version. + *  + *      This library is distributed in the hope that it will be useful, + *      but WITHOUT ANY WARRANTY; without even the implied warranty of + *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + *      Lesser General Public License for more details. + *  + *      You should have received a copy of the GNU Lesser General Public + *      License along with this library in the file COPYING.LIB; + *      if not, write to the Free Software Foundation, Inc., + *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * -------------------------------------------------------------------------- + * + * Test Synopsis: Verify sem_getvalue returns the correct number of waiters + * after threads are cancelled. + * -  + * + * Test Method (Validation or Falsification): + * - Validation + * + * Requirements Tested: + * -  + * + * Features Tested: + * -  + * + * Cases Tested: + * - + * + * Description: + * - + * + * Environment: + * - + * + * Input: + * - None. + * + * Output: + * - File name, Line number, and failed expression on failure. + * - No output on success. + * + * Assumptions: + * - + * + * Pass Criteria: + * - Process returns zero exit status. + * + * Fail Criteria: + * - Process returns non-zero exit status. + */ + +#include "test.h" + +#define MAX_COUNT 100 + +sem_t s; + +void * +thr (void * arg) +{ +  assert(sem_wait(&s) == 0); +  return NULL; +} + +int +main() +{ +	int value = 0; +	int i; +	pthread_t t[MAX_COUNT+1]; + +	assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0); +	assert(sem_getvalue(&s, &value) == 0); +//	printf("Value = %d\n", value);	fflush(stdout); +	assert(value == 0); + +	for (i = 1; i <= MAX_COUNT; i++) +		{ +			assert(pthread_create(&t[i], NULL, thr, NULL) == 0); +			do { +			  sched_yield(); +			  assert(sem_getvalue(&s, &value) == 0); +			} while (value != -i); +//			printf("Value = %d\n", value); fflush(stdout); +			assert(-value == i); +		} + +	assert(sem_getvalue(&s, &value) == 0); +	assert(-value == MAX_COUNT); +//printf("value = %d\n", -value); fflush(stdout); +	assert(pthread_cancel(t[50]) == 0); +	  { +	    int result; +	    assert(pthread_join(t[50], (void **) &result) == 0); +//	    printf("result = %d\n", result); fflush(stdout); +	  } +	assert(sem_getvalue(&s, &value) == 0); +//printf("value = %d\n", -value); fflush(stdout); +	assert(-value == (MAX_COUNT - 1)); + +	for (i = MAX_COUNT - 2; i >= 0; i--) +		{ +			assert(sem_post(&s) == 0); +			assert(sem_getvalue(&s, &value) == 0); +//			printf("Value = %d\n", value);	fflush(stdout); +			assert(-value == i); +		} + +	for (i = 1; i <= MAX_COUNT; i++) +	  if (i != 50) +	    assert(pthread_join(t[i], NULL) == 0); + +  return 0; +} + diff --git a/tests/semaphore4t.c b/tests/semaphore4t.c new file mode 100644 index 0000000..bb0535c --- /dev/null +++ b/tests/semaphore4t.c @@ -0,0 +1,132 @@ +/* + * File: semaphore4t.c + * + * + * -------------------------------------------------------------------------- + * + *      Pthreads-win32 - POSIX Threads Library for Win32 + *      Copyright(C) 1998 John E. Bossom + *      Copyright(C) 1999,2003 Pthreads-win32 contributors + *  + *      Contact Email: rpj@callisto.canberra.edu.au + *  + *      The current list of contributors is contained + *      in the file CONTRIBUTORS included with the source + *      code distribution. The list can also be seen at the + *      following World Wide Web location: + *      http://sources.redhat.com/pthreads-win32/contributors.html + *  + *      This library is free software; you can redistribute it and/or + *      modify it under the terms of the GNU Lesser General Public + *      License as published by the Free Software Foundation; either + *      version 2 of the License, or (at your option) any later version. + *  + *      This library is distributed in the hope that it will be useful, + *      but WITHOUT ANY WARRANTY; without even the implied warranty of + *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + *      Lesser General Public License for more details. + *  + *      You should have received a copy of the GNU Lesser General Public + *      License along with this library in the file COPYING.LIB; + *      if not, write to the Free Software Foundation, Inc., + *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * -------------------------------------------------------------------------- + * + * Test Synopsis: Verify sem_getvalue returns the correct number of waiters + * after threads are cancelled. + * -  + * + * Test Method (Validation or Falsification): + * - Validation + * + * Requirements Tested: + * - sem_timedwait cancellation. + * + * Features Tested: + * -  + * + * Cases Tested: + * - + * + * Description: + * - + * + * Environment: + * - + * + * Input: + * - None. + * + * Output: + * - File name, Line number, and failed expression on failure. + * - No output on success. + * + * Assumptions: + * - + * + * Pass Criteria: + * - Process returns zero exit status. + * + * Fail Criteria: + * - Process returns non-zero exit status. + */ + +#include "test.h" + +#define MAX_COUNT 100 + +sem_t s; + +void * +thr (void * arg) +{ +  assert(sem_timedwait(&s, NULL) == 0); +  return NULL; +} + +int +main() +{ +	int value = 0; +	int i; +	pthread_t t[MAX_COUNT+1]; + +	assert(sem_init(&s, PTHREAD_PROCESS_PRIVATE, 0) == 0); +	assert(sem_getvalue(&s, &value) == 0); +//	printf("Value = %d\n", value);	fflush(stdout); +	assert(value == 0); + +	for (i = 1; i <= MAX_COUNT; i++) +		{ +			assert(pthread_create(&t[i], NULL, thr, NULL) == 0); +			do { +			  sched_yield(); +			  assert(sem_getvalue(&s, &value) == 0); +			} while (value != -i); +//			printf("Value = %d\n", value); fflush(stdout); +			assert(-value == i); +		} + +	assert(sem_getvalue(&s, &value) == 0); +	assert(-value == MAX_COUNT); +	assert(pthread_cancel(t[50]) == 0); +	assert(pthread_join(t[50], NULL) == 0); +	assert(sem_getvalue(&s, &value) == 0); +	assert(-value == MAX_COUNT - 1); + +	for (i = MAX_COUNT - 2; i >= 0; i--) +		{ +			assert(sem_post(&s) == 0); +			assert(sem_getvalue(&s, &value) == 0); +//			printf("Value = %d\n", value);	fflush(stdout); +			assert(-value == i); +		} + +        for (i = 1; i <= MAX_COUNT; i++) +          if (i != 50) +            assert(pthread_join(t[i], NULL) == 0); + +  return 0; +} + diff --git a/tests/sizes.c b/tests/sizes.c index da7e115..6c077ad 100644 --- a/tests/sizes.c +++ b/tests/sizes.c @@ -8,7 +8,8 @@ main()  {    printf("Sizes of pthreads-win32 structs\n");    printf("-------------------------------\n"); -  printf("%30s %4d\n", "pthread_t_", sizeof(struct pthread_t_)); +  printf("%30s %4d\n", "pthread_t", sizeof(pthread_t)); +  printf("%30s %4d\n", "ptw32_thread_t", sizeof(ptw32_thread_t));    printf("%30s %4d\n", "pthread_attr_t_", sizeof(struct pthread_attr_t_));    printf("%30s %4d\n", "sem_t_", sizeof(struct sem_t_));    printf("%30s %4d\n", "pthread_mutex_t_", sizeof(struct pthread_mutex_t_)); diff --git a/tests/test.h b/tests/test.h index 072b797..b337674 100644 --- a/tests/test.h +++ b/tests/test.h @@ -45,6 +45,8 @@  #include <windows.h>  #include <stdio.h> +#define PTW32_THREAD_NULL_ID {NULL,0} +  char * error_string[] = {    "ZERO_or_EOK",    "EPERM", @@ -122,6 +124,16 @@ char * error_string[] = {            (fprintf(stderr, "Assertion failed: (%s), file %s, line %d\n", \                     #e, __FILE__, (int) __LINE__), exit(1), 0)) +int assertE; +# define assert_e(e, o, r) \ +   (((assertE = e) o (r)) ? ((ASSERT_TRACE) ? fprintf(stderr, \ +                                    "Assertion succeeded: (%s), file %s, line %d\n", \ +			            #e, __FILE__, (int) __LINE__), \ +	                            fflush(stderr) : \ +                             0) : \ +          (fprintf(stderr, "Assertion failed: (%s %s %s), file %s, line %d, error %s\n", \ +                   #e,#o,#r, __FILE__, (int) __LINE__, error_string[assertE]), exit(1), 0)) +  #endif /* NDEBUG */ diff --git a/tests/valid2.c b/tests/valid2.c index ad01b55..cef1020 100644 --- a/tests/valid2.c +++ b/tests/valid2.c @@ -76,15 +76,9 @@  int  main()  { -  pthread_t ptrToNull = NULL; -  /* This should be bigger than a pthread handle. */ -  char corruptDummy[1000]; +  pthread_t NullThread = PTW32_THREAD_NULL_ID; -  memset(corruptDummy, 0x5A, sizeof(corruptDummy)); - -  assert(pthread_kill(NULL, 0) == ESRCH); -  assert(pthread_kill(ptrToNull, 0) == ESRCH); -  assert(pthread_kill((pthread_t) corruptDummy, 0) == ESRCH); +  assert(pthread_kill(NullThread, 0) == ESRCH);    return 0;  } | 
