Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 1 | SUMMARY = "Valgrind memory debugger and instrumentation framework" |
| 2 | HOMEPAGE = "http://valgrind.org/" |
| 3 | DESCRIPTION = "Valgrind is an instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail." |
| 4 | BUGTRACKER = "http://valgrind.org/support/bug_reports.html" |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 5 | LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause" |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ |
| 7 | file://include/pub_tool_basics.h;beginline=6;endline=29;md5=41c410e8d3f305aee7aaa666b2e4f366 \ |
| 8 | file://include/valgrind.h;beginline=1;endline=56;md5=ad3b317f3286b6b704575d9efe6ca5df \ |
| 9 | file://COPYING.DOCS;md5=24ea4c7092233849b4394699333b5c56" |
| 10 | |
| 11 | DEPENDS = " \ |
| 12 | ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'boost', '', d)} \ |
| 13 | " |
| 14 | |
| 15 | SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \ |
| 16 | file://fixed-perl-path.patch \ |
| 17 | file://Added-support-for-PPC-instructions-mfatbu-mfatbl.patch \ |
| 18 | file://run-ptest \ |
| 19 | file://remove-for-aarch64 \ |
| 20 | file://remove-for-all \ |
| 21 | file://taskset_nondeterministic_tests \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 22 | file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 23 | file://use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch \ |
| 24 | file://avoid-neon-for-targets-which-don-t-support-it.patch \ |
| 25 | file://valgrind-make-ld-XXX.so-strlen-intercept-optional.patch \ |
| 26 | file://0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 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 \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 30 | file://0001-memcheck-arm64-Define-__THROW-if-not-already-defined.patch \ |
| 31 | file://0002-memcheck-x86-Define-__THROW-if-not-defined.patch \ |
| 32 | file://0003-tests-seg_override-Replace-__modify_ldt-with-syscall.patch \ |
| 33 | file://0001-fix-opcode-not-supported-on-mips32-linux.patch \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 34 | file://0001-Make-local-functions-static-to-avoid-assembler-error.patch \ |
| 35 | file://0001-Return-a-valid-exit_code-from-vg_regtest.patch \ |
| 36 | file://0001-valgrind-filter_xml_frames-do-not-filter-usr.patch \ |
| 37 | file://0001-memcheck-vgtests-remove-fullpath-after-flags.patch \ |
| 38 | file://s390x_vec_op_t.patch \ |
| 39 | file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \ |
| 40 | file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 41 | file://0001-docs-Disable-manual-validation.patch \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 42 | " |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 43 | SRC_URI[sha256sum] = "8536c031dbe078d342f121fa881a9ecd205cb5a78e639005ad570011bdb9f3c6" |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 44 | UPSTREAM_CHECK_REGEX = "valgrind-(?P<pver>\d+(\.\d+)+)\.tar" |
| 45 | |
| 46 | COMPATIBLE_HOST = '(i.86|x86_64|arm|aarch64|mips|powerpc|powerpc64).*-linux' |
| 47 | |
| 48 | # patch 0001-memcheck-vgtests-remove-fullpath-after-flags.patch removes relative path |
| 49 | # argument. Change expected stderr files accordingly. |
| 50 | do_patch:append() { |
| 51 | bb.build.exec_func('do_sed_paths', d) |
| 52 | } |
| 53 | |
| 54 | do_sed_paths() { |
| 55 | sed -i -e 's|tests/||' ${S}/memcheck/tests/badfree3.stderr.exp |
| 56 | sed -i -e 's|tests/||' ${S}/memcheck/tests/varinfo5.stderr.exp |
| 57 | } |
| 58 | |
| 59 | # valgrind supports armv7 and above |
| 60 | COMPATIBLE_HOST:armv4 = 'null' |
| 61 | COMPATIBLE_HOST:armv5 = 'null' |
| 62 | COMPATIBLE_HOST:armv6 = 'null' |
| 63 | |
| 64 | # valgrind fails with powerpc soft-float |
| 65 | COMPATIBLE_HOST:powerpc = "${@bb.utils.contains('TARGET_FPU', 'soft', 'null', '.*-linux', d)}" |
| 66 | |
| 67 | # X32 isn't supported by valgrind at this time |
| 68 | COMPATIBLE_HOST:linux-gnux32 = 'null' |
| 69 | COMPATIBLE_HOST:linux-muslx32 = 'null' |
| 70 | |
| 71 | # Disable for some MIPS variants |
| 72 | COMPATIBLE_HOST:mipsarchr6 = 'null' |
| 73 | COMPATIBLE_HOST:linux-gnun32 = 'null' |
| 74 | |
| 75 | # Disable for powerpc64 with musl |
| 76 | COMPATIBLE_HOST:libc-musl:powerpc64 = 'null' |
| 77 | |
| 78 | # brokenseip is unfortunately required by ptests to pass |
| 79 | inherit autotools-brokensep ptest multilib_header |
| 80 | |
| 81 | EXTRA_OECONF = "--enable-tls --without-mpicc" |
| 82 | EXTRA_OECONF += "${@['--enable-only32bit','--enable-only64bit'][d.getVar('SITEINFO_BITS') != '32']}" |
| 83 | |
| 84 | # valgrind checks host_cpu "armv7*)", so we need to over-ride the autotools.bbclass default --host option |
| 85 | EXTRA_OECONF:append:arm = " --host=armv7${HOST_VENDOR}-${HOST_OS}" |
| 86 | |
| 87 | EXTRA_OEMAKE = "-w" |
| 88 | |
| 89 | CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'" |
| 90 | |
| 91 | # valgrind likes to control its own optimisation flags. It generally defaults |
| 92 | # to -O2 but uses -O0 for some specific test apps etc. Passing our own flags |
| 93 | # (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it |
| 94 | # which fixes build path issue in DWARF. |
| 95 | SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}" |
| 96 | |
| 97 | do_configure:prepend () { |
| 98 | rm -rf ${S}/config.h |
| 99 | sed -i -e 's:$(abs_top_builddir):$(pkglibdir)/ptest:g' ${S}/none/tests/Makefile.am |
| 100 | sed -i -e 's:$(top_builddir):$(pkglibdir)/ptest:g' ${S}/memcheck/tests/Makefile.am |
| 101 | } |
| 102 | |
| 103 | do_install:append () { |
| 104 | install -m 644 ${B}/default.supp ${D}/${libexecdir}/valgrind/ |
| 105 | oe_multilib_header valgrind/config.h |
| 106 | } |
| 107 | |
| 108 | VALGRINDARCH ?= "${TARGET_ARCH}" |
| 109 | VALGRINDARCH:aarch64 = "arm64" |
| 110 | VALGRINDARCH:x86-64 = "amd64" |
| 111 | VALGRINDARCH:x86 = "x86" |
| 112 | VALGRINDARCH:mips = "mips32" |
| 113 | VALGRINDARCH:mipsel = "mips32" |
| 114 | VALGRINDARCH:mips64el = "mips64" |
| 115 | VALGRINDARCH:powerpc = "ppc" |
| 116 | VALGRINDARCH:powerpc64 = "ppc64" |
| 117 | VALGRINDARCH:powerpc64le = "ppc64le" |
| 118 | |
| 119 | INHIBIT_PACKAGE_STRIP_FILES = "${PKGD}${libexecdir}/valgrind/vgpreload_memcheck-${VALGRINDARCH}-linux.so" |
| 120 | |
| 121 | RDEPENDS:${PN} += "perl" |
| 122 | |
| 123 | # valgrind needs debug information for ld.so at runtime in order to |
| 124 | # redirect functions like strlen. |
| 125 | RRECOMMENDS:${PN} += "${TCLIBC}-dbg" |
| 126 | |
| 127 | RDEPENDS:${PN}-ptest += " bash coreutils curl file \ |
| 128 | gdb libgomp \ |
| 129 | perl \ |
| 130 | perl-module-file-basename perl-module-file-glob perl-module-getopt-long \ |
| 131 | perl-module-overloading perl-module-cwd perl-module-ipc-open3 \ |
| 132 | perl-module-carp perl-module-symbol \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 133 | procps sed ${PN}-dbg ${PN}-src ${TCLIBC}-src gcc-runtime-dbg \ |
| 134 | util-linux-taskset" |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [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() { |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 143 | oe_runmake check |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 144 | } |
| 145 | |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 146 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 147 | do_install_ptest() { |
| 148 | chmod +x ${B}/tests/vg_regtest |
| 149 | |
| 150 | # The test application binaries are not automatically installed. |
| 151 | # Grab them from the build directory. |
| 152 | # |
| 153 | # The regression tests require scripts and data files that are not |
| 154 | # copied to the build directory. They must be copied from the |
| 155 | # source directory. |
| 156 | saved_dir=$PWD |
| 157 | for parent_dir in ${S} ${B} ; do |
| 158 | cd $parent_dir |
| 159 | |
| 160 | subdirs=" \ |
| 161 | .in_place \ |
| 162 | cachegrind/tests \ |
| 163 | callgrind/tests \ |
| 164 | dhat/tests \ |
| 165 | drd/tests \ |
| 166 | gdbserver_tests \ |
| 167 | helgrind/tests \ |
| 168 | lackey/tests \ |
| 169 | massif/tests \ |
| 170 | memcheck/tests \ |
| 171 | none/tests \ |
| 172 | tests \ |
| 173 | exp-bbv/tests \ |
| 174 | " |
| 175 | # Get the vg test scripts, filters, and expected files |
| 176 | for dir in $subdirs ; do |
| 177 | find $dir | cpio -pvdu ${D}${PTEST_PATH} |
| 178 | done |
| 179 | cd $saved_dir |
| 180 | done |
| 181 | |
| 182 | # The scripts reference config.h so add it to the top ptest dir. |
| 183 | cp ${B}/config.h ${D}${PTEST_PATH} |
| 184 | install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH} |
| 185 | install -D ${WORKDIR}/remove-for-all ${D}${PTEST_PATH} |
| 186 | install -D ${WORKDIR}/taskset_nondeterministic_tests ${D}${PTEST_PATH} |
| 187 | |
| 188 | # Add an executable need by none/tests/bigcode |
| 189 | mkdir ${D}${PTEST_PATH}/perf |
| 190 | cp ${B}/perf/bigcode ${D}${PTEST_PATH}/perf |
| 191 | |
| 192 | # Add an executable needed by memcheck/tests/vcpu_bz2 |
| 193 | cp ${B}/perf/bz2 ${D}${PTEST_PATH}/perf |
| 194 | |
| 195 | # Make the ptest dir look like the top level valgrind src dir |
| 196 | # This is checked by the gdbserver_tests/make_local_links script |
| 197 | mkdir ${D}${PTEST_PATH}/coregrind |
| 198 | cp ${B}/coregrind/vgdb ${D}${PTEST_PATH}/coregrind |
| 199 | |
| 200 | # Add an executable needed by massif tests |
| 201 | cp ${B}/massif/ms_print ${D}${PTEST_PATH}/massif/ms_print |
| 202 | |
| 203 | find ${D}${PTEST_PATH} \ |
| 204 | \( \ |
| 205 | -name "Makefile*" \ |
| 206 | -o -name "*.o" \ |
| 207 | \) \ |
| 208 | -exec rm {} \; |
| 209 | |
| 210 | # These files need to be newer so touch them. |
| 211 | touch ${D}${PTEST_PATH}/cachegrind/tests/a.c -r ${D}${PTEST_PATH}/cachegrind/tests/cgout-test |
| 212 | |
| 213 | # find *_annotate in ${bindir} for yocto build |
| 214 | sed -i s:\.\./\.\./cachegrind/cg_annotate:${bindir}/cg_annotate: ${D}${PTEST_PATH}/cachegrind/tests/ann1.vgtest |
| 215 | sed -i s:\.\./\.\./cachegrind/cg_annotate:${bindir}/cg_annotate: ${D}${PTEST_PATH}/cachegrind/tests/ann2.vgtest |
| 216 | |
| 217 | sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann1.vgtest |
| 218 | sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann2.vgtest |
| 219 | |
| 220 | # point the expanded @abs_top_builddir@ of the host to PTEST_PATH |
| 221 | sed -i s:${S}:${PTEST_PATH}:g \ |
| 222 | ${D}${PTEST_PATH}/memcheck/tests/linux/debuginfod-check.vgtest |
| 223 | |
| 224 | # handle multilib |
| 225 | sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest |
| 226 | sed -i s:@libexecdir@:${libexecdir}:g ${D}${PTEST_PATH}/run-ptest |
| 227 | sed -i s:@bindir@:${bindir}:g ${D}${PTEST_PATH}/run-ptest |
| 228 | |
| 229 | # This test fails on the host as well, using both 3.15 and git master (as of Jan 24 2020) |
| 230 | # https://bugs.kde.org/show_bug.cgi?id=402833 |
| 231 | rm ${D}${PTEST_PATH}/memcheck/tests/overlap.vgtest |
| 232 | |
| 233 | # This is known failure see https://bugs.kde.org/show_bug.cgi?id=435732 |
| 234 | rm ${D}${PTEST_PATH}/memcheck/tests/leak_cpp_interior.vgtest |
| 235 | |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 236 | # https://bugs.kde.org/show_bug.cgi?id=445743 |
| 237 | rm ${D}${PTEST_PATH}/drd/tests/pth_mutex_signal |
| 238 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 239 | # As the binary isn't stripped or debug-splitted, the source file isn't fetched |
| 240 | # via dwarfsrcfiles either, so it needs to be installed manually. |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 241 | mkdir -p ${D}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/none/tests/ |
| 242 | install ${S}/none/tests/tls.c ${D}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/none/tests/ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | # avoid stripping some generated binaries otherwise some of the tests will fail |
| 246 | # run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail |
| 247 | INHIBIT_PACKAGE_STRIP_FILES += "\ |
| 248 | ${PKGD}${PTEST_PATH}/none/tests/tls \ |
| 249 | ${PKGD}${PTEST_PATH}/none/tests/tls.so \ |
| 250 | ${PKGD}${PTEST_PATH}/none/tests/tls2.so \ |
| 251 | ${PKGD}${PTEST_PATH}/helgrind/tests/tc09_bad_unlock \ |
| 252 | ${PKGD}${PTEST_PATH}/memcheck/tests/manuel1 \ |
| 253 | ${PKGD}${PTEST_PATH}/drd/tests/pth_detached3 \ |
| 254 | " |