Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | SUMMARY = "Valgrind memory debugger and instrumentation framework" |
| 2 | HOMEPAGE = "http://valgrind.org/" |
| 3 | BUGTRACKER = "http://valgrind.org/support/bug_reports.html" |
| 4 | LICENSE = "GPLv2 & GPLv2+ & BSD" |
| 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ |
Andrew Geissler | 4ed12e1 | 2020-06-05 18:00:41 -0500 | [diff] [blame] | 6 | file://include/pub_tool_basics.h;beginline=6;endline=29;md5=41c410e8d3f305aee7aaa666b2e4f366 \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 7 | file://include/valgrind.h;beginline=1;endline=56;md5=ad3b317f3286b6b704575d9efe6ca5df \ |
| 8 | file://COPYING.DOCS;md5=24ea4c7092233849b4394699333b5c56" |
| 9 | |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 10 | DEPENDS = " \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 11 | ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'boost', '', d)} \ |
| 12 | " |
| 13 | |
| 14 | SRC_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 Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 18 | file://remove-for-aarch64 \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 19 | 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 Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 30 | file://0005-tc20_verifywrap.c-Fake-__GLIBC_PREREQ-with-musl.patch \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 31 | 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 Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 39 | file://0001-memcheck-vgtests-remove-fullpath-after-flags.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 40 | file://s390x_vec_op_t.patch \ |
| 41 | file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 42 | file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 43 | " |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 44 | SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589" |
| 45 | SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 46 | UPSTREAM_CHECK_REGEX = "valgrind-(?P<pver>\d+(\.\d+)+)\.tar" |
| 47 | |
| 48 | COMPATIBLE_HOST = '(i.86|x86_64|arm|aarch64|mips|powerpc|powerpc64).*-linux' |
| 49 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 50 | # patch 0001-memcheck-vgtests-remove-fullpath-after-flags.patch removes relative path |
| 51 | # argument. Change expected stderr files accordingly. |
| 52 | do_patch_append() { |
| 53 | bb.build.exec_func('do_sed_paths', d) |
| 54 | } |
| 55 | |
| 56 | do_sed_paths() { |
| 57 | sed -i -e 's|tests/||' ${S}/memcheck/tests/badfree3.stderr.exp |
| 58 | sed -i -e 's|tests/||' ${S}/memcheck/tests/varinfo5.stderr.exp |
| 59 | } |
| 60 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 61 | # valgrind supports armv7 and above |
| 62 | COMPATIBLE_HOST_armv4 = 'null' |
| 63 | COMPATIBLE_HOST_armv5 = 'null' |
| 64 | COMPATIBLE_HOST_armv6 = 'null' |
| 65 | |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 66 | # valgrind fails with powerpc soft-float |
| 67 | COMPATIBLE_HOST_powerpc = "${@bb.utils.contains('TARGET_FPU', 'soft', 'null', '.*-linux', d)}" |
| 68 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 69 | # X32 isn't supported by valgrind at this time |
| 70 | COMPATIBLE_HOST_linux-gnux32 = 'null' |
| 71 | COMPATIBLE_HOST_linux-muslx32 = 'null' |
| 72 | |
| 73 | # Disable for some MIPS variants |
| 74 | COMPATIBLE_HOST_mipsarchr6 = 'null' |
| 75 | COMPATIBLE_HOST_linux-gnun32 = 'null' |
| 76 | |
| 77 | # Disable for powerpc64 with musl |
| 78 | COMPATIBLE_HOST_libc-musl_powerpc64 = 'null' |
| 79 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 80 | # brokenseip is unfortunately required by ptests to pass |
| 81 | inherit autotools-brokensep ptest multilib_header |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 82 | |
| 83 | EXTRA_OECONF = "--enable-tls --without-mpicc" |
| 84 | EXTRA_OECONF += "${@['--enable-only32bit','--enable-only64bit'][d.getVar('SITEINFO_BITS') != '32']}" |
| 85 | |
| 86 | # valgrind checks host_cpu "armv7*)", so we need to over-ride the autotools.bbclass default --host option |
| 87 | EXTRA_OECONF_append_arm = " --host=armv7${HOST_VENDOR}-${HOST_OS}" |
| 88 | |
| 89 | EXTRA_OEMAKE = "-w" |
| 90 | |
| 91 | CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'" |
| 92 | |
| 93 | # valgrind likes to control its own optimisation flags. It generally defaults |
| 94 | # to -O2 but uses -O0 for some specific test apps etc. Passing our own flags |
| 95 | # (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it |
| 96 | # which fixes build path issue in DWARF. |
| 97 | SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}" |
| 98 | |
| 99 | do_configure_prepend () { |
| 100 | rm -rf ${S}/config.h |
| 101 | sed -i -e 's:$(abs_top_builddir):$(pkglibdir)/ptest:g' ${S}/none/tests/Makefile.am |
| 102 | sed -i -e 's:$(top_builddir):$(pkglibdir)/ptest:g' ${S}/memcheck/tests/Makefile.am |
| 103 | } |
| 104 | |
| 105 | do_install_append () { |
| 106 | install -m 644 ${B}/default.supp ${D}/${libdir}/valgrind/ |
| 107 | oe_multilib_header valgrind/config.h |
| 108 | } |
| 109 | |
| 110 | VALGRINDARCH ?= "${TARGET_ARCH}" |
| 111 | VALGRINDARCH_aarch64 = "arm64" |
| 112 | VALGRINDARCH_x86-64 = "amd64" |
| 113 | VALGRINDARCH_x86 = "x86" |
| 114 | VALGRINDARCH_mips = "mips32" |
| 115 | VALGRINDARCH_mipsel = "mips32" |
| 116 | VALGRINDARCH_mips64el = "mips64" |
| 117 | VALGRINDARCH_powerpc = "ppc" |
| 118 | VALGRINDARCH_powerpc64 = "ppc64" |
| 119 | VALGRINDARCH_powerpc64el = "ppc64le" |
| 120 | |
| 121 | INHIBIT_PACKAGE_STRIP_FILES = "${PKGD}${libdir}/valgrind/vgpreload_memcheck-${VALGRINDARCH}-linux.so" |
| 122 | |
| 123 | RDEPENDS_${PN} += "perl" |
| 124 | |
| 125 | # valgrind needs debug information for ld.so at runtime in order to |
| 126 | # redirect functions like strlen. |
| 127 | RRECOMMENDS_${PN} += "${TCLIBC}-dbg" |
| 128 | |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 129 | RDEPENDS_${PN}-ptest += " bash coreutils file \ |
| 130 | gdb libgomp \ |
| 131 | perl \ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 132 | perl-module-file-basename perl-module-file-glob perl-module-getopt-long \ |
| 133 | perl-module-overloading \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 134 | procps sed ${PN}-dbg ${PN}-src" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 135 | RDEPENDS_${PN}-ptest_append_libc-glibc = " glibc-utils" |
| 136 | |
| 137 | # One of the tests contains a bogus interpreter path on purpose. |
| 138 | # Skip file dependency check |
| 139 | SKIP_FILEDEPS_${PN}-ptest = '1' |
| 140 | INSANE_SKIP_${PN}-ptest = "debug-deps" |
| 141 | |
| 142 | do_compile_ptest() { |
| 143 | oe_runmake check |
| 144 | } |
| 145 | |
| 146 | do_install_ptest() { |
| 147 | chmod +x ${B}/tests/vg_regtest |
| 148 | |
| 149 | # The test application binaries are not automatically installed. |
| 150 | # Grab them from the build directory. |
| 151 | # |
| 152 | # The regression tests require scripts and data files that are not |
| 153 | # copied to the build directory. They must be copied from the |
| 154 | # source directory. |
| 155 | saved_dir=$PWD |
| 156 | for parent_dir in ${S} ${B} ; do |
| 157 | cd $parent_dir |
| 158 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 159 | subdirs=" \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 160 | .in_place \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 161 | cachegrind/tests \ |
| 162 | callgrind/tests \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 163 | dhat/tests \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 164 | drd/tests \ |
| 165 | gdbserver_tests \ |
| 166 | helgrind/tests \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 167 | lackey/tests \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 168 | massif/tests \ |
| 169 | memcheck/tests \ |
| 170 | none/tests \ |
| 171 | tests \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 172 | exp-bbv/tests \ |
| 173 | exp-dhat/tests \ |
| 174 | exp-sgcheck/tests \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 175 | " |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 176 | # Get the vg test scripts, filters, and expected files |
| 177 | for dir in $subdirs ; do |
| 178 | find $dir | cpio -pvdu ${D}${PTEST_PATH} |
| 179 | done |
| 180 | cd $saved_dir |
| 181 | done |
| 182 | |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 183 | # The scripts reference config.h so add it to the top ptest dir. |
| 184 | cp ${B}/config.h ${D}${PTEST_PATH} |
| 185 | install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH} |
| 186 | |
| 187 | # Add an executable need by none/tests/bigcode |
| 188 | mkdir ${D}${PTEST_PATH}/perf |
| 189 | cp ${B}/perf/bigcode ${D}${PTEST_PATH}/perf |
| 190 | |
| 191 | # Add an executable needed by memcheck/tests/vcpu_bz2 |
| 192 | cp ${B}/perf/bz2 ${D}${PTEST_PATH}/perf |
| 193 | |
| 194 | # Make the ptest dir look like the top level valgrind src dir |
| 195 | # This is checked by the gdbserver_tests/make_local_links script |
| 196 | mkdir ${D}${PTEST_PATH}/coregrind |
| 197 | cp ${B}/coregrind/vgdb ${D}${PTEST_PATH}/coregrind |
| 198 | |
| 199 | # Add an executable needed by massif tests |
| 200 | cp ${B}/massif/ms_print ${D}${PTEST_PATH}/massif/ms_print |
| 201 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 202 | find ${D}${PTEST_PATH} \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 203 | \( \ |
| 204 | -name "Makefile*" \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 205 | -o -name "*.o" \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 206 | \) \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 207 | -exec rm {} \; |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 208 | |
| 209 | # These files need to be newer so touch them. |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 210 | touch ${D}${PTEST_PATH}/cachegrind/tests/a.c -r ${D}${PTEST_PATH}/cachegrind/tests/cgout-test |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 211 | |
| 212 | # find *_annotate in ${bindir} for yocto build |
| 213 | sed -i s:\.\./\.\./cachegrind/cg_annotate:${bindir}/cg_annotate: ${D}${PTEST_PATH}/cachegrind/tests/ann1.vgtest |
| 214 | sed -i s:\.\./\.\./cachegrind/cg_annotate:${bindir}/cg_annotate: ${D}${PTEST_PATH}/cachegrind/tests/ann2.vgtest |
| 215 | |
| 216 | sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann1.vgtest |
| 217 | sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann2.vgtest |
| 218 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 219 | # handle multilib |
| 220 | sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 221 | sed -i s:@bindir@:${bindir}:g ${D}${PTEST_PATH}/run-ptest |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 222 | |
| 223 | # This test fails on the host as well, using both 3.15 and git master (as of Jan 24 2020) |
| 224 | # https://bugs.kde.org/show_bug.cgi?id=402833 |
| 225 | rm ${D}${PTEST_PATH}/memcheck/tests/overlap.vgtest |
| 226 | |
| 227 | # As the binary isn't stripped or debug-splitted, the source file isn't fetched |
| 228 | # via dwarfsrcfiles either, so it needs to be installed manually. |
| 229 | mkdir -p ${D}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/${BP}/none/tests/ |
| 230 | install ${S}/none/tests/tls.c ${D}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/${BP}/none/tests/ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 231 | } |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 232 | |
| 233 | # avoid stripping some generated binaries otherwise some of the tests will fail |
| 234 | # run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail |
| 235 | INHIBIT_PACKAGE_STRIP_FILES = "\ |
| 236 | ${PKGD}${PTEST_PATH}/none/tests/tls \ |
| 237 | ${PKGD}${PTEST_PATH}/none/tests/tls.so \ |
| 238 | ${PKGD}${PTEST_PATH}/none/tests/tls2.so \ |
| 239 | ${PKGD}${PTEST_PATH}/helgrind/tests/tc09_bad_unlock \ |
| 240 | ${PKGD}${PTEST_PATH}/memcheck/tests/manuel1 \ |
| 241 | ${PKGD}${PTEST_PATH}/drd/tests/pth_detached3 \ |
| 242 | " |