[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git] / test / lit.common.cfg
blob5366073be72635938495d819ab9478a1cfce1ac9
1 # -*- Python -*-
3 # Configuration file for 'lit' test runner.
4 # This file contains common rules for various compiler-rt testsuites.
5 # It is mostly copied from lit.cfg used by Clang.
6 import os
7 import platform
9 import lit.formats
11 # Setup test format
12 execute_external = (platform.system() != 'Windows'
13                     or lit_config.getBashPath() not in [None, ""])
14 config.test_format = lit.formats.ShTest(execute_external)
16 # Setup clang binary.
17 compiler_path = getattr(config, 'clang', None)
18 if (not compiler_path) or (not os.path.exists(compiler_path)):
19   lit_config.fatal("Can't find compiler on path %r" % compiler_path)
21 compiler_id = getattr(config, 'compiler_id', None)
22 if compiler_id == "Clang":
23   if platform.system() != 'Windows':
24     config.cxx_mode_flags = ["--driver-mode=g++"]
25   else:
26     config.cxx_mode_flags = []
27 elif compiler_id == 'GNU':
28   config.cxx_mode_flags = ["-x c++"]
29 else:
30   lit_config.fatal("Unsupported compiler id: %r" % compiler_id)
31 # Add compiler ID to the list of available features.
32 config.available_features.add(compiler_id)
34 # Clear some environment variables that might affect Clang.
35 possibly_dangerous_env_vars = ['COMPILER_PATH', 'RC_DEBUG_OPTIONS',
36                                'CINDEXTEST_PREAMBLE_FILE', 'LIBRARY_PATH',
37                                'CPATH', 'C_INCLUDE_PATH', 'CPLUS_INCLUDE_PATH',
38                                'OBJC_INCLUDE_PATH', 'OBJCPLUS_INCLUDE_PATH',
39                                'LIBCLANG_TIMING', 'LIBCLANG_OBJTRACKING',
40                                'LIBCLANG_LOGGING', 'LIBCLANG_BGPRIO_INDEX',
41                                'LIBCLANG_BGPRIO_EDIT', 'LIBCLANG_NOTHREADS',
42                                'LIBCLANG_RESOURCE_USAGE',
43                                'LIBCLANG_CODE_COMPLETION_LOGGING']
44 # Clang/Win32 may refer to %INCLUDE%. vsvarsall.bat sets it.
45 if platform.system() != 'Windows':
46     possibly_dangerous_env_vars.append('INCLUDE')
47 for name in possibly_dangerous_env_vars:
48   if name in config.environment:
49     del config.environment[name]
51 # Tweak PATH to include llvm tools dir.
52 llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
53 if (not llvm_tools_dir) or (not os.path.exists(llvm_tools_dir)):
54   lit_config.fatal("Invalid llvm_tools_dir config attribute: %r" % llvm_tools_dir)
55 path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
56 config.environment['PATH'] = path
58 # Help MSVS link.exe find the standard libraries.
59 if platform.system() == 'Windows':
60   config.environment['LIB'] = os.environ['LIB']
62 # Use ugly construction to explicitly prohibit "clang", "clang++" etc.
63 # in RUN lines.
64 config.substitutions.append(
65     (' clang', """\n\n*** Do not use 'clangXXX' in tests,
66      instead define '%clangXXX' substitution in lit config. ***\n\n""") )
68 # Allow tests to be executed on a simulator or remotely.
69 config.substitutions.append( ('%run', config.emulator) )
71 # Add supported compiler_rt architectures to a list of available features.
72 compiler_rt_arch = getattr(config, 'compiler_rt_arch', None)
73 if compiler_rt_arch:
74   for arch in compiler_rt_arch.split(";"):
75     config.available_features.add(arch + "-supported-target")
77 compiler_rt_debug = getattr(config, 'compiler_rt_debug', False)
78 if not compiler_rt_debug:
79   config.available_features.add('compiler-rt-optimized')