summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2022-06-15 19:43:11 +0200
committerFrantisek Sumsal <frantisek@sumsal.cz>2022-06-16 00:02:35 +0200
commitb727d7e02d6c88476ae9e46211e1f9c24720d5c3 (patch)
treed9471405df7a5f756b3d8c1283b84499dd567cf2 /test
parentfa65ba6baac8c9241cf30802bb5fd3698d1f3189 (diff)
downloadsystemd-b727d7e02d6c88476ae9e46211e1f9c24720d5c3.tar.gz
test: don't wrap binaries built with ASan
since they should handle loading other instrumented libraries without issues.
Diffstat (limited to 'test')
-rw-r--r--test/test-functions10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/test-functions b/test/test-functions
index 01cc063e12..6fe1e2762a 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -228,6 +228,8 @@ DEBUGTOOLS=(
)
is_built_with_asan() {
+ local _bin="${1:?}"
+
if ! type -P objdump >/dev/null; then
ddebug "Failed to find objdump. Assuming systemd hasn't been built with ASAN."
return 1
@@ -235,7 +237,7 @@ is_built_with_asan() {
# Borrowed from https://github.com/google/oss-fuzz/blob/cd9acd02f9d3f6e80011cc1e9549be526ce5f270/infra/base-images/base-runner/bad_build_check#L182
local _asan_calls
- _asan_calls="$(objdump -dC "$SYSTEMD_JOURNALD" | grep -E "(callq?|brasl?|bl)\s.+__asan" -c)"
+ _asan_calls="$(objdump -dC "$_bin" | grep -E "(callq?|brasl?|bl)\s.+__asan" -c)"
if ((_asan_calls < 1000)); then
return 1
else
@@ -251,7 +253,7 @@ is_built_with_coverage() {
meson configure "${BUILD_DIR:?}" | grep 'b_coverage' | awk '{ print $2 }' | grep -q 'true'
}
-IS_BUILT_WITH_ASAN=$(is_built_with_asan && echo yes || echo no)
+IS_BUILT_WITH_ASAN=$(is_built_with_asan "$SYSTEMD_JOURNALD" && echo yes || echo no)
IS_BUILT_WITH_COVERAGE=$(is_built_with_coverage && echo yes || echo no)
if get_bool "$IS_BUILT_WITH_ASAN"; then
@@ -2429,7 +2431,9 @@ inst_binary() {
wrap_binary=1
fi
- if get_bool "$wrap_binary"; then
+ # If the target binary is built with ASan support, we don't need to wrap
+ # it, as it should handle everything by itself
+ if get_bool "$wrap_binary" && ! is_built_with_asan "$bin"; then
dinfo "Creating ASan-compatible wrapper for binary '$target'"
# Install the target binary with a ".orig" suffix
inst_simple "$bin" "${target}.orig"