aboutsummaryrefslogtreecommitdiff
path: root/test/lit.common.cfg
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-01-07 19:55:37 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-01-07 19:55:37 +0000
commitca9211ecdede9bdedb812b2243a4abdb8dacd1b9 (patch)
tree9b19e801150082c33e9152275829a6ce90614b55 /test/lit.common.cfg
parent8ef50bf3d1c287b5013c3168de77a462dfce3495 (diff)
downloadsrc-ca9211ecdede9bdedb812b2243a4abdb8dacd1b9.tar.gz
src-ca9211ecdede9bdedb812b2243a4abdb8dacd1b9.zip
Import compiler-rt trunk r224034.vendor/compiler-rt/compiler-rt-r224034
Notes
Notes: svn path=/vendor/compiler-rt/dist/; revision=276789 svn path=/vendor/compiler-rt/compiler-rt-r224034/; revision=276790; tag=vendor/compiler-rt/compiler-rt-r224034
Diffstat (limited to 'test/lit.common.cfg')
-rw-r--r--test/lit.common.cfg89
1 files changed, 89 insertions, 0 deletions
diff --git a/test/lit.common.cfg b/test/lit.common.cfg
new file mode 100644
index 000000000000..0ee2b84481da
--- /dev/null
+++ b/test/lit.common.cfg
@@ -0,0 +1,89 @@
+# -*- Python -*-
+
+# Configuration file for 'lit' test runner.
+# This file contains common rules for various compiler-rt testsuites.
+# It is mostly copied from lit.cfg used by Clang.
+import os
+import platform
+
+import lit.formats
+import lit.util
+
+# Setup test format
+execute_external = (platform.system() != 'Windows'
+ or lit_config.getBashPath() not in [None, ""])
+config.test_format = lit.formats.ShTest(execute_external)
+
+# Setup clang binary.
+compiler_path = getattr(config, 'clang', None)
+if (not compiler_path) or (not os.path.exists(compiler_path)):
+ lit_config.fatal("Can't find compiler on path %r" % compiler_path)
+
+compiler_id = getattr(config, 'compiler_id', None)
+if compiler_id == "Clang":
+ if platform.system() != 'Windows':
+ config.cxx_mode_flags = ["--driver-mode=g++"]
+ else:
+ config.cxx_mode_flags = []
+ # We assume that sanitizers should provide good enough error
+ # reports and stack traces even with minimal debug info.
+ config.debug_info_flags = ["-gline-tables-only"]
+elif compiler_id == 'GNU':
+ config.cxx_mode_flags = ["-x c++"]
+ config.debug_info_flags = ["-g"]
+else:
+ lit_config.fatal("Unsupported compiler id: %r" % compiler_id)
+# Add compiler ID to the list of available features.
+config.available_features.add(compiler_id)
+
+# Clear some environment variables that might affect Clang.
+possibly_dangerous_env_vars = ['COMPILER_PATH', 'RC_DEBUG_OPTIONS',
+ 'CINDEXTEST_PREAMBLE_FILE', 'LIBRARY_PATH',
+ 'CPATH', 'C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH',
+ 'OBJC_INCLUDE_PATH', 'OBJCPLUS_INCLUDE_PATH',
+ 'LIBCLANG_TIMING', 'LIBCLANG_OBJTRACKING',
+ 'LIBCLANG_LOGGING', 'LIBCLANG_BGPRIO_INDEX',
+ 'LIBCLANG_BGPRIO_EDIT', 'LIBCLANG_NOTHREADS',
+ 'LIBCLANG_RESOURCE_USAGE',
+ 'LIBCLANG_CODE_COMPLETION_LOGGING']
+# Clang/Win32 may refer to %INCLUDE%. vsvarsall.bat sets it.
+if platform.system() != 'Windows':
+ possibly_dangerous_env_vars.append('INCLUDE')
+for name in possibly_dangerous_env_vars:
+ if name in config.environment:
+ del config.environment[name]
+
+# Tweak PATH to include llvm tools dir.
+llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
+if (not llvm_tools_dir) or (not os.path.exists(llvm_tools_dir)):
+ lit_config.fatal("Invalid llvm_tools_dir config attribute: %r" % llvm_tools_dir)
+path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
+config.environment['PATH'] = path
+
+# Help MSVS link.exe find the standard libraries.
+if platform.system() == 'Windows':
+ config.environment['LIB'] = os.environ['LIB']
+
+# Use ugly construction to explicitly prohibit "clang", "clang++" etc.
+# in RUN lines.
+config.substitutions.append(
+ (' clang', """\n\n*** Do not use 'clangXXX' in tests,
+ instead define '%clangXXX' substitution in lit config. ***\n\n""") )
+
+# Allow tests to be executed on a simulator or remotely.
+config.substitutions.append( ('%run', config.emulator) )
+
+# Define CHECK-%os to check for OS-dependent output.
+config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os)))
+
+# Add supported compiler_rt architectures to a list of available features.
+compiler_rt_arch = getattr(config, 'compiler_rt_arch', None)
+if compiler_rt_arch:
+ for arch in compiler_rt_arch.split(";"):
+ config.available_features.add(arch + "-supported-target")
+
+compiler_rt_debug = getattr(config, 'compiler_rt_debug', False)
+if not compiler_rt_debug:
+ config.available_features.add('compiler-rt-optimized')
+
+lit.util.usePlatformSdkOnDarwin(config, lit_config)