summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2021-11-27 23:34:47 +0300
committerIvan Maidanski <ivmai@mail.ru>2021-11-27 23:36:22 +0300
commitea9845c0ed103aeb3f435f79bfb32cd7c1e92899 (patch)
treec189f1a1d7846aa9132323fd7dc00b09fcbbe6e8 /tests
parent782a51cdde0b239e82b61bd7d75a90b00f7dda24 (diff)
downloadbdwgc-ea9845c0ed103aeb3f435f79bfb32cd7c1e92899.tar.gz
Pass ATOMIC_OPS_LIBS to tests using AO primitives directly (Automake)
Link the tests that use AO primitives directly with libatomic_ops if shared build and external libatomic_ops is used. Also, do not link test_atomic_ops with libgc. * tests/tests.am (test_ldadd): Update comment. * tests/tests.am [THREADS && ENABLE_SHARED] (gctest_LDADD, subthreadcreate_test_LDADD): Insert $(ATOMIC_OPS_LIBS) before $(THREADDLLIBS). * tests/tests.am [ENABLE_DISCLAIM && THREADS && ENABLE_SHARED] (disclaim_weakmap_test_LDADD): Likewise. * tests/tests.am [THREADS] (test_atomic_ops_LDADD): Remove comment; replace $(test_ldadd) with $(nodist_libgc_la_OBJECTS) $(EXTRA_TEST_LIBS) $(ATOMIC_OPS_LIBS).
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.am18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/tests.am b/tests/tests.am
index 0258f4aa..e7c5318b 100644
--- a/tests/tests.am
+++ b/tests/tests.am
@@ -8,7 +8,7 @@
# provided the above notices are retained, and a notice that the code was
# modified is included with the above copyright notice.
-# Common libs to _LDADD for all tests.
+# Common libs to *_LDADD for most tests.
test_ldadd = $(nodist_libgc_la_OBJECTS) $(top_builddir)/libgc.la \
$(EXTRA_TEST_LIBS)
@@ -17,6 +17,9 @@ check_PROGRAMS += gctest
gctest_SOURCES = tests/test.c
gctest_LDADD = $(test_ldadd)
if THREADS
+if ENABLE_SHARED
+gctest_LDADD += $(ATOMIC_OPS_LIBS)
+endif
gctest_LDADD += $(THREADDLLIBS)
endif
gctest_DEPENDENCIES = $(top_builddir)/libgc.la
@@ -88,8 +91,8 @@ if THREADS
TESTS += test_atomic_ops$(EXEEXT)
check_PROGRAMS += test_atomic_ops
test_atomic_ops_SOURCES = tests/test_atomic_ops.c
-# Really should need only $(ATOMIC_OPS_LIBS)
-test_atomic_ops_LDADD = $(test_ldadd) $(THREADDLLIBS)
+test_atomic_ops_LDADD = $(nodist_libgc_la_OBJECTS) $(EXTRA_TEST_LIBS) \
+ $(ATOMIC_OPS_LIBS) $(THREADDLLIBS)
TESTS += threadleaktest$(EXEEXT)
check_PROGRAMS += threadleaktest
@@ -104,7 +107,11 @@ threadkey_test_LDADD = $(test_ldadd) $(THREADDLLIBS)
TESTS += subthreadcreate_test$(EXEEXT)
check_PROGRAMS += subthreadcreate_test
subthreadcreate_test_SOURCES = tests/subthread_create.c
-subthreadcreate_test_LDADD = $(test_ldadd) $(THREADDLLIBS)
+subthreadcreate_test_LDADD = $(test_ldadd)
+if ENABLE_SHARED
+subthreadcreate_test_LDADD += $(ATOMIC_OPS_LIBS)
+endif
+subthreadcreate_test_LDADD += $(THREADDLLIBS)
TESTS += initsecondarythread_test$(EXEEXT)
check_PROGRAMS += initsecondarythread_test
@@ -150,6 +157,9 @@ check_PROGRAMS += disclaim_weakmap_test
disclaim_weakmap_test_SOURCES = tests/disclaim_weakmap_test.c
disclaim_weakmap_test_LDADD = $(test_ldadd)
if THREADS
+if ENABLE_SHARED
+disclaim_weakmap_test_LDADD += $(ATOMIC_OPS_LIBS)
+endif
disclaim_weakmap_test_LDADD += $(THREADDLLIBS)
endif