| 1 |
# |
| 2 |
# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED |
| 3 |
# OR IMPLIED. ANY USE IS AT YOUR OWN RISK. |
| 4 |
# |
| 5 |
# Permission is hereby granted to use or copy this program |
| 6 |
# for any purpose, provided the above notices are retained on all copies. |
| 7 |
# Permission to modify the code and to distribute modified code is granted, |
| 8 |
# provided the above notices are retained, and a notice that the code was |
| 9 |
# modified is included with the above copyright notice. |
| 10 |
|
| 11 |
# Common libs to _LDADD for all tests. |
| 12 |
test_ldadd = $(nodist_libgc_la_OBJECTS) $(top_builddir)/libgc.la \ |
| 13 |
$(EXTRA_TEST_LIBS) |
| 14 |
|
| 15 |
TESTS += gctest$(EXEEXT) |
| 16 |
check_PROGRAMS += gctest |
| 17 |
gctest_SOURCES = tests/test.c |
| 18 |
gctest_LDADD = $(test_ldadd) |
| 19 |
if THREADS |
| 20 |
gctest_LDADD += $(THREADDLLIBS) |
| 21 |
endif |
| 22 |
gctest_DEPENDENCIES = $(top_builddir)/libgc.la |
| 23 |
|
| 24 |
if EMSCRIPTEN |
| 25 |
# Note: because of libtool, you'll need to point your browser to |
| 26 |
# .libs/gctest.html, not gctest.html at topdir. |
| 27 |
check_PROGRAMS += gctest.html |
| 28 |
gctest_html_SOURCES = $(gctest_SOURCES) |
| 29 |
gctest_html_LDADD = $(gctest_LDADD) |
| 30 |
# Bug in the linker not being able to determine that _memalign and _memset |
| 31 |
# are needed? it's part of mmap. |
| 32 |
gctest_html_LDFLAGS = -s "EXPORTED_FUNCTIONS=['_memalign', '_main', '_memset']" |
| 33 |
endif |
| 34 |
|
| 35 |
TESTS += leaktest$(EXEEXT) |
| 36 |
check_PROGRAMS += leaktest |
| 37 |
leaktest_SOURCES = tests/leak_test.c |
| 38 |
leaktest_LDADD = $(test_ldadd) |
| 39 |
|
| 40 |
TESTS += middletest$(EXEEXT) |
| 41 |
check_PROGRAMS += middletest |
| 42 |
middletest_SOURCES = tests/middle.c |
| 43 |
middletest_LDADD = $(test_ldadd) |
| 44 |
|
| 45 |
TESTS += smashtest$(EXEEXT) |
| 46 |
check_PROGRAMS += smashtest |
| 47 |
smashtest_SOURCES = tests/smash_test.c |
| 48 |
smashtest_LDADD = $(test_ldadd) |
| 49 |
|
| 50 |
TESTS += hugetest$(EXEEXT) |
| 51 |
check_PROGRAMS += hugetest |
| 52 |
hugetest_SOURCES = tests/huge_test.c |
| 53 |
hugetest_LDADD = $(test_ldadd) |
| 54 |
|
| 55 |
TESTS += realloc_test$(EXEEXT) |
| 56 |
check_PROGRAMS += realloc_test |
| 57 |
realloc_test_SOURCES = tests/realloc_test.c |
| 58 |
realloc_test_LDADD = $(test_ldadd) |
| 59 |
|
| 60 |
TESTS += staticrootstest$(EXEEXT) |
| 61 |
check_PROGRAMS += staticrootstest |
| 62 |
staticrootstest_SOURCES = tests/staticrootstest.c |
| 63 |
staticrootstest_CFLAGS = -DSTATICROOTSLIB2 |
| 64 |
staticrootstest_LDADD = $(nodist_libgc_la_OBJECTS) $(EXTRA_TEST_LIBS) \ |
| 65 |
libstaticrootslib_test.la libstaticrootslib2_test.la |
| 66 |
check_LTLIBRARIES += libstaticrootslib_test.la libstaticrootslib2_test.la |
| 67 |
libstaticrootslib_test_la_SOURCES = tests/staticrootslib.c |
| 68 |
libstaticrootslib_test_la_LIBADD = $(test_ldadd) |
| 69 |
libstaticrootslib_test_la_LDFLAGS = -no-undefined -rpath /nowhere |
| 70 |
libstaticrootslib_test_la_DEPENDENCIES = $(top_builddir)/libgc.la |
| 71 |
libstaticrootslib2_test_la_SOURCES = tests/staticrootslib.c |
| 72 |
libstaticrootslib2_test_la_LIBADD = $(test_ldadd) |
| 73 |
libstaticrootslib2_test_la_CFLAGS = -DSTATICROOTSLIB2 |
| 74 |
libstaticrootslib2_test_la_LDFLAGS = -no-undefined -rpath /nowhere |
| 75 |
if ENABLE_SHARED |
| 76 |
staticrootstest_LDADD += $(top_builddir)/libgc.la |
| 77 |
endif |
| 78 |
|
| 79 |
if KEEP_BACK_PTRS |
| 80 |
TESTS += tracetest$(EXEEXT) |
| 81 |
check_PROGRAMS += tracetest |
| 82 |
tracetest_SOURCES = tests/trace_test.c |
| 83 |
tracetest_LDADD = $(test_ldadd) |
| 84 |
endif |
| 85 |
|
| 86 |
if THREADS |
| 87 |
|
| 88 |
TESTS += test_atomic_ops$(EXEEXT) |
| 89 |
check_PROGRAMS += test_atomic_ops |
| 90 |
test_atomic_ops_SOURCES = tests/test_atomic_ops.c |
| 91 |
# Really should need only $(ATOMIC_OPS_LIBS) |
| 92 |
test_atomic_ops_LDADD = $(test_ldadd) $(THREADDLLIBS) |
| 93 |
|
| 94 |
TESTS += threadleaktest$(EXEEXT) |
| 95 |
check_PROGRAMS += threadleaktest |
| 96 |
threadleaktest_SOURCES = tests/thread_leak_test.c |
| 97 |
threadleaktest_LDADD = $(test_ldadd) $(THREADDLLIBS) |
| 98 |
|
| 99 |
TESTS += threadkey_test$(EXEEXT) |
| 100 |
check_PROGRAMS += threadkey_test |
| 101 |
threadkey_test_SOURCES = tests/threadkey_test.c |
| 102 |
threadkey_test_LDADD = $(test_ldadd) $(THREADDLLIBS) |
| 103 |
|
| 104 |
TESTS += subthreadcreate_test$(EXEEXT) |
| 105 |
check_PROGRAMS += subthreadcreate_test |
| 106 |
subthreadcreate_test_SOURCES = tests/subthread_create.c |
| 107 |
subthreadcreate_test_LDADD = $(test_ldadd) $(THREADDLLIBS) |
| 108 |
|
| 109 |
TESTS += initsecondarythread_test$(EXEEXT) |
| 110 |
check_PROGRAMS += initsecondarythread_test |
| 111 |
initsecondarythread_test_SOURCES = tests/initsecondarythread.c |
| 112 |
initsecondarythread_test_LDADD = $(test_ldadd) $(THREADDLLIBS) |
| 113 |
|
| 114 |
endif |
| 115 |
|
| 116 |
if CPLUSPLUS |
| 117 |
TESTS += test_cpp$(EXEEXT) |
| 118 |
check_PROGRAMS += test_cpp |
| 119 |
test_cpp_SOURCES = tests/test_cpp.cc |
| 120 |
if AVOID_CPP_LIB |
| 121 |
test_cpp_LDADD = gc_badalc.o gc_cpp.o $(test_ldadd) $(CXXLIBS) |
| 122 |
else |
| 123 |
test_cpp_LDADD = libgccpp.la $(nodist_libgc_la_OBJECTS) \ |
| 124 |
$(EXTRA_TEST_LIBS) $(CXXLIBS) |
| 125 |
## In case of static libraries build, libgc.a is already referenced in |
| 126 |
## dependency_libs attribute of libgccpp.la file. |
| 127 |
if ENABLE_SHARED |
| 128 |
test_cpp_LDADD += $(top_builddir)/libgc.la |
| 129 |
endif |
| 130 |
endif |
| 131 |
endif |
| 132 |
|
| 133 |
if ENABLE_DISCLAIM |
| 134 |
|
| 135 |
TESTS += disclaim_test$(EXEEXT) |
| 136 |
check_PROGRAMS += disclaim_test |
| 137 |
disclaim_test_SOURCES = tests/disclaim_test.c |
| 138 |
disclaim_test_LDADD = $(test_ldadd) |
| 139 |
if THREADS |
| 140 |
disclaim_test_LDADD += $(THREADDLLIBS) |
| 141 |
endif |
| 142 |
|
| 143 |
TESTS += disclaim_bench$(EXEEXT) |
| 144 |
check_PROGRAMS += disclaim_bench |
| 145 |
disclaim_bench_SOURCES = tests/disclaim_bench.c |
| 146 |
disclaim_bench_LDADD = $(test_ldadd) |
| 147 |
|
| 148 |
TESTS += disclaim_weakmap_test$(EXEEXT) |
| 149 |
check_PROGRAMS += disclaim_weakmap_test |
| 150 |
disclaim_weakmap_test_SOURCES = tests/disclaim_weakmap_test.c |
| 151 |
disclaim_weakmap_test_LDADD = $(test_ldadd) |
| 152 |
if THREADS |
| 153 |
disclaim_weakmap_test_LDADD += $(THREADDLLIBS) |
| 154 |
endif |
| 155 |
|
| 156 |
endif |
| 157 |
|
| 158 |
# Run the tests directly (without test-driver): |
| 159 |
.PHONY: check-without-test-driver |
| 160 |
check-without-test-driver: $(TESTS) |
| 161 |
./gctest$(EXEEXT) |
| 162 |
./hugetest$(EXEEXT) |
| 163 |
./leaktest$(EXEEXT) |
| 164 |
./middletest$(EXEEXT) |
| 165 |
./realloc_test$(EXEEXT) |
| 166 |
./smashtest$(EXEEXT) |
| 167 |
./staticrootstest$(EXEEXT) |
| 168 |
test ! -f disclaim_bench$(EXEEXT) || ./disclaim_bench$(EXEEXT) |
| 169 |
test ! -f disclaim_test$(EXEEXT) || ./disclaim_test$(EXEEXT) |
| 170 |
test ! -f disclaim_weakmap_test$(EXEEXT) || ./disclaim_weakmap_test$(EXEEXT) |
| 171 |
test ! -f initsecondarythread_test$(EXEEXT) \ |
| 172 |
|| ./initsecondarythread_test$(EXEEXT) |
| 173 |
test ! -f test_atomic_ops$(EXEEXT) || ./test_atomic_ops$(EXEEXT) |
| 174 |
test ! -f threadkey_test$(EXEEXT) || ./threadkey_test$(EXEEXT) |
| 175 |
test ! -f threadleaktest$(EXEEXT) || ./threadleaktest$(EXEEXT) |
| 176 |
test ! -f subthreadcreate_test$(EXEEXT) || ./subthreadcreate_test$(EXEEXT) |
| 177 |
test ! -f test_cpp$(EXEEXT) || ./test_cpp$(EXEEXT) |
| 178 |
test ! -f tracetest$(EXEEXT) || ./tracetest$(EXEEXT) |
| 179 |
./cordtest$(EXEEXT) |