blob: bcba55f327b23a51c63979542d15dd9b422e63f6 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001SUMMARY = "Valgrind memory debugger and instrumentation framework"
2HOMEPAGE = "http://valgrind.org/"
3BUGTRACKER = "http://valgrind.org/support/bug_reports.html"
4LICENSE = "GPLv2 & GPLv2+ & BSD"
5LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
Andrew Geissler4ed12e12020-06-05 18:00:41 -05006 file://include/pub_tool_basics.h;beginline=6;endline=29;md5=41c410e8d3f305aee7aaa666b2e4f366 \
Brad Bishopc342db32019-05-15 21:57:59 -04007 file://include/valgrind.h;beginline=1;endline=56;md5=ad3b317f3286b6b704575d9efe6ca5df \
8 file://COPYING.DOCS;md5=24ea4c7092233849b4394699333b5c56"
9
Brad Bishop96ff1982019-08-19 13:50:42 -040010DEPENDS = " \
Brad Bishopc342db32019-05-15 21:57:59 -040011 ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'boost', '', d)} \
12 "
13
14SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
15 file://fixed-perl-path.patch \
16 file://Added-support-for-PPC-instructions-mfatbu-mfatbl.patch \
17 file://run-ptest \
Brad Bishopa34c0302019-09-23 22:34:48 -040018 file://remove-for-aarch64 \
Brad Bishopc342db32019-05-15 21:57:59 -040019 file://0004-Fix-out-of-tree-builds.patch \
20 file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \
21 file://0001-Remove-tests-that-fail-to-build-on-some-PPC32-config.patch \
22 file://use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch \
23 file://avoid-neon-for-targets-which-don-t-support-it.patch \
24 file://valgrind-make-ld-XXX.so-strlen-intercept-optional.patch \
25 file://0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch \
26 file://0001-str_tester.c-Limit-rawmemchr-test-to-glibc.patch \
27 file://0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch \
28 file://0002-context-APIs-are-not-available-on-musl.patch \
29 file://0003-correct-include-directive-path-for-config.h.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040030 file://0005-tc20_verifywrap.c-Fake-__GLIBC_PREREQ-with-musl.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040031 file://0001-memcheck-arm64-Define-__THROW-if-not-already-defined.patch \
32 file://0002-memcheck-x86-Define-__THROW-if-not-defined.patch \
33 file://0003-tests-seg_override-Replace-__modify_ldt-with-syscall.patch \
34 file://0001-fix-opcode-not-supported-on-mips32-linux.patch \
35 file://0001-Guard-against-__GLIBC_PREREQ-for-musl-libc.patch \
36 file://0001-Make-local-functions-static-to-avoid-assembler-error.patch \
37 file://0001-Return-a-valid-exit_code-from-vg_regtest.patch \
38 file://0001-valgrind-filter_xml_frames-do-not-filter-usr.patch \
Andrew Geisslerc9f78652020-09-18 14:11:35 -050039 file://0001-memcheck-vgtests-remove-fullpath-after-flags.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050040 file://s390x_vec_op_t.patch \
41 file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050042 file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
Andrew Geissler4c19ea12020-10-27 13:52:24 -050043 file://0001-drd-Port-to-Fedora-33.patch \
44 file://0001-drd-musl-fix.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040045 "
Andrew Geisslerd25ed322020-06-27 00:28:28 -050046SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589"
47SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca"
Brad Bishopc342db32019-05-15 21:57:59 -040048UPSTREAM_CHECK_REGEX = "valgrind-(?P<pver>\d+(\.\d+)+)\.tar"
49
50COMPATIBLE_HOST = '(i.86|x86_64|arm|aarch64|mips|powerpc|powerpc64).*-linux'
51
Andrew Geisslerc9f78652020-09-18 14:11:35 -050052# patch 0001-memcheck-vgtests-remove-fullpath-after-flags.patch removes relative path
53# argument. Change expected stderr files accordingly.
54do_patch_append() {
55 bb.build.exec_func('do_sed_paths', d)
56}
57
58do_sed_paths() {
59 sed -i -e 's|tests/||' ${S}/memcheck/tests/badfree3.stderr.exp
60 sed -i -e 's|tests/||' ${S}/memcheck/tests/varinfo5.stderr.exp
61}
62
Brad Bishopc342db32019-05-15 21:57:59 -040063# valgrind supports armv7 and above
64COMPATIBLE_HOST_armv4 = 'null'
65COMPATIBLE_HOST_armv5 = 'null'
66COMPATIBLE_HOST_armv6 = 'null'
67
Andrew Geisslerd25ed322020-06-27 00:28:28 -050068# valgrind fails with powerpc soft-float
69COMPATIBLE_HOST_powerpc = "${@bb.utils.contains('TARGET_FPU', 'soft', 'null', '.*-linux', d)}"
70
Brad Bishopc342db32019-05-15 21:57:59 -040071# X32 isn't supported by valgrind at this time
72COMPATIBLE_HOST_linux-gnux32 = 'null'
73COMPATIBLE_HOST_linux-muslx32 = 'null'
74
75# Disable for some MIPS variants
76COMPATIBLE_HOST_mipsarchr6 = 'null'
77COMPATIBLE_HOST_linux-gnun32 = 'null'
78
79# Disable for powerpc64 with musl
80COMPATIBLE_HOST_libc-musl_powerpc64 = 'null'
81
Andrew Geissler82c905d2020-04-13 13:39:40 -050082# brokenseip is unfortunately required by ptests to pass
83inherit autotools-brokensep ptest multilib_header
Brad Bishopc342db32019-05-15 21:57:59 -040084
85EXTRA_OECONF = "--enable-tls --without-mpicc"
86EXTRA_OECONF += "${@['--enable-only32bit','--enable-only64bit'][d.getVar('SITEINFO_BITS') != '32']}"
87
88# valgrind checks host_cpu "armv7*)", so we need to over-ride the autotools.bbclass default --host option
89EXTRA_OECONF_append_arm = " --host=armv7${HOST_VENDOR}-${HOST_OS}"
90
91EXTRA_OEMAKE = "-w"
92
93CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
94
95# valgrind likes to control its own optimisation flags. It generally defaults
96# to -O2 but uses -O0 for some specific test apps etc. Passing our own flags
97# (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it
98# which fixes build path issue in DWARF.
99SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}"
100
101do_configure_prepend () {
102 rm -rf ${S}/config.h
103 sed -i -e 's:$(abs_top_builddir):$(pkglibdir)/ptest:g' ${S}/none/tests/Makefile.am
104 sed -i -e 's:$(top_builddir):$(pkglibdir)/ptest:g' ${S}/memcheck/tests/Makefile.am
105}
106
107do_install_append () {
108 install -m 644 ${B}/default.supp ${D}/${libdir}/valgrind/
109 oe_multilib_header valgrind/config.h
110}
111
112VALGRINDARCH ?= "${TARGET_ARCH}"
113VALGRINDARCH_aarch64 = "arm64"
114VALGRINDARCH_x86-64 = "amd64"
115VALGRINDARCH_x86 = "x86"
116VALGRINDARCH_mips = "mips32"
117VALGRINDARCH_mipsel = "mips32"
118VALGRINDARCH_mips64el = "mips64"
119VALGRINDARCH_powerpc = "ppc"
120VALGRINDARCH_powerpc64 = "ppc64"
121VALGRINDARCH_powerpc64el = "ppc64le"
122
123INHIBIT_PACKAGE_STRIP_FILES = "${PKGD}${libdir}/valgrind/vgpreload_memcheck-${VALGRINDARCH}-linux.so"
124
125RDEPENDS_${PN} += "perl"
126
127# valgrind needs debug information for ld.so at runtime in order to
128# redirect functions like strlen.
129RRECOMMENDS_${PN} += "${TCLIBC}-dbg"
130
Brad Bishopa34c0302019-09-23 22:34:48 -0400131RDEPENDS_${PN}-ptest += " bash coreutils file \
132 gdb libgomp \
133 perl \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500134 perl-module-file-basename perl-module-file-glob perl-module-getopt-long \
135 perl-module-overloading \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500136 procps sed ${PN}-dbg ${PN}-src"
Brad Bishopc342db32019-05-15 21:57:59 -0400137RDEPENDS_${PN}-ptest_append_libc-glibc = " glibc-utils"
138
139# One of the tests contains a bogus interpreter path on purpose.
140# Skip file dependency check
141SKIP_FILEDEPS_${PN}-ptest = '1'
142INSANE_SKIP_${PN}-ptest = "debug-deps"
143
144do_compile_ptest() {
145 oe_runmake check
146}
147
148do_install_ptest() {
149 chmod +x ${B}/tests/vg_regtest
150
151 # The test application binaries are not automatically installed.
152 # Grab them from the build directory.
153 #
154 # The regression tests require scripts and data files that are not
155 # copied to the build directory. They must be copied from the
156 # source directory.
157 saved_dir=$PWD
158 for parent_dir in ${S} ${B} ; do
159 cd $parent_dir
160
Brad Bishopc342db32019-05-15 21:57:59 -0400161 subdirs=" \
Brad Bishopa34c0302019-09-23 22:34:48 -0400162 .in_place \
Brad Bishopc342db32019-05-15 21:57:59 -0400163 cachegrind/tests \
164 callgrind/tests \
Brad Bishopa34c0302019-09-23 22:34:48 -0400165 dhat/tests \
Brad Bishopc342db32019-05-15 21:57:59 -0400166 drd/tests \
167 gdbserver_tests \
168 helgrind/tests \
Brad Bishopa34c0302019-09-23 22:34:48 -0400169 lackey/tests \
Brad Bishopc342db32019-05-15 21:57:59 -0400170 massif/tests \
171 memcheck/tests \
172 none/tests \
173 tests \
Brad Bishopa34c0302019-09-23 22:34:48 -0400174 exp-bbv/tests \
175 exp-dhat/tests \
176 exp-sgcheck/tests \
Brad Bishopc342db32019-05-15 21:57:59 -0400177 "
Brad Bishopc342db32019-05-15 21:57:59 -0400178 # Get the vg test scripts, filters, and expected files
179 for dir in $subdirs ; do
180 find $dir | cpio -pvdu ${D}${PTEST_PATH}
181 done
182 cd $saved_dir
183 done
184
Brad Bishopa34c0302019-09-23 22:34:48 -0400185 # The scripts reference config.h so add it to the top ptest dir.
186 cp ${B}/config.h ${D}${PTEST_PATH}
187 install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH}
188
189 # Add an executable need by none/tests/bigcode
190 mkdir ${D}${PTEST_PATH}/perf
191 cp ${B}/perf/bigcode ${D}${PTEST_PATH}/perf
192
193 # Add an executable needed by memcheck/tests/vcpu_bz2
194 cp ${B}/perf/bz2 ${D}${PTEST_PATH}/perf
195
196 # Make the ptest dir look like the top level valgrind src dir
197 # This is checked by the gdbserver_tests/make_local_links script
198 mkdir ${D}${PTEST_PATH}/coregrind
199 cp ${B}/coregrind/vgdb ${D}${PTEST_PATH}/coregrind
200
201 # Add an executable needed by massif tests
202 cp ${B}/massif/ms_print ${D}${PTEST_PATH}/massif/ms_print
203
Brad Bishopc342db32019-05-15 21:57:59 -0400204 find ${D}${PTEST_PATH} \
Brad Bishopa34c0302019-09-23 22:34:48 -0400205 \( \
206 -name "Makefile*" \
Brad Bishopc342db32019-05-15 21:57:59 -0400207 -o -name "*.o" \
Brad Bishopa34c0302019-09-23 22:34:48 -0400208 \) \
Brad Bishopc342db32019-05-15 21:57:59 -0400209 -exec rm {} \;
Brad Bishopa34c0302019-09-23 22:34:48 -0400210
211 # These files need to be newer so touch them.
Brad Bishop15ae2502019-06-18 21:44:24 -0400212 touch ${D}${PTEST_PATH}/cachegrind/tests/a.c -r ${D}${PTEST_PATH}/cachegrind/tests/cgout-test
Brad Bishopc342db32019-05-15 21:57:59 -0400213
214 # find *_annotate in ${bindir} for yocto build
215 sed -i s:\.\./\.\./cachegrind/cg_annotate:${bindir}/cg_annotate: ${D}${PTEST_PATH}/cachegrind/tests/ann1.vgtest
216 sed -i s:\.\./\.\./cachegrind/cg_annotate:${bindir}/cg_annotate: ${D}${PTEST_PATH}/cachegrind/tests/ann2.vgtest
217
218 sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann1.vgtest
219 sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann2.vgtest
220
Brad Bishopc342db32019-05-15 21:57:59 -0400221 # handle multilib
222 sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest
Brad Bishopa34c0302019-09-23 22:34:48 -0400223 sed -i s:@bindir@:${bindir}:g ${D}${PTEST_PATH}/run-ptest
Andrew Geissler82c905d2020-04-13 13:39:40 -0500224
225 # This test fails on the host as well, using both 3.15 and git master (as of Jan 24 2020)
226 # https://bugs.kde.org/show_bug.cgi?id=402833
227 rm ${D}${PTEST_PATH}/memcheck/tests/overlap.vgtest
228
229 # As the binary isn't stripped or debug-splitted, the source file isn't fetched
230 # via dwarfsrcfiles either, so it needs to be installed manually.
231 mkdir -p ${D}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/${BP}/none/tests/
232 install ${S}/none/tests/tls.c ${D}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/${BP}/none/tests/
Brad Bishopc342db32019-05-15 21:57:59 -0400233}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500234
235# avoid stripping some generated binaries otherwise some of the tests will fail
236# run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail
237INHIBIT_PACKAGE_STRIP_FILES = "\
238 ${PKGD}${PTEST_PATH}/none/tests/tls \
239 ${PKGD}${PTEST_PATH}/none/tests/tls.so \
240 ${PKGD}${PTEST_PATH}/none/tests/tls2.so \
241 ${PKGD}${PTEST_PATH}/helgrind/tests/tc09_bad_unlock \
242 ${PKGD}${PTEST_PATH}/memcheck/tests/manuel1 \
243 ${PKGD}${PTEST_PATH}/drd/tests/pth_detached3 \
244"