]> git.proxmox.com Git - swtpm.git/commitdiff
tests: Use nm and grep to check for ASAN
authorStefan Berger <stefanb@linux.ibm.com>
Wed, 29 Sep 2021 16:35:58 +0000 (12:35 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Wed, 29 Sep 2021 18:57:38 +0000 (14:57 -0400)
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>
tests/common

index 7d32fd7dba9418f2126fd3ff0060245dc946f9de..8e85448a8f64628280fde607c91f8abdd78c8496 100644 (file)
@@ -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