diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 951 | ||||
-rw-r--r-- | tests/GNUmakefile | 119 | ||||
-rw-r--r-- | tests/Makefile | 102 | ||||
-rw-r--r-- | tests/condvar7.c | 6 | ||||
-rw-r--r-- | tests/exception1.c | 2 | ||||
-rw-r--r-- | tests/exception2.c | 8 | ||||
-rw-r--r-- | tests/exception3.c | 2 | ||||
-rw-r--r-- | tests/eyal1.c | 2 | ||||
-rw-r--r-- | tests/mutex1.c | 4 | ||||
-rw-r--r-- | tests/rwlock6.c | 34 |
10 files changed, 666 insertions, 564 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 92fca1b..b1b3881 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,458 +1,493 @@ -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(). +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().
diff --git a/tests/GNUmakefile b/tests/GNUmakefile index 33de3ac..d38f982 100644 --- a/tests/GNUmakefile +++ b/tests/GNUmakefile @@ -2,27 +2,33 @@ # If all of the .pass files can be created, the test suite has passed. +#CP = cp +#MV = mv +#RM = rm CP = copy MV = rename RM = erase MKDIR = mkdir TOUCH = echo Passed > ECHO = @echo +MAKE = make # # Mingw32 # GLANG = c++ CC = gcc +XXCFLAGS = #CFLAGS = -g -O0 -mthreads -UNDEBUG -Wall -x $(GLANG) -CFLAGS = -O3 -mthreads -UNDEBUG -Wall -x $(GLANG) +#CFLAGS = -O3 -mthreads -UNDEBUG -Wall -x $(GLANG) +CFLAGS = -g -O0 -UNDEBUG -Wall $(XXCFLAGS) BUILD_DIR = .. INCLUDES = -I. -LIBS = -L. -lpthreadw32 +GCX = DUMMY HDR = pthread.h semaphore.h sched.h -LIB = libpthreadw32.a -DLL = pthreadGCE.dll +LIB = libpthread$(GCX).a +DLL = pthread$(GCX).dll COPYFILES = $(HDR) $(LIB) $(DLL) @@ -30,45 +36,51 @@ COPYFILES = $(HDR) $(LIB) $(DLL) # stop. TESTS = loadfree \ - mutex1 condvar1 condvar2 exit1 create1 equal1 \ + self1 mutex5 mutex1 mutex1e mutex1n mutex1r condvar1 condvar2 exit1 create1 equal1 \ exit2 exit3 \ - join0 join1 join2 mutex2 mutex3 mutex4 \ - count1 once1 tsd1 self1 self2 cancel1 cancel2 eyal1 \ + join0 join1 join2 mutex2 mutex3 mutex4 mutex6 mutex6n mutex6e mutex6r \ + count1 once1 tsd1 self2 cancel1 cancel2 eyal1 \ condvar3 condvar4 condvar5 condvar6 condvar7 condvar8 condvar9 \ errno1 \ - rwlock1 rwlock2 rwlock3 rwlock4 rwlock5 rwlock6 \ + rwlock1 rwlock2 rwlock3 rwlock4 rwlock5 rwlock6 rwlock7 \ context1 cancel3 cancel4 cancel5 \ cleanup0 cleanup1 cleanup2 cleanup3 \ exception1 exception2 exception3 PASSES = $(TESTS:%=%.pass) -all: $(PASSES) +default: + @ $(ECHO) Run one of the following command lines: + @ $(ECHO) nmake clean GCE (to test using GNU C dll with C++ exception handling) + @ $(ECHO) nmake clean GC (to test using GNU C dll with C cleanup code) + +auto: + @ $(MAKE) clean GCE + @ $(MAKE) clean GC + +GC: + $(MAKE) GCX=GC XXCFLAGS="-x c" all-GC + +GCE: + $(MAKE) GCX=GCE XXCFLAGS="-mthreads -x c++" all-GCE + +all-GC: $(PASSES) + @ $(ECHO) ALL TESTS PASSED! Congratulations! + +all-GCE: $(PASSES) @ $(ECHO) ALL TESTS PASSED! Congratulations! -loadfree.pass: pthread.dll -mutex1.pass: -mutex2.pass: -exit1.pass: -condvar1.pass: -self1.pass: -condvar2.pass: condvar1.pass -create1.pass: mutex2.pass cancel1.pass: create1.pass cancel2.pass: cancel1.pass -mutex3.pass: create1.pass -mutex4.pass: mutex3.pass -equal1.pass: create1.pass -exit2.pass: create1.pass -exit3.pass: create1.pass -join0.pass: create1.pass -join1.pass: create1.pass -join2.pass: create1.pass -count1.pass: join1.pass -once1.pass: create1.pass -tsd1.pass: join1.pass -self2.pass: create1.pass -eyal1.pass: tsd1.pass +cancel3.pass: context1.pass +cancel4.pass: cancel3.pass +cancel5.pass: cancel3.pass +cleanup0.pass: cancel5.pass +cleanup1.pass: cleanup0.pass +cleanup2.pass: cleanup1.pass +cleanup3.pass: cleanup2.pass +condvar1.pass: +condvar2.pass: condvar1.pass condvar3.pass: create1.pass condvar4.pass: create1.pass condvar5.pass: condvar4.pass @@ -76,33 +88,53 @@ 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 +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 +eyal1.pass: tsd1.pass +join0.pass: create1.pass +join1.pass: create1.pass +join2.pass: create1.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 +mutex3.pass: create1.pass +mutex4.pass: mutex3.pass +mutex5.pass: +once1.pass: create1.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 -context1.pass: cancel2.pass -cancel3.pass: context1.pass -cancel4.pass: cancel3.pass -cancel5.pass: cancel3.pass -cleanup0.pass: cancel5.pass -cleanup1.pass: cleanup0.pass -cleanup2.pass: cleanup1.pass -cleanup3.pass: cleanup2.pass -exception1.pass: cancel4.pass -exception2.pass: exception1.pass -exception3.pass: exception2.pass +rwlock7.pass: rwlock6.pass +self1.pass: +self2.pass: create1.pass +tsd1.pass: join1.pass #%.pass: %.exe $(HDR) %.pass: %.exe $(LIB) $(DLL) $(HDR) + @ $(ECHO) Running $* $* @ $(ECHO) Passed @ $(TOUCH) $@ %.exe: %.c - @ $(CC) $(CFLAGS) -o $@ $^ $(INCLUDES) $(LIBS) + @ $(ECHO) Compiling $@ + @ $(ECHO) $(CC) $(CFLAGS) -o $@ $^ $(INCLUDES) -L. -lpthread$(GCX) + @ $(CC) $(CFLAGS) -o $@ $^ $(INCLUDES) -L. -lpthread$(GCX) %.pre: %.c @ $(CC) -E $(CFLAGS) -o $@ $^ $(INCLUDES) @@ -123,10 +155,9 @@ clean: - $(RM) pthread.h - $(RM) semaphore.h - $(RM) sched.h - - $(RM) libpthreadw32.a + - $(RM) *.a - $(RM) *.e - $(RM) *.obj - $(RM) *.pdb - $(RM) *.exe - $(RM) *.pass - diff --git a/tests/Makefile b/tests/Makefile index 281cd50..5915d54 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -11,13 +11,17 @@ ECHO = @echo CPHDR = pthread.h semaphore.h sched.h
# C++ Exceptions
-VCEFLAGS = /GX /TP /DPtW32NoCatchWarn
+VCEFLAGS = /GX /TP /DPtW32NoCatchWarn /D__CLEANUP_CXX
VCELIB = pthreadVCE.lib
VCEDLL = pthreadVCE.dll
# Structured Exceptions
-VSEFLAGS =
+VSEFLAGS = /D__CLEANUP_SEH
VSELIB = pthreadVSE.lib
VSEDLL = pthreadVSE.dll
+#C cleanup code
+VCFLAGS = /D__CLEANUP_C
+VCLIB = pthreadVC.lib
+VCDLL = pthreadVC.dll
CFLAGS= /W3 /WX /MT /nologo /Yd /Zi -D_WIN32_WINNT=0x400
LFLAGS= /INCREMENTAL:NO
@@ -33,30 +37,36 @@ EHFLAGS = # stop.
PASSES= loadfree.pass \
- mutex1.pass mutex2.pass mutex3.pass mutex4.pass \
+ self1.pass mutex5.pass \
+ mutex1.pass mutex1n.pass mutex1e.pass mutex1r.pass mutex2.pass mutex3.pass \
condvar1.pass condvar2.pass \
exit1.pass create1.pass equal1.pass \
exit2.pass exit3.pass \
join0.pass join1.pass join2.pass \
+ mutex4.pass mutex6.pass mutex6n.pass mutex6e.pass mutex6r.pass \
count1.pass once1.pass tsd1.pass \
- self1.pass self2.pass \
+ self2.pass \
cancel1.pass cancel2.pass \
eyal1.pass \
condvar3.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 \
+ rwlock1.pass rwlock2.pass rwlock3.pass rwlock4.pass rwlock5.pass rwlock6.pass rwlock7.pass \
context1.pass \
cancel3.pass cancel4.pass cancel5.pass \
cleanup0.pass cleanup1.pass cleanup2.pass cleanup3.pass \
- exception1.pass exception2.pass exception3.pass
+ exception1.pass exception2.pass exception3.pass
all:
@ $(ECHO) Run one of the following command lines:
- @ $(ECHO) nmake clean VCE (to test using dll with C++ exception handling)
- @ $(ECHO) nmake clean VSE (to test using dll with structured exception handling)
+ @ $(ECHO) nmake clean VCE (to test using MSVC dll with C++ exception handling)
+ @ $(ECHO) nmake clean VSE (to test using MSVC dll with structured exception handling)
+ @ $(ECHO) nmake clean VC (to test using MSVC dll with C cleanup code)
-auto: clean VCE clean VSE
+auto:
+ @ nmake clean VCE
+ @ nmake clean VSE
+ @ nmake clean VC
tests: $(CPLIB) $(CPDLL) $(CPHDR) $(PASSES)
@ $(ECHO) ALL TESTS PASSED! Congratulations!
@@ -73,6 +83,9 @@ VCE: VSE:
@ nmake TEST="$@" CPLIB="$(VSELIB)" CPDLL="$(VSEDLL)" EHFLAGS="$(VSEFLAGS)" tests
+VC:
+ @ nmake TEST="$@" CPLIB="$(VCLIB)" CPDLL="$(VCDLL)" EHFLAGS="$(VCFLAGS)" tests
+
.c.exe:
@ $(ECHO) Compiling $@
@ $(CC) $(EHFLAGS) $(CFLAGS) $(INCLUDES) $< /Fe$@ /link $(LFLAGS) $(CPLIB)
@@ -101,29 +114,17 @@ clean: - $(RM) *.exe
- $(RM) *.pass
-loadfree.pass: pthread.dll
-mutex1.pass:
-mutex2.pass:
-exit1.pass:
-condvar1.pass:
-self1.pass:
-condvar2.pass: condvar1.pass
-create1.pass: mutex2.pass
cancel1.pass: create1.pass
cancel2.pass: cancel1.pass
-mutex3.pass: create1.pass
-mutex4.pass: mutex3.pass
-equal1.pass: create1.pass
-exit2.pass: create1.pass
-exit3.pass: create1.pass
-join0.pass: create1.pass
-join1.pass: create1.pass
-join2.pass: create1.pass
-count1.pass: join1.pass
-once1.pass: create1.pass
-tsd1.pass: join1.pass
-self2.pass: create1.pass
-eyal1.pass: tsd1.pass
+cancel3.pass: context1.pass
+cancel4.pass: cancel3.pass
+cancel5.pass: cancel3.pass
+cleanup0.pass: cancel5.pass
+cleanup1.pass: cleanup0.pass
+cleanup2.pass: cleanup1.pass
+cleanup3.pass: cleanup2.pass
+condvar1.pass:
+condvar2.pass: condvar1.pass
condvar3.pass: create1.pass
condvar4.pass: create1.pass
condvar5.pass: condvar4.pass
@@ -131,21 +132,40 @@ 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
+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
+eyal1.pass: tsd1.pass
+join0.pass: create1.pass
+join1.pass: create1.pass
+join2.pass: create1.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
+mutex3.pass: create1.pass
+mutex4.pass: mutex3.pass
+mutex5.pass:
+once1.pass: create1.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
-context1.pass: cancel2.pass
-cancel3.pass: context1.pass
-cancel4.pass: cancel3.pass
-cancel5.pass: cancel3.pass
-cleanup0.pass: cancel5.pass
-cleanup1.pass: cleanup0.pass
-cleanup2.pass: cleanup1.pass
-cleanup3.pass: cleanup2.pass
-exception1.pass: cancel4.pass
-exception2.pass: exception1.pass
-exception3.pass: exception2.pass
+rwlock7.pass: rwlock6.pass
+self1.pass:
+self2.pass: create1.pass
+tsd1.pass: join1.pass
+
+
diff --git a/tests/condvar7.c b/tests/condvar7.c index 23e2441..afac300 100644 --- a/tests/condvar7.c +++ b/tests/condvar7.c @@ -134,7 +134,7 @@ main() abstime.tv_sec = currSysTime.time; abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; - abstime.tv_sec += 5; + abstime.tv_sec += 10; assert((t[0] = pthread_self()) != NULL); @@ -156,7 +156,7 @@ main() /* * Give threads time to start. */ - Sleep(2000); + Sleep(1000); assert(pthread_mutex_lock(&cvthing.lock) == 0); @@ -218,5 +218,3 @@ main() */ return 0; } - - diff --git a/tests/exception1.c b/tests/exception1.c index 1452d1a..60038cd 100644 --- a/tests/exception1.c +++ b/tests/exception1.c @@ -219,6 +219,8 @@ main() #else /* defined(_MSC_VER) || defined(__cplusplus) */
+#include <stdio.h>
+
int
main()
{
diff --git a/tests/exception2.c b/tests/exception2.c index da3d3b4..d49e866 100644 --- a/tests/exception2.c +++ b/tests/exception2.c @@ -40,13 +40,17 @@ */ +#if defined(_MSC_VER) || defined(__cplusplus) + #if defined(_MSC_VER) && defined(__cplusplus) #include <eh.h> #else #include <new.h> #endif -#if defined(_MSC_VER) || defined(__cplusplus) +#ifdef __GNUC__ +#include <stdlib.h> +#endif #include "test.h" @@ -110,6 +114,8 @@ main(int argc, char argv[]) #else /* defined(_MSC_VER) || defined(__cplusplus) */ +#include <stdio.h> + int main() { diff --git a/tests/exception3.c b/tests/exception3.c index 66f4173..216dc27 100644 --- a/tests/exception3.c +++ b/tests/exception3.c @@ -112,6 +112,8 @@ main() #else /* defined(__cplusplus) */ +#include <stdio.h> + int main() { diff --git a/tests/eyal1.c b/tests/eyal1.c index 6954c3b..17ab6fe 100644 --- a/tests/eyal1.c +++ b/tests/eyal1.c @@ -315,6 +315,8 @@ main (int argc, char *argv[]) else printf ("failed %d\n", tcs[i].stat); + assert(pthread_mutex_unlock(&tcs[i].mutex_start) == 0); + assert(pthread_mutex_destroy (&tcs[i].mutex_start) == 0); assert(pthread_mutex_destroy (&tcs[i].mutex_started) == 0); assert(pthread_mutex_destroy (&tcs[i].mutex_end) == 0); diff --git a/tests/mutex1.c b/tests/mutex1.c index c997963..b7f6b6f 100644 --- a/tests/mutex1.c +++ b/tests/mutex1.c @@ -24,6 +24,10 @@ main() assert(mutex != NULL); + assert(pthread_mutex_lock(&mutex) == 0); + + assert(pthread_mutex_unlock(&mutex) == 0); + assert(pthread_mutex_destroy(&mutex) == 0); assert(mutex == NULL); diff --git a/tests/rwlock6.c b/tests/rwlock6.c index 7daccd7..3f53520 100644 --- a/tests/rwlock6.c +++ b/tests/rwlock6.c @@ -1,30 +1,30 @@ -/* +/* * rwlock6.c * * Check that writer locks have priority. * * Depends on API functions: - * pthread_rwlock_rdlock() - * pthread_rwlock_wrlock() - * pthread_rwlock_unlock() + * pthread_rwlock_rdlock() + * pthread_rwlock_wrlock() + * pthread_rwlock_unlock() */ #include "test.h" - + static pthread_rwlock_t rwlock1 = PTHREAD_RWLOCK_INITIALIZER; -static int bankAccount; +static int bankAccount = 0; void * wrfunc(void * arg) { assert(pthread_rwlock_wrlock(&rwlock1) == 0); - Sleep(1000); + Sleep(2000); bankAccount += 10; assert(pthread_rwlock_unlock(&rwlock1) == 0); - return((void *) bankAccount); + return ((void *) bankAccount); } - + void * rdfunc(void * arg) { int ba = 0; @@ -34,9 +34,9 @@ void * rdfunc(void * arg) assert(pthread_rwlock_unlock(&rwlock1) == 0); ba += 10; - return((void *) ba); + return ((void *) ba); } - + int main() { @@ -47,11 +47,13 @@ main() int wr2Result = 0; int rdResult = 0; + bankAccount = 0; + assert(pthread_create(&wrt1, NULL, wrfunc, NULL) == 0); - Sleep(200); - assert(pthread_create(&rdt, NULL, rdfunc, NULL) == 0); - Sleep(200); - assert(pthread_create(&wrt2, NULL, wrfunc, NULL) == 0); + Sleep(500); + assert(pthread_create(&wrt2, NULL, rdfunc, NULL) == 0); + Sleep(500); + assert(pthread_create(&rdt, NULL, wrfunc, NULL) == 0); assert(pthread_join(wrt1, (void **) &wr1Result) == 0); assert(pthread_join(wrt2, (void **) &wr2Result) == 0); @@ -59,7 +61,7 @@ main() assert(wr1Result == 10); assert(wr2Result == 20); - assert(rdResult == 30); + assert(rdResult == 20); return 0; } |