[PATCH] D37810: [test] Enable LeakSanitizer on 64-bit Darwin ASan clang builds

Francis Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 07:08:10 PDT 2017


fjricci created this revision.

Also disables leak checking on a few failing tests:

1. Known leak in openmp arg parsing introduced by r310282 and https://reviews.llvm.org/D34784
2. clang crash test, suspected failure due to LSan's atexit and exit interception behavior.


https://reviews.llvm.org/D37810

Files:
  test/Driver/openmp-offload-gpu.c
  test/Modules/crash-vfs-ivfsoverlay.m
  test/lit.cfg


Index: test/lit.cfg
===================================================================
--- test/lit.cfg
+++ test/lit.cfg
@@ -484,6 +484,9 @@
 # Sanitizers.
 if 'Address' in config.llvm_use_sanitizer:
     config.available_features.add("asan")
+    # LeakSanitizer is disabled by default on Darwin, enable it
+    if re.match(r'^x86_64-apple.*', config.target_triple):
+        config.environment['ASAN_OPTIONS'] = 'detect_leaks=1'
 else:
     config.available_features.add("not_asan")
 if 'Memory' in config.llvm_use_sanitizer:
Index: test/Modules/crash-vfs-ivfsoverlay.m
===================================================================
--- test/Modules/crash-vfs-ivfsoverlay.m
+++ test/Modules/crash-vfs-ivfsoverlay.m
@@ -7,6 +7,7 @@
 // RUN:   %S/../VFS/Inputs/vfsoverlay2.yaml > %t/srcvfs.yaml
 
 // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
+// RUN:         ASAN_OPTIONS=detect_leaks=0 \
 // RUN: %clang -fsyntax-only -nostdinc %s \
 // RUN:     -I %S/Inputs/crash-recovery/usr/include \
 // RUN:     -ivfsoverlay %t/srcvfs.yaml \
Index: test/Driver/openmp-offload-gpu.c
===================================================================
--- test/Driver/openmp-offload-gpu.c
+++ test/Driver/openmp-offload-gpu.c
@@ -13,15 +13,15 @@
 /// ###########################################################################
 
 /// Check -Xopenmp-target=powerpc64le-ibm-linux-gnu -march=pwr7 is passed when compiling for the device.
-// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu -Xopenmp-target=powerpc64le-ibm-linux-gnu -mcpu=pwr7 %s 2>&1 \
+// RUN:   env ASAN_OPTIONS=detect_leaks=0 %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu -Xopenmp-target=powerpc64le-ibm-linux-gnu -mcpu=pwr7 %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FOPENMP-EQ-TARGET %s
 
 // CHK-FOPENMP-EQ-TARGET: clang{{.*}} "-target-cpu" "pwr7"
 
 /// ###########################################################################
 
 /// Check -Xopenmp-target -march=pwr7 is passed when compiling for the device.
-// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu -Xopenmp-target -mcpu=pwr7 %s 2>&1 \
+// RUN:   env ASAN_OPTIONS=detect_leaks=0 %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu -Xopenmp-target -mcpu=pwr7 %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FOPENMP-TARGET %s
 
 // CHK-FOPENMP-TARGET: clang{{.*}} "-target-cpu" "pwr7"
@@ -45,16 +45,16 @@
 /// ###########################################################################
 
 /// Check -Xopenmp-target uses one of the archs provided when several archs are used.
-// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_35 -Xopenmp-target -march=sm_60 %s 2>&1 \
+// RUN:   env ASAN_OPTIONS=detect_leaks=0 %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_35 -Xopenmp-target -march=sm_60 %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FOPENMP-TARGET-ARCHS %s
 
 // CHK-FOPENMP-TARGET-ARCHS: ptxas{{.*}}" "--gpu-name" "sm_60"
 // CHK-FOPENMP-TARGET-ARCHS: nvlink{{.*}}" "-arch" "sm_60"
 
 /// ###########################################################################
 
 /// Check -Xopenmp-target -march=sm_35 works as expected when two triples are present.
-// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu,nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_35 %s 2>&1 \
+// RUN:   env ASAN_OPTIONS=detect_leaks=0 %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu,nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_35 %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FOPENMP-TARGET-COMPILATION %s
 
 // CHK-FOPENMP-TARGET-COMPILATION: ptxas{{.*}}" "--gpu-name" "sm_35"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37810.115039.patch
Type: text/x-patch
Size: 4013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170913/9ddf16b5/attachment.bin>


More information about the llvm-commits mailing list