# HG changeset patch
# User Nick Wellnhofer <wellnhofer@aevum.de>
# Date 1667232451 -3600
#      Mon Oct 31 17:07:31 2022 +0100
# Node ID 9001c7f5542b7f9c44b14bb179167440fd5dbbef
# Parent  075286e51f9a6312927756af4357ad251062f717
gitlab-ci: Reenable MSan and LeakSanitizer

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,23 +24,22 @@
 
 clang:asan:
   extends: .test
+  tags:
+    - asan
   variables:
     CONFIG: "--without-python"
     CC: clang
     CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined,unsigned-integer-overflow,implicit-conversion -fno-sanitize-recover=all -Wno-error=cast-align"
-    # LeakSanitizer requires SYS_CAP_PTRACE
-    ASAN_OPTIONS: "detect_leaks=0"
     UBSAN_OPTIONS: "print_stacktrace=1"
+    ASAN_SYMBOLIZER_PATH: "$CI_PROJECT_DIR/.gitlab-ci/llvm-symbolizer"
 
-# Disabled, MSan seems broken on Ubntu 22.04
-.clang:msan:
+clang:msan:
   extends: .test
-  only:
-    - schedules
   variables:
     CONFIG: "--without-python --without-zlib --without-lzma --without-crypto"
     CC: clang
-    CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=memory -Wimplicit-int-conversion -Wno-error=cast-align"
+    CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=memory -Wno-error=cast-align"
+    MSAN_SYMBOLIZER_PATH: "$CI_PROJECT_DIR/.gitlab-ci/llvm-symbolizer"
 
 .mingw:
   tags:
diff --git a/.gitlab-ci/llvm-symbolizer b/.gitlab-ci/llvm-symbolizer
new file mode 100755
--- /dev/null
+++ b/.gitlab-ci/llvm-symbolizer
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Newer versions of llvm-symbolizer require libxml2 themselves. Running
+# a test program with LD_LIBRARY_PATH set to .libs makes llvm-symbolizer
+# pick up the tested development version of libxml2 which breaks
+# completely if the build is instrumented with ASan. This wrapper script
+# invokes llvm-symbolizer with an empty LD_LIBRARY_PATH.
+
+LD_LIBRARY_PATH='' llvm-symbolizer "$@"