summaryrefslogtreecommitdiff
path: root/test/lit.common.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit.common.cfg')
-rw-r--r--test/lit.common.cfg118
1 files changed, 97 insertions, 21 deletions
diff --git a/test/lit.common.cfg b/test/lit.common.cfg
index 0840f65a7161..5274b49c654f 100644
--- a/test/lit.common.cfg
+++ b/test/lit.common.cfg
@@ -7,6 +7,7 @@ import os
import platform
import re
import subprocess
+import json
import lit.formats
import lit.util
@@ -37,7 +38,11 @@ if compiler_id == "Clang":
# reports and stack traces even with minimal debug info.
config.debug_info_flags = ["-gline-tables-only"]
if platform.system() == 'Windows':
+ # On Windows, use CodeView with column info instead of DWARF. Both VS and
+ # windbg do not behave well when column info is enabled, but users have
+ # requested it because it makes ASan reports more precise.
config.debug_info_flags.append("-gcodeview")
+ config.debug_info_flags.append("-gcolumn-info")
elif compiler_id == 'GNU':
config.cxx_mode_flags = ["-x c++"]
config.debug_info_flags = ["-g"]
@@ -86,8 +91,10 @@ config.environment['PATH'] = path
if platform.system() == 'Windows' and '-win' in config.target_triple:
config.environment['LIB'] = os.environ['LIB']
+config.available_features.add(config.host_os.lower())
+
if re.match(r'^x86_64.*-linux', config.target_triple):
- config.available_features.add("x86_64-linux")
+ config.available_features.add("x86_64-linux")
# Use ugly construction to explicitly prohibit "clang", "clang++" etc.
# in RUN lines.
@@ -100,17 +107,50 @@ if config.emulator:
config.substitutions.append( ('%run', config.emulator) )
config.substitutions.append( ('%env ', "env ") )
config.compile_wrapper = ""
-elif config.ios:
+elif config.host_os == 'Darwin' and config.apple_platform != "osx":
+ # Darwin tests can be targetting macOS, a device or a simulator. All devices
+ # are declared as "ios", even for iOS derivatives (tvOS, watchOS). Similarly,
+ # all simulators are "iossim". See the table below.
+ #
+ # =========================================================================
+ # Target | Feature set
+ # =========================================================================
+ # macOS | darwin
+ # iOS device | darwin, ios
+ # iOS simulator | darwin, ios, iossim
+ # tvOS device | darwin, ios, tvos
+ # tvOS simulator | darwin, ios, iossim, tvos, tvossim
+ # watchOS device | darwin, ios, watchos
+ # watchOS simulator | darwin, ios, iossim, watchos, watchossim
+ # =========================================================================
+
+ ios_or_iossim = "iossim" if config.apple_platform.endswith("sim") else "ios"
+
config.available_features.add('ios')
- device_id_env = "SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER" if config.iossim else "SANITIZER_IOS_TEST_DEVICE_IDENTIFIER"
- if device_id_env in os.environ: config.environment[device_id_env] = os.environ[device_id_env]
+ if ios_or_iossim == "iossim":
+ config.available_features.add('iossim')
+ if config.apple_platform != "ios" and config.apple_platform != "iossim":
+ config.available_features.add(config.apple_platform)
+
ios_commands_dir = os.path.join(config.compiler_rt_src_root, "test", "sanitizer_common", "ios_commands")
- run_wrapper = os.path.join(ios_commands_dir, "iossim_run.py" if config.iossim else "ios_run.py")
+
+ device_id_env = "SANITIZER_" + ios_or_iossim.upper() + "_TEST_DEVICE_IDENTIFIER"
+ run_wrapper = os.path.join(ios_commands_dir, ios_or_iossim + "_run.py")
+ env_wrapper = os.path.join(ios_commands_dir, ios_or_iossim + "_env.py")
+ compile_wrapper = os.path.join(ios_commands_dir, ios_or_iossim + "_compile.py")
+ prepare_script = os.path.join(ios_commands_dir, ios_or_iossim + "_prepare.py")
+
+ if device_id_env in os.environ:
+ config.environment[device_id_env] = os.environ[device_id_env]
config.substitutions.append(('%run', run_wrapper))
- env_wrapper = os.path.join(ios_commands_dir, "iossim_env.py" if config.iossim else "ios_env.py")
config.substitutions.append(('%env ', env_wrapper + " "))
- compile_wrapper = os.path.join(ios_commands_dir, "iossim_compile.py" if config.iossim else "ios_compile.py")
config.compile_wrapper = compile_wrapper
+
+ prepare_output = subprocess.check_output([prepare_script, config.apple_platform, config.clang]).strip()
+ if len(prepare_output) > 0: print(prepare_output)
+ prepare_output_json = prepare_output.split("\n")[-1]
+ prepare_output = json.loads(prepare_output_json)
+ config.environment.update(prepare_output["env"])
elif config.android:
config.available_features.add('android')
compile_wrapper = os.path.join(config.compiler_rt_src_root, "test", "sanitizer_common", "android_commands", "android_compile.py") + " "
@@ -197,8 +237,19 @@ if config.host_os == 'Darwin':
pass
config.substitutions.append( ("%macos_min_target_10_11", "-mmacosx-version-min=10.11") )
+
+ isIOS = config.apple_platform != "osx"
+ # rdar://problem/22207160
+ config.substitutions.append( ("%darwin_min_target_with_full_runtime_arc_support",
+ "-miphoneos-version-min=9.0" if isIOS else "-mmacosx-version-min=10.11") )
+
+ # 32-bit iOS simulator is deprecated and removed in latest Xcode.
+ if config.apple_platform == "iossim":
+ if config.target_arch == "i386":
+ config.unsupported = True
else:
config.substitutions.append( ("%macos_min_target_10_11", "") )
+ config.substitutions.append( ("%darwin_min_target_with_full_runtime_arc_support", "") )
if config.android:
adb = os.environ.get('ADB', 'adb')
@@ -265,6 +316,8 @@ if config.lto_supported:
config.lto_flags += ["-flto=thin"]
else:
config.lto_flags += ["-flto"]
+ if config.use_newpm:
+ config.lto_flags += ["-fexperimental-new-pass-manager"]
# Ask llvm-config about assertion mode.
try:
@@ -291,20 +344,43 @@ if platform.system() == 'Windows':
if platform.system() == 'Darwin':
lit_config.parallelism_groups["darwin-64bit-sanitizer"] = 3
-if config.host_os == 'Darwin':
- config.substitutions.append( ("%ld_flags_rpath_exe", '-Wl,-rpath,@executable_path/ %dynamiclib') )
- config.substitutions.append( ("%ld_flags_rpath_so", '-install_name @rpath/`basename %dynamiclib`') )
-elif config.host_os == 'FreeBSD':
- config.substitutions.append( ("%ld_flags_rpath_exe", "-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec") )
- config.substitutions.append( ("%ld_flags_rpath_so", '') )
-elif config.host_os == 'Linux':
- config.substitutions.append( ("%ld_flags_rpath_exe", "-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec") )
- config.substitutions.append( ("%ld_flags_rpath_so", '') )
-
-# Must be defined after the substitutions that use %dynamiclib.
-config.substitutions.append( ("%dynamiclib", '%T/%xdynamiclib_filename') )
-config.substitutions.append( ("%xdynamiclib_filename", 'lib%xdynamiclib_namespec.so') )
-config.substitutions.append( ("%xdynamiclib_namespec", '%basename_t.dynamic') )
+# The current implementation of the tools in sanitizer_common/ios_comamnds
+# do not support parallel execution so force sequential execution of the
+# tests on iOS devices.
+if config.host_os == 'Darwin' and config.apple_platform != "osx" and not config.apple_platform.endswith("sim"):
+ lit_config.warning("iOS device test cases being run sequentially")
+ lit_config.parallelism_groups["darwin-ios-device-sanitizer"] = 1
+
+# Multiple substitutions are necessary to support multiple shared objects used
+# at once.
+# Note that substitutions with numbers have to be defined first to avoid
+# being subsumed by substitutions with smaller postfix.
+for postfix in ["2", "1", ""]:
+ if config.host_os == 'Darwin':
+ config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, '-Wl,-rpath,@executable_path/ %dynamiclib' + postfix) )
+ config.substitutions.append( ("%ld_flags_rpath_so" + postfix, '-install_name @rpath/`basename %dynamiclib{}`'.format(postfix)) )
+ elif config.host_os in ('FreeBSD', 'NetBSD', 'OpenBSD'):
+ config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, "-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix) )
+ config.substitutions.append( ("%ld_flags_rpath_so" + postfix, '') )
+ elif config.host_os == 'Linux':
+ config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, "-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix) )
+ config.substitutions.append( ("%ld_flags_rpath_so" + postfix, '') )
+ elif config.host_os == 'SunOS':
+ config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, "-Wl,-R\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix) )
+ config.substitutions.append( ("%ld_flags_rpath_so" + postfix, '') )
+
+ # Must be defined after the substitutions that use %dynamiclib.
+ config.substitutions.append( ("%dynamiclib" + postfix, '%T/%xdynamiclib_filename' + postfix) )
+ config.substitutions.append( ("%xdynamiclib_filename" + postfix, 'lib%xdynamiclib_namespec{}.so'.format(postfix)) )
+ config.substitutions.append( ("%xdynamiclib_namespec", '%basename_t.dynamic') )
+
+# Provide a substituion that can be used to tell Clang to use a static libstdc++.
+# The substitution expands to nothing on non Linux platforms.
+# FIXME: This should check the target OS, not the host OS.
+if config.host_os == 'Linux':
+ config.substitutions.append( ("%linux_static_libstdcplusplus", "-stdlib=libstdc++ -static-libstdc++") )
+else:
+ config.substitutions.append( ("%linux_static_libstdcplusplus", "") )
config.default_sanitizer_opts = []
if config.host_os == 'Darwin':