summaryrefslogtreecommitdiff
path: root/tests/weakmap.c
Commit message (Collapse)AuthorAgeFilesLines
* Do not mix debug and non-debug allocations in disclaim testsIvan Maidanski2023-01-311-6/+6
| | | | | | | | | | | | | | | * include/gc/gc_disclaim.h (GC_finalized_malloc): Add comment that the debugging version of the function is missing. * tests/disclaim_bench.c (testobj_new): Use GC_malloc() instead of GC_NEW(). * tests/weakmap.c (weakmap_add, weakmap_new): Likewise. * tests/disclaim_bench.c (testobj_new): Use GC_register_finalizer_no_order() instead of GC_REGISTER_FINALIZER_NO_ORDER(). * tests/disclaim_bench.c (main): Use GC_malloc() instead of GC_MALLOC(). * tests/weakmap.c (weakmap_add, weakmap_new): Use GC_ptr_store_and_dirty() instead of GC_PTR_STORE_AND_DIRTY().
* Avoid duplication of magic numbers in disclaim.c and weakmap.cIvan Maidanski2022-06-021-2/+5
| | | | | | | | | | | | | | (refactoring) * tests/disclaim.c (MEM_FILL_BYTE, CSUM_SEED): Define macro. * tests/weakmap.c (CSUM_SEED): Likewise. * tests/disclaim.c (misc_sizes_dct, test_misc_sizes): Use MEM_FILL_BYTE instead of 0x56. * tests/disclaim.c (pair_dct, pair_new, pair_check_rec): Use CSUM_SEED instead of 782. * tests/weakmap.c (pair_new, pair_check_rec): Likewise. * tests/disclaim.c (pair_check_rec): Use same formula for updating p as in the similar function of weakmap.c.
* Remove extra space after comma in license termsIvan Maidanski2022-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (reformatting) * CMakeLists.txt: Remove an extra space after comma in license header comment. * Makefile.am: Likewise. * allchblk.c: Likewise. * alloc.c: Likewise. * backgraph.c: Likewise. * blacklst.c: Likewise. * checksums.c: Likewise. * configure.ac: Likewise. * cord/cordbscs.c: Likewise. * cord/cordprnt.c: Likewise. * cord/cordxtra.c: Likewise. * cord/tests/cordtest.c: Likewise. * cord/tests/de.c: Likewise. * cord/tests/de_cmds.h: Likewise. * cord/tests/de_win.c: Likewise. * cord/tests/de_win.h: Likewise. * cord/tests/de_win.rc: Likewise. * darwin_stop_world.c: Likewise. * dbg_mlc.c: Likewise. * dyn_load.c: Likewise. * extra/gc.c: Likewise. * extra/msvc_dbg.c: Likewise. * extra/pcr_interface.c: Likewise. * extra/real_malloc.c: Likewise. * finalize.c: Likewise. * fnlz_mlc.c: Likewise. * gc_badalc.cc: Likewise. * gc_cpp.cc: Likewise. * gc_dlopen.c: Likewise. * gcj_mlc.c: Likewise. * headers.c: Likewise. * include/gc/cord.h: Likewise. * include/gc/cord_pos.h: Likewise. * include/gc/ec.h: Likewise. * include/gc/gc.h: Likewise. * include/gc/gc_backptr.h: Likewise. * include/gc/gc_config_macros.h: Likewise. * include/gc/gc_disclaim.h: Likewise. * include/gc/gc_gcj.h: Likewise. * include/gc/gc_inline.h: Likewise. * include/gc/gc_mark.h: Likewise. * include/gc/gc_pthread_redirects.h: Likewise. * include/gc/gc_tiny_fl.h: Likewise. * include/gc/gc_typed.h: Likewise. * include/gc/gc_version.h: Likewise. * include/gc/javaxfc.h: Likewise. * include/gc/leak_detector.h: Likewise. * include/include.am: Likewise. * include/private/darwin_semaphore.h: Likewise. * include/private/darwin_stop_world.h: Likewise. * include/private/dbg_mlc.h: Likewise. * include/private/gc_alloc_ptrs.h: Likewise. * include/private/gc_atomic_ops.h: Likewise. * include/private/gc_hdrs.h: Likewise. * include/private/gc_locks.h: Likewise. * include/private/gc_pmark.h: Likewise. * include/private/gc_priv.h: Likewise. * include/private/gcconfig.h: Likewise. * include/private/pthread_stop_world.h: Likewise. * include/private/pthread_support.h: Likewise. * include/private/specific.h: Likewise. * include/private/thread_local_alloc.h: Likewise. * m4/gc_set_version.m4: Likewise. * mach_dep.c: Likewise. * malloc.c: Likewise. * mallocx.c: Likewise. * mark.c: Likewise. * mark_rts.c: Likewise. * misc.c: Likewise. * new_hblk.c: Likewise. * obj_map.c: Likewise. * os_dep.c: Likewise. * pthread_start.c: Likewise. * pthread_stop_world.c: Likewise. * pthread_support.c: Likewise. * ptr_chck.c: Likewise. * reclaim.c: Likewise. * specific.c: Likewise. * tests/atomicops.c: Likewise. * tests/cpp.cc: Likewise. * tests/disclaim.c: Likewise. * tests/disclaim_bench.c: Likewise. * tests/gctest.c: Likewise. * tests/tests.am: Likewise. * tests/weakmap.c: Likewise. * thread_local_alloc.c: Likewise. * tools/setjmp_t.c: Likewise. * tools/threadlibs.c: Likewise. * typd_mlc.c: Likewise. * win32_threads.c: Likewise. * LICENSE: Remove an extra space after comma in license terms.
* Allow to compile tests with custom NTHREADS set to zeroIvan Maidanski2022-04-021-7/+8
| | | | | | | | | | | | | | | | | | | Also, reduce NTHREADS default value in weakmap to match that in gctest and disclaim. * tests/disclaim.c [GC_PTHREADS && !NTHREADS] (NTHREADS): Change value from 6 to 5; add comment. * tests/disclaim.c [!GC_PTHREADS] (NTHREADS): Change value from 1 to 0. * tests/weakmap.c [!GC_PTHREADS] (NTHREADS): Likewise. * tests/disclaim.c (MUTATE_CNT): Change NTHREADS to NTHREADS+1. * tests/weakmap.c (MUTATE_CNT): Likewise. * tests/disclaim.c (main): Change NTHREADS>1 to NTHREADS>0. * tests/disclaim.c (main): Call test(NULL) before calling pthread_join() first time. * tests/weakmap.c (main): Likewise. * tests/weakmap.c [GC_PTHREADS && !NTHREADS] (NTHREADS): Change value from 8 to 5; add comment. * tests/weakmap.c (main): Change defined(GC_PTHREADS) to NTHREADS>0.
* Use AO primitives in GC_RAND_NEXT instead of no_sanitize attributeIvan Maidanski2022-03-201-9/+2
| | | | | | | | | | | | | | | | | | * include/private/gc_priv.h [THREAD_SANITIZER] (GC_RAND_STATE_T): Define to volatile AO_t (instead of unsigned). * include/private/gc_priv.h [THREAD_SANITIZER] (GC_RAND_NEXT): Define to GC_rand_next. * include/private/gc_priv.h [THREAD_SANITIZER] (GC_rand_next): Define inline function (using AO_load/store to update the state). * tests/disclaim.c [GC_PTHREADS || LINT2] (GC_rand): Remove function (with GC_ATTR_NO_SANITIZE_THREAD attribute). * tests/weakmap.c [GC_PTHREADS || LINT2] (GC_rand): Likewise. * tests/disclaim.c [GC_PTHREADS || LINT2] (seed): Move static variable definition out of GC_rand. * tests/weakmap.c [GC_PTHREADS || LINT2] (seed): Likewise. * tests/disclaim.c [GC_PTHREADS || LINT2] (rand): Define to GC_RAND_NEXT(&seed). * tests/weakmap.c [GC_PTHREADS || LINT2] (rand): Likewise.
* Name all tests consistentlyIvan Maidanski2022-02-071-0/+472
(refactoring) In brief, the tests naming as follows: all test executable files end with "test" (not "_test"); all test source files do not have "test" suffix (except for gctest); test.c is named now as gctest.c. * CMakeLists.txt: Rename leak_test.c to leak.c; rename huge_test.c to huge.c; rename leak_test.c to leak.c; rename realloc_test.c to realloc.c; rename smash_test.c to smash.c; rename staticrootslib.c to staticroots_lib.c; rename trace_test.c to trace.c; rename thread_leak_test.c to threadleak.c; rename threadkey_test to threadkey_test; rename threadkey_test.c to threadkey.c; rename subthreadcreate_test to subthreadcreatetest; rename subthread_create.c to subthreadcreate.c; rename initsecondarythread_test to initfromthreadtest; rename initsecondarythread.c to initfromthread.c; rename disclaim_test to disclaimtest; rename disclaim_test.c to disclaim.c; rename disclaim_weakmap_test to weakmaptest; rename disclaim_weakmap_test.c to weakmap.c. * tests/tests.am: Likewise. * CMakeLists.txt: Rename test.c to gctest.c; rename test_cpp to cpptest; rename test_cpp.cc to cpp.cc. * Makefile.direct: Likewise. * NT_MAKEFILE: Likewise. * README.md (Installation and Portability): Likewise. * WCC_MAKEFILE: Likewise. * digimars.mak: Likewise. * doc/README.Mac: Likewise. * tests/tests.am: Likewise. * CMakeLists.txt: rename test_atomic_ops.c to atomicops.c; rename test_atomic_ops to atomicopstest. * configure.ac [$with_libatomic_ops=check]: Likewise. * ChangeLog (8.3.0): Rename threadkey_test to threadkeytest; rename test_atomic_ops to atomicopstest; rename test_cpp to cpptest. * Makefile.direct: Rename test.o to gctest.o. * NT_MAKEFILE: Rename test_cpp.exe to cpptest.exe; rename test.obj to gctest.obj. * WCC_MAKEFILE: Likewise. * digimars.mak: Likewise. * doc/README.win64: Likewise. * configure.ac: Rename test_cpp to cpptest in comment. * doc/leak.md: Rename leak_test.c to leak.c. * tests/test_atomic_ops.c: Rename to atomicops.c; remove test name in "skipped" message. * tests/test_cpp.cc: Rename to cpp.cc; rename test_cpp to cpptest. * tests/disclaim_test.c: Rename to disclaim.c. * tests/test.c: Rename to gctest.c. * tests/huge_test.c: Rename to huge.c. * tests/initsecondarythread.c: Rename to initfromthread.c. * tests/leak_test.c: Rename to leak.c. * tests/realloc_test.c: Rename to realloc.c. * tests/smash_test.c: Rename to smash.c. * tests/staticrootstest.c: Rename to staticroots.c. * tests/staticrootslib.c: Rename to staticroots_lib.c. * tests/subthread_create.c: Rename to subthreadcreate.c; remove test name in printed messages. * tests/threadkey_test.c: Rename to threadkey.c; remove test name in "skipped" message. * tests/thread_leak_test.c: Rename to threadleak.c. * tests/trace_test.c: Rename to trace.c. * tests/disclaim_weakmap_test.c: Rename to weakmap.c; rename disclaim_test.c to disclaim.c in comment.