Skip to content

Commit

Permalink
tests: Use nm and grep to check for ASAN
Browse files Browse the repository at this point in the history
clang doesn't link executables built with ASAN support to libasan, like
gcc does, so we have to use nm rather than ldd for checking for whether
the executable was built with ASAN. nm is part of the binutils package
and should be available on all systems where gcc was installed.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Sep 29, 2021
1 parent 3b16d81 commit c33b055
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/common
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,8 @@ function skip_test_linked_with_asan()
else
act_exe="${swtpm_exe}"
fi
if [ -n "$(ldd "${act_exe}" | grep libasan)" ]; then
echo "${act_exe} is linked with ASAN"
if [ -n "$(nm "${act_exe}" | grep __asan_)" ]; then
echo "${act_exe} is built with ASAN"
exit 77
fi
fi
Expand Down

0 comments on commit c33b055

Please sign in to comment.