[v2,3/3] ci: run unit tests with ASAN

Message ID 20211002162432.4348-4-david.marchand@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: David Marchand
Headers
Series Experiment ASAN in GHA |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/github-robot: build fail github build: failed
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing fail Testing issues
ci/iol-x86_64-compile-testing fail Testing issues
ci/Intel-compilation warning apply issues

Commit Message

David Marchand Oct. 2, 2021, 4:24 p.m. UTC
  Enable ASAN for clang jobs.
This can greatly help identify leaks and buffer overflows.
This patch is more a fyi, as some unit tests stil have issues.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 .ci/linux-build.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
  

Comments

Aaron Conole Oct. 5, 2021, noon UTC | #1
David Marchand <david.marchand@redhat.com> writes:

> Enable ASAN for clang jobs.
> This can greatly help identify leaks and buffer overflows.
> This patch is more a fyi, as some unit tests stil have issues.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

I know this isn't yet ready to be merged due to failing unit tests, and
I still support it :)

Acked-by: Aaron Conole <aconole@redhat.com>

>  .ci/linux-build.sh | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
> index 91e43a975b..a961d9b92d 100755
> --- a/.ci/linux-build.sh
> +++ b/.ci/linux-build.sh
> @@ -79,7 +79,14 @@ fi
>  
>  OPTS="$OPTS -Dmachine=default"
>  OPTS="$OPTS --default-library=$DEF_LIB"
> -OPTS="$OPTS --buildtype=debugoptimized"
> +
> +if [ "$CC" != "${CC%%clang}" ] && [ "$RUN_TESTS" = 'true' ]; then
> +    # Let's run tests with ASAN
> +    OPTS="$OPTS -Db_sanitize=address -Db_lundef=false --buildtype=debug"
> +else
> +    OPTS="$OPTS --buildtype=debugoptimized"
> +fi
> +
>  OPTS="$OPTS -Dcheck_includes=true"
>  meson build --werror $OPTS
>  ninja -C build
  

Patch

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 91e43a975b..a961d9b92d 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -79,7 +79,14 @@  fi
 
 OPTS="$OPTS -Dmachine=default"
 OPTS="$OPTS --default-library=$DEF_LIB"
-OPTS="$OPTS --buildtype=debugoptimized"
+
+if [ "$CC" != "${CC%%clang}" ] && [ "$RUN_TESTS" = 'true' ]; then
+    # Let's run tests with ASAN
+    OPTS="$OPTS -Db_sanitize=address -Db_lundef=false --buildtype=debug"
+else
+    OPTS="$OPTS --buildtype=debugoptimized"
+fi
+
 OPTS="$OPTS -Dcheck_includes=true"
 meson build --werror $OPTS
 ninja -C build