[PATCH] D38644: Factor out default_(a|ub)sanitizer_opts in lit.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 6 13:49:23 PDT 2017


eugenis created this revision.
Herald added subscribers: kubamracek, srhines.

https://reviews.llvm.org/D38644

Files:
  compiler-rt/test/asan/lit.cfg
  compiler-rt/test/lit.common.cfg
  compiler-rt/test/ubsan/lit.common.cfg


Index: compiler-rt/test/ubsan/lit.common.cfg
===================================================================
--- compiler-rt/test/ubsan/lit.common.cfg
+++ compiler-rt/test/ubsan/lit.common.cfg
@@ -14,7 +14,7 @@
 # Setup source root.
 config.test_source_root = os.path.dirname(__file__)
 
-default_ubsan_opts = []
+default_ubsan_opts = list(config.default_sanitizer_opts)
 # Choose between standalone and UBSan+ASan modes.
 ubsan_lit_test_mode = get_required_attr(config, 'ubsan_lit_test_mode')
 if ubsan_lit_test_mode == "Standalone":
@@ -41,13 +41,6 @@
 if config.target_arch == 's390x':
   # On SystemZ we need -mbackchain to make the fast unwinder work.
   clang_ubsan_cflags.append("-mbackchain")
-if config.host_os == 'Darwin':
-  # On Darwin, we default to `abort_on_error=1`, which would make tests run
-  # much slower. Let's override this and run lit tests with 'abort_on_error=0'.
-  default_ubsan_opts += ['abort_on_error=0']
-  default_ubsan_opts += ['log_to_syslog=0']
-elif config.android:
-  default_ubsan_opts += ['abort_on_error=0']
 
 default_ubsan_opts_str = ':'.join(default_ubsan_opts)
 if default_ubsan_opts_str:
Index: compiler-rt/test/lit.common.cfg
===================================================================
--- compiler-rt/test/lit.common.cfg
+++ compiler-rt/test/lit.common.cfg
@@ -11,7 +11,6 @@
 import lit.formats
 import lit.util
 
-
 # Choose between lit's internal shell pipeline runner and a real shell.  If
 # LIT_USE_INTERNAL_SHELL is in the environment, we use that as an override.
 use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
@@ -295,3 +294,12 @@
 config.substitutions.append( ("%dynamiclib", '%T/%xdynamiclib_filename') )
 config.substitutions.append( ("%xdynamiclib_filename", 'lib%xdynamiclib_namespec.so') )
 config.substitutions.append( ("%xdynamiclib_namespec", '%basename_t.dynamic') )
+
+config.default_sanitizer_opts = []
+if config.host_os == 'Darwin':
+  # On Darwin, we default to `abort_on_error=1`, which would make tests run
+  # much slower. Let's override this and run lit tests with 'abort_on_error=0'.
+  config.default_sanitizer_opts += ['abort_on_error=0']
+  config.default_sanitizer_opts += ['log_to_syslog=0']
+elif config.android:
+  config.default_sanitizer_opts += ['abort_on_error=0']
Index: compiler-rt/test/asan/lit.cfg
===================================================================
--- compiler-rt/test/asan/lit.cfg
+++ compiler-rt/test/asan/lit.cfg
@@ -31,29 +31,19 @@
 config.name = 'AddressSanitizer' + config.name_suffix
 
 # Platform-specific default ASAN_OPTIONS for lit tests.
-default_asan_opts = ''
-if config.host_os == 'Darwin':
-  # On Darwin, we default to `abort_on_error=1`, which would make tests run
-  # much slower. Let's override this and run lit tests with 'abort_on_error=0'.
-  # Also, make sure we do not overwhelm the syslog while testing.
-  default_asan_opts = 'abort_on_error=0'
-  default_asan_opts += ':log_to_syslog=0'
-
-  # On Darwin, leak checking is not enabled by default. Enable for x86_64
-  # tests to prevent regressions
-  if config.target_arch == 'x86_64':
-    default_asan_opts += ':detect_leaks=1'
-elif config.android:
-  # The same as on Darwin, we default to "abort_on_error=1" which slows down
-  # testing. Also, all existing tests are using "not" instead of "not --crash"
-  # which does not work for abort()-terminated programs.
-  default_asan_opts = 'abort_on_error=0'
-
-if default_asan_opts:
-  config.environment['ASAN_OPTIONS'] = default_asan_opts
-  default_asan_opts += ':'
+default_asan_opts = list(config.default_sanitizer_opts)
+
+# On Darwin, leak checking is not enabled by default. Enable for x86_64
+# tests to prevent regressions
+if config.host_os == 'Darwin' and config.target_arch == 'x86_64':
+  default_asan_opts += ['detect_leaks=1']
+
+default_asan_opts_str = ':'.join(default_asan_opts)
+if default_asan_opts_str:
+  config.environment['ASAN_OPTIONS'] = default_asan_opts_str
+  default_asan_opts_str += ':'
 config.substitutions.append(('%env_asan_opts=',
-                             'env ASAN_OPTIONS=' + default_asan_opts))
+                             'env ASAN_OPTIONS=' + default_asan_opts_str))
 
 # Setup source root.
 config.test_source_root = os.path.dirname(__file__)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38644.118072.patch
Type: text/x-patch
Size: 4257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171006/e1b68f54/attachment.bin>


More information about the llvm-commits mailing list