1## SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2SUBDIRS = data 3 4AM_CXXFLAGS = $(VISIBILITY_FLAGS) 5 6FEDABIPKGDIFF_TEST = 7if ENABLE_FEDABIPKGDIFF 8if ENABLE_RUNNING_TESTS_WITH_PY3 9FEDABIPKGDIFF_TEST += runtestfedabipkgdiffpy3.sh 10else 11FEDABIPKGDIFF_TEST += runtestfedabipkgdiff.py 12endif 13endif 14 15RUN_TEST_SLOW_SELF_COMPARE=runtestslowselfcompare.sh 16 17# rather expensive tests (keep in this order), > 1s runtime 18TESTS= \ 19$(RUN_TEST_SLOW_SELF_COMPARE) \ 20runtestaltdwarf \ 21runtestdiffsuppr \ 22runtesttypesstability \ 23runtestdiffpkg \ 24runtestannotate \ 25runtestdifffilter \ 26runtestreaddwarf \ 27runtestcanonicalizetypes.sh 28 29if CTF_READER 30TESTS += runtestreadctf 31endif 32 33if BTF_READER 34TESTS += runtestreadbtf 35endif 36 37# rather cheap tests 38TESTS+= \ 39runtestabicompat \ 40runtestabidiff \ 41runtestabidiffexit \ 42runtestcorediff \ 43runtestcxxcompat \ 44runtestdiffdwarf \ 45runtestdiffdwarfabixml \ 46runtestelfhelpers \ 47runtestini \ 48runtestkmiwhitelist \ 49runtestlookupsyms \ 50runtestreadwrite \ 51runtestsymtab \ 52runtestsymtabreader \ 53runtesttoolsutils \ 54runtestsvg \ 55$(FEDABIPKGDIFF_TEST) 56 57 58if ENABLE_RUNNING_TESTS_WITH_PY3 59TESTS += runtestdefaultsupprspy3.sh 60else 61TESTS += runtestdefaultsupprs.py 62endif 63 64EXTRA_DIST = \ 65runtestcanonicalizetypes.sh.in \ 66runtestfedabipkgdiff.py.in \ 67runtestslowselfcompare.sh.in \ 68mockfedabipkgdiff.in \ 69test-valgrind-suppressions.supp 70 71if ENABLE_RUNNING_TESTS_WITH_PY3 72EXTRA_DIST += \ 73runtestfedabipkgdiffpy3.sh.in \ 74runtestdefaultsupprspy3.sh.in 75endif 76 77CLEANFILES = \ 78runtestcanonicalizetypes.output.txt \ 79runtestcanonicalizetypes.output.final.txt 80 81noinst_PROGRAMS= $(TESTS) testirwalker testdiff2 printdifftree 82noinst_SCRIPTS = mockfedabipkgdiff 83noinst_LTLIBRARIES = libtestutils.la libtestreadcommon.la libcatch.la 84 85libtestutils_la_SOURCES= \ 86test-utils.h \ 87test-utils.cc 88 89libtestutils_la_CXXFLAGS= \ 90-DABIGAIL_SRC_DIR=\"${abs_top_srcdir}\" \ 91-DABIGAIL_BUILD_DIR=\"${abs_top_builddir}\" 92 93libtestreadcommon_la_SOURCES= \ 94test-read-common.h \ 95test-read-common.cc 96 97libtestreadcommon_la_CXXFLAGS= \ 98-DABIGAIL_SRC_DIR=\"${abs_top_srcdir}\" \ 99-DABIGAIL_BUILD_DIR=\"${abs_top_builddir}\" 100 101libcatch_la_SOURCES = lib/catch.cc lib/catch.hpp 102 103runtestreadwrite_SOURCES=test-read-write.cc 104runtestreadwrite_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la 105 106runtestreaddwarf_SOURCES=test-read-dwarf.cc 107runtestreaddwarf_LDADD=libtestreadcommon.la libtestutils.la \ 108 $(top_builddir)/src/libabigail.la 109runtestreaddwarf_LDFLAGS=-pthread 110 111if CTF_READER 112runtestreadctf_SOURCES=test-read-ctf.cc 113runtestreadctf_LDADD=libtestreadcommon.la libtestutils.la \ 114 $(top_builddir)/src/libabigail.la 115runtestreadctf_LDFLAGS=-pthread 116endif 117 118if BTF_READER 119runtestreadbtf_SOURCES=test-read-btf.cc 120runtestreadbtf_LDADD=libtestreadcommon.la libtestutils.la \ 121 $(top_builddir)/src/libabigail.la 122runtestreadbtf_LDFLAGS=-pthread 123endif 124 125runtestannotate_SOURCES=test-annotate.cc 126runtestannotate_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la 127 128runtestlookupsyms_SOURCES=test-lookup-syms.cc 129runtestlookupsyms_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la 130 131runtestaltdwarf_SOURCES=test-alt-dwarf-file.cc 132runtestaltdwarf_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la 133 134runtestcorediff_SOURCES=test-core-diff.cc 135runtestcorediff_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la 136 137runtestabidiff_SOURCES = test-abidiff.cc 138runtestabidiff_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la 139 140runtestabidiffexit_SOURCES = test-abidiff-exit.cc 141runtestabidiffexit_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la 142 143runtestdiffdwarf_SOURCES = test-diff-dwarf.cc 144runtestdiffdwarf_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la 145 146runtestdifffilter_SOURCES = test-diff-filter.cc 147runtestdifffilter_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la 148 149runtestdiffsuppr_SOURCES = test-diff-suppr.cc 150runtestdiffsuppr_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la 151 152runtestdiffdwarfabixml_SOURCES = test-diff-dwarf-abixml.cc 153runtestdiffdwarfabixml_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la 154 155runtestabicompat_SOURCES = test-abicompat.cc 156runtestabicompat_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la 157 158runtestdiffpkg_SOURCES = test-diff-pkg.cc 159runtestdiffpkg_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la 160 161runtesttypesstability_SOURCES = test-types-stability.cc 162runtesttypesstability_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la 163 164runtestini_SOURCES = test-ini.cc 165runtestini_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la 166 167runtesttoolsutils_SOURCES = test-tools-utils.cc 168runtesttoolsutils_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la 169 170runtestkmiwhitelist_SOURCES = test-kmi-whitelist.cc 171runtestkmiwhitelist_LDADD = libtestutils.la libcatch.la $(top_builddir)/src/libabigail.la 172 173runtestelfhelpers_SOURCES = test-elf-helpers.cc 174runtestelfhelpers_LDADD = libcatch.la $(top_builddir)/src/libabigail.la 175 176runtestcxxcompat_SOURCES = test-cxx-compat.cc 177runtestcxxcompat_LDADD = libcatch.la $(top_builddir)/src/libabigail.la 178 179runtestsymtab_SOURCES = test-symtab.cc 180runtestsymtab_LDADD = libtestutils.la libcatch.la $(top_builddir)/src/libabigail.la 181 182runtestsymtabreader_SOURCES = test-symtab-reader.cc 183runtestsymtabreader_LDADD = libcatch.la $(top_builddir)/src/libabigail.la 184 185runtestsvg_SOURCES=test-svg.cc 186runtestsvg_LDADD=$(top_builddir)/src/libabigail.la 187 188testirwalker_SOURCES=test-ir-walker.cc 189testirwalker_LDADD=$(top_builddir)/src/libabigail.la 190 191testdiff2_SOURCES=test-diff2.cc 192testdiff2_LDADD=$(top_builddir)/src/libabigail.la 193 194printdifftree_SOURCES = print-diff-tree.cc 195printdifftree_LDADD = $(top_builddir)/src/libabigail.la 196 197runtestslowselfcompare_sh_SOURCES = 198runtestslowselfcompare.sh$(EXEEXT): 199 200runtestcanonicalizetypes_sh_SOURCES = 201runtestcanonicalizetypes.sh$(EXEEXT): 202 203runtestfedabipkgdiff_py_SOURCES = 204runtestfedabipkgdiff.py$(EXEEXT): 205 206runtestdefaultsupprs_py_SOURCES = 207runtestdefaultsupprs.py$(EXEEXT): 208 209runtestfedabipkgdiffpy3_sh_SOURCES = 210runtestfedabipkgdiffpy3.sh$(EXEEXT): 211 212runtestdefaultsupprspy3_sh_SOURCES = 213runtestdefaultsupprspy3.sh$(EXEEXT): 214 215AM_CPPFLAGS=-I${abs_top_srcdir}/include -I${abs_top_srcdir}/src \ 216-I${abs_top_builddir}/include -I${abs_top_srcdir}/tools -fPIC 217 218clean-local: clean-local-check 219.PHONY: clean-local-check 220 221clean-local-check: 222 -rm -rf ${builddir}/output *.svg *.gv 223 224@VALGRIND_CHECK_RULES@ 225VALGRIND_SUPPRESSIONS_FILES = ${srcdir}/test-valgrind-suppressions.supp 226 227# These are flags passed to Valgrind so that it follows children 228# processes of the test programs. This is because many test programs 229# actually fork libabigail command line tools, and we want to valgrind 230# those libabigail command line tools as well. 231# 232# The problem though is that there are many other command line 233# programs that are forked too. For instance, /bin/sh is forked 234# because tests are using the system() function to execute commands. 235# So we must tell Valgrind to avoid following a bunch of command line 236# programs that we don't care about and that take a lot of time to 237# valgrind. 238RECURSIVE_VALGRIND_FLAGS = \ 239--num-callers=30 \ 240--trace-children=yes \ 241--trace-children-skip=/bin/diff,/bin/rm,/bin/mkdir,/bin/cd,*cpio,/bin/dpkg,/bin/rpm,/bin/test,/bin/tar,/bin/sed,/bin/ls,/bin/g++,/*collect*,/bin/ld 242 243# Use the target below to run tests under Valgrind's memcheck tool by 244# telling it to follow children process, so that it can also check 245# libabigail tools that are forked by the tests. This usually takes a 246# while. So, to launch just one test in this configuration, if you 247# are in the top-most source directory you can do: 248# 249# make -C <build-directory>/tests check-valgrind-memcheck-recursive TESTS=runtestdiffsuppr 250 251check-valgrind-memcheck-recursive: 252 $(MAKE) check-valgrind-memcheck VALGRIND_FLAGS="${RECURSIVE_VALGRIND_FLAGS}" 253 254check-valgrind-helgrind-recursive: 255 $(MAKE) check-valgrind-helgrind VALGRIND_FLAGS="${RECURSIVE_VALGRIND_FLAGS}" 256 257check-self-compare: 258 $(MAKE) check TESTS=runtestslowselfcompare.sh ENABLE_SLOW_TEST=yes 259 260