blob: 63f972945d482c75ac7260f4a8a16fb0ae36573b [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 \
6 file://include/pub_tool_basics.h;beginline=6;endline=29;md5=d4de0407239381463cf01dd276d7c22e \
7 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 \
30 file://0004-pth_atfork1.c-Define-error-API-for-musl.patch \
31 file://0005-tc20_verifywrap.c-Fake-__GLIBC_PREREQ-with-musl.patch \
32 file://0006-pth_detached3.c-Dereference-pthread_t-before-adding-.patch \
33 file://0001-memcheck-arm64-Define-__THROW-if-not-already-defined.patch \
34 file://0002-memcheck-x86-Define-__THROW-if-not-defined.patch \
35 file://0003-tests-seg_override-Replace-__modify_ldt-with-syscall.patch \
36 file://0001-fix-opcode-not-supported-on-mips32-linux.patch \
37 file://0001-Guard-against-__GLIBC_PREREQ-for-musl-libc.patch \
38 file://0001-Make-local-functions-static-to-avoid-assembler-error.patch \
39 file://0001-Return-a-valid-exit_code-from-vg_regtest.patch \
40 file://0001-valgrind-filter_xml_frames-do-not-filter-usr.patch \
41 file://0002-valgrind-adjust-std_list-expected-output.patch \
Brad Bishopa34c0302019-09-23 22:34:48 -040042 file://0001-adjust-path-filter-for-2-memcheck-tests.patch \
Brad Bishopc342db32019-05-15 21:57:59 -040043 "
44SRC_URI[md5sum] = "46e5fbdcbc3502a5976a317a0860a975"
45SRC_URI[sha256sum] = "417c7a9da8f60dd05698b3a7bc6002e4ef996f14c13f0ff96679a16873e78ab1"
46UPSTREAM_CHECK_REGEX = "valgrind-(?P<pver>\d+(\.\d+)+)\.tar"
47
48COMPATIBLE_HOST = '(i.86|x86_64|arm|aarch64|mips|powerpc|powerpc64).*-linux'
49
50# valgrind supports armv7 and above
51COMPATIBLE_HOST_armv4 = 'null'
52COMPATIBLE_HOST_armv5 = 'null'
53COMPATIBLE_HOST_armv6 = 'null'
54
55# X32 isn't supported by valgrind at this time
56COMPATIBLE_HOST_linux-gnux32 = 'null'
57COMPATIBLE_HOST_linux-muslx32 = 'null'
58
59# Disable for some MIPS variants
60COMPATIBLE_HOST_mipsarchr6 = 'null'
61COMPATIBLE_HOST_linux-gnun32 = 'null'
62
63# Disable for powerpc64 with musl
64COMPATIBLE_HOST_libc-musl_powerpc64 = 'null'
65
66inherit autotools ptest multilib_header
67
68EXTRA_OECONF = "--enable-tls --without-mpicc"
69EXTRA_OECONF += "${@['--enable-only32bit','--enable-only64bit'][d.getVar('SITEINFO_BITS') != '32']}"
70
71# valgrind checks host_cpu "armv7*)", so we need to over-ride the autotools.bbclass default --host option
72EXTRA_OECONF_append_arm = " --host=armv7${HOST_VENDOR}-${HOST_OS}"
73
74EXTRA_OEMAKE = "-w"
75
76CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
77
78# valgrind likes to control its own optimisation flags. It generally defaults
79# to -O2 but uses -O0 for some specific test apps etc. Passing our own flags
80# (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it
81# which fixes build path issue in DWARF.
82SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}"
83
84do_configure_prepend () {
85 rm -rf ${S}/config.h
86 sed -i -e 's:$(abs_top_builddir):$(pkglibdir)/ptest:g' ${S}/none/tests/Makefile.am
87 sed -i -e 's:$(top_builddir):$(pkglibdir)/ptest:g' ${S}/memcheck/tests/Makefile.am
88}
89
90do_install_append () {
91 install -m 644 ${B}/default.supp ${D}/${libdir}/valgrind/
92 oe_multilib_header valgrind/config.h
93}
94
95VALGRINDARCH ?= "${TARGET_ARCH}"
96VALGRINDARCH_aarch64 = "arm64"
97VALGRINDARCH_x86-64 = "amd64"
98VALGRINDARCH_x86 = "x86"
99VALGRINDARCH_mips = "mips32"
100VALGRINDARCH_mipsel = "mips32"
101VALGRINDARCH_mips64el = "mips64"
102VALGRINDARCH_powerpc = "ppc"
103VALGRINDARCH_powerpc64 = "ppc64"
104VALGRINDARCH_powerpc64el = "ppc64le"
105
106INHIBIT_PACKAGE_STRIP_FILES = "${PKGD}${libdir}/valgrind/vgpreload_memcheck-${VALGRINDARCH}-linux.so"
107
108RDEPENDS_${PN} += "perl"
109
110# valgrind needs debug information for ld.so at runtime in order to
111# redirect functions like strlen.
112RRECOMMENDS_${PN} += "${TCLIBC}-dbg"
113
Brad Bishopa34c0302019-09-23 22:34:48 -0400114RDEPENDS_${PN}-ptest += " bash coreutils file \
115 gdb libgomp \
116 perl \
117 perl-module-getopt-long perl-module-file-basename perl-module-file-glob \
118 procps sed ${PN}-dbg"
Brad Bishopc342db32019-05-15 21:57:59 -0400119RDEPENDS_${PN}-ptest_append_libc-glibc = " glibc-utils"
120
121# One of the tests contains a bogus interpreter path on purpose.
122# Skip file dependency check
123SKIP_FILEDEPS_${PN}-ptest = '1'
124INSANE_SKIP_${PN}-ptest = "debug-deps"
125
126do_compile_ptest() {
127 oe_runmake check
128}
129
130do_install_ptest() {
131 chmod +x ${B}/tests/vg_regtest
132
133 # The test application binaries are not automatically installed.
134 # Grab them from the build directory.
135 #
136 # The regression tests require scripts and data files that are not
137 # copied to the build directory. They must be copied from the
138 # source directory.
139 saved_dir=$PWD
140 for parent_dir in ${S} ${B} ; do
141 cd $parent_dir
142
Brad Bishopc342db32019-05-15 21:57:59 -0400143 subdirs=" \
Brad Bishopa34c0302019-09-23 22:34:48 -0400144 .in_place \
Brad Bishopc342db32019-05-15 21:57:59 -0400145 cachegrind/tests \
146 callgrind/tests \
Brad Bishopa34c0302019-09-23 22:34:48 -0400147 dhat/tests \
Brad Bishopc342db32019-05-15 21:57:59 -0400148 drd/tests \
149 gdbserver_tests \
150 helgrind/tests \
Brad Bishopa34c0302019-09-23 22:34:48 -0400151 lackey/tests \
Brad Bishopc342db32019-05-15 21:57:59 -0400152 massif/tests \
153 memcheck/tests \
154 none/tests \
155 tests \
Brad Bishopa34c0302019-09-23 22:34:48 -0400156 exp-bbv/tests \
157 exp-dhat/tests \
158 exp-sgcheck/tests \
Brad Bishopc342db32019-05-15 21:57:59 -0400159 "
Brad Bishopc342db32019-05-15 21:57:59 -0400160 # Get the vg test scripts, filters, and expected files
161 for dir in $subdirs ; do
162 find $dir | cpio -pvdu ${D}${PTEST_PATH}
163 done
164 cd $saved_dir
165 done
166
Brad Bishopa34c0302019-09-23 22:34:48 -0400167 # The scripts reference config.h so add it to the top ptest dir.
168 cp ${B}/config.h ${D}${PTEST_PATH}
169 install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH}
170
171 # Add an executable need by none/tests/bigcode
172 mkdir ${D}${PTEST_PATH}/perf
173 cp ${B}/perf/bigcode ${D}${PTEST_PATH}/perf
174
175 # Add an executable needed by memcheck/tests/vcpu_bz2
176 cp ${B}/perf/bz2 ${D}${PTEST_PATH}/perf
177
178 # Make the ptest dir look like the top level valgrind src dir
179 # This is checked by the gdbserver_tests/make_local_links script
180 mkdir ${D}${PTEST_PATH}/coregrind
181 cp ${B}/coregrind/vgdb ${D}${PTEST_PATH}/coregrind
182
183 # Add an executable needed by massif tests
184 cp ${B}/massif/ms_print ${D}${PTEST_PATH}/massif/ms_print
185
Brad Bishopc342db32019-05-15 21:57:59 -0400186 find ${D}${PTEST_PATH} \
Brad Bishopa34c0302019-09-23 22:34:48 -0400187 \( \
188 -name "Makefile*" \
Brad Bishopc342db32019-05-15 21:57:59 -0400189 -o -name "*.o" \
Brad Bishopa34c0302019-09-23 22:34:48 -0400190 \) \
Brad Bishopc342db32019-05-15 21:57:59 -0400191 -exec rm {} \;
Brad Bishopa34c0302019-09-23 22:34:48 -0400192
193 # These files need to be newer so touch them.
Brad Bishop15ae2502019-06-18 21:44:24 -0400194 touch ${D}${PTEST_PATH}/cachegrind/tests/a.c -r ${D}${PTEST_PATH}/cachegrind/tests/cgout-test
Brad Bishopc342db32019-05-15 21:57:59 -0400195
196 # find *_annotate in ${bindir} for yocto build
197 sed -i s:\.\./\.\./cachegrind/cg_annotate:${bindir}/cg_annotate: ${D}${PTEST_PATH}/cachegrind/tests/ann1.vgtest
198 sed -i s:\.\./\.\./cachegrind/cg_annotate:${bindir}/cg_annotate: ${D}${PTEST_PATH}/cachegrind/tests/ann2.vgtest
199
200 sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann1.vgtest
201 sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann2.vgtest
202
Brad Bishopc342db32019-05-15 21:57:59 -0400203 # handle multilib
204 sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest
Brad Bishopa34c0302019-09-23 22:34:48 -0400205 sed -i s:@bindir@:${bindir}:g ${D}${PTEST_PATH}/run-ptest
Brad Bishopc342db32019-05-15 21:57:59 -0400206}