1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00

Merge pull request #23257 from evverx/install-valgrind

tests: make it possible to install valgrind
This commit is contained in:
Yu Watanabe 2022-05-04 11:47:59 +09:00 committed by GitHub
commit e370edbefc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -752,17 +752,17 @@ install_valgrind() {
local valgrind_bins valgrind_libs valgrind_dbg_and_supp
valgrind_bins="$(strace -e execve valgrind /bin/true 2>&1 >/dev/null | perl -lne 'print $1 if /^execve\("([^"]+)"/')"
image_install "$valgrind_bins"
readarray -t valgrind_bins < <(strace -e execve valgrind /bin/true 2>&1 >/dev/null | perl -lne 'print $1 if /^execve\("([^"]+)"/')
image_install "${valgrind_bins[@]}"
valgrind_libs="$(LD_DEBUG=files valgrind /bin/true 2>&1 >/dev/null | perl -lne 'print $1 if m{calling init: (/.*vgpreload_.*)}')"
image_install "$valgrind_libs"
readarray -t valgrind_libs < <(LD_DEBUG=files valgrind /bin/true 2>&1 >/dev/null | perl -lne 'print $1 if m{calling init: (/.*vgpreload_.*)}')
image_install "${valgrind_libs[@]}"
valgrind_dbg_and_supp="$(
readarray -t valgrind_dbg_and_supp < <(
strace -e open valgrind /bin/true 2>&1 >/dev/null |
perl -lne 'if (my ($fname) = /^open\("([^"]+).*= (?!-)\d+/) { print $fname if $fname =~ /debug|\.supp$/ }'
)"
image_install "$valgrind_dbg_and_supp"
)
image_install "${valgrind_dbg_and_supp[@]}"
}
create_valgrind_wrapper() {
@ -772,7 +772,7 @@ create_valgrind_wrapper() {
#!/usr/bin/env bash
mount -t proc proc /proc
exec valgrind --leak-check=full --log-file=/valgrind.out $ROOTLIBDIR/systemd "\$@"
exec valgrind --leak-check=full --track-fds=yes --log-file=/valgrind.out $ROOTLIBDIR/systemd "\$@"
EOF
chmod 0755 "$valgrind_wrapper"
}