1
0
mirror of https://github.com/systemd/systemd.git synced 2025-08-24 09:49:49 +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

View File

@ -752,17 +752,17 @@ install_valgrind() {
local valgrind_bins valgrind_libs valgrind_dbg_and_supp 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\("([^"]+)"/')" readarray -t valgrind_bins < <(strace -e execve valgrind /bin/true 2>&1 >/dev/null | perl -lne 'print $1 if /^execve\("([^"]+)"/')
image_install "$valgrind_bins" 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_.*)}')" 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" image_install "${valgrind_libs[@]}"
valgrind_dbg_and_supp="$( readarray -t valgrind_dbg_and_supp < <(
strace -e open valgrind /bin/true 2>&1 >/dev/null | strace -e open valgrind /bin/true 2>&1 >/dev/null |
perl -lne 'if (my ($fname) = /^open\("([^"]+).*= (?!-)\d+/) { print $fname if $fname =~ /debug|\.supp$/ }' 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() { create_valgrind_wrapper() {
@ -772,7 +772,7 @@ create_valgrind_wrapper() {
#!/usr/bin/env bash #!/usr/bin/env bash
mount -t proc proc /proc 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 EOF
chmod 0755 "$valgrind_wrapper" chmod 0755 "$valgrind_wrapper"
} }