OLD | NEW |
1 # -*- Python -*- | 1 # -*- Python -*- |
2 | 2 |
3 import os | 3 import os |
4 import platform | 4 import platform |
5 import re | 5 import re |
6 import subprocess | 6 import subprocess |
7 import tempfile | 7 import tempfile |
8 | 8 |
9 import lit.formats | 9 import lit.formats |
10 import lit.util | 10 import lit.util |
11 | 11 |
12 # Configuration file for the 'lit' test runner. | 12 # Configuration file for the 'lit' test runner. |
13 | 13 |
14 # name: The name of this test suite. | 14 # name: The name of this test suite. |
15 config.name = 'Clang' | 15 config.name = 'Clang' |
16 | 16 |
| 17 # @LOCALMOD-START |
| 18 # Msys tools like make and bash output paths like /c/dir/path. We need Windows |
| 19 # drive letters. Makefile.rules has $(ECHOPATH) to try to get Windows paths but |
| 20 # it doesn't work with autoconf substitutions like @FOO@=$(path) |
| 21 def FixMsysPath(path): |
| 22 if sys.platform == 'win32' and path and path.startswith('/'): |
| 23 return path[1] + ':' + path[2:] |
| 24 return path |
| 25 # @LOCALMOD-END |
| 26 |
17 # Tweak PATH for Win32 | 27 # Tweak PATH for Win32 |
18 if platform.system() == 'Windows': | 28 if platform.system() == 'Windows': |
19 # Seek sane tools in directories and set to $PATH. | 29 # Seek sane tools in directories and set to $PATH. |
20 path = getattr(config, 'lit_tools_dir', None) | 30 path = getattr(config, 'lit_tools_dir', None) |
21 path = lit_config.getToolsPath(path, | 31 path = lit_config.getToolsPath(path, |
22 config.environment['PATH'], | 32 config.environment['PATH'], |
23 ['cmp.exe', 'grep.exe', 'sed.exe']) | 33 ['cmp.exe', 'grep.exe', 'sed.exe']) |
24 if path is not None: | 34 if path is not None: |
25 path = os.path.pathsep.join((path, | 35 path = os.path.pathsep.join((path, |
26 config.environment['PATH'])) | 36 config.environment['PATH'])) |
(...skipping 21 matching lines...) Expand all Loading... |
48 | 58 |
49 # excludes: A list of directories to exclude from the testsuite. The 'Inputs' | 59 # excludes: A list of directories to exclude from the testsuite. The 'Inputs' |
50 # subdirectories contain auxiliary inputs for various tests in their parent | 60 # subdirectories contain auxiliary inputs for various tests in their parent |
51 # directories. | 61 # directories. |
52 config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt'] | 62 config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt'] |
53 | 63 |
54 # test_source_root: The root path where tests are located. | 64 # test_source_root: The root path where tests are located. |
55 config.test_source_root = os.path.dirname(__file__) | 65 config.test_source_root = os.path.dirname(__file__) |
56 | 66 |
57 # test_exec_root: The root path where tests should be run. | 67 # test_exec_root: The root path where tests should be run. |
58 clang_obj_root = getattr(config, 'clang_obj_root', None) | 68 clang_obj_root = FixMsysPath(getattr(config, 'clang_obj_root', None))# @LOCALMOD |
59 if clang_obj_root is not None: | 69 if clang_obj_root is not None: |
60 config.test_exec_root = os.path.join(clang_obj_root, 'test') | 70 config.test_exec_root = os.path.join(clang_obj_root, 'test') |
61 | 71 |
62 # Set llvm_{src,obj}_root for use by others. | 72 # Set llvm_{src,obj}_root for use by others. |
63 config.llvm_src_root = getattr(config, 'llvm_src_root', None) | 73 config.llvm_src_root = getattr(config, 'llvm_src_root', None) |
64 config.llvm_obj_root = getattr(config, 'llvm_obj_root', None) | 74 config.llvm_obj_root = getattr(config, 'llvm_obj_root', None) |
65 | 75 |
66 # Clear some environment variables that might affect Clang. | 76 # Clear some environment variables that might affect Clang. |
67 # | 77 # |
68 # This first set of vars are read by Clang, but shouldn't affect tests | 78 # This first set of vars are read by Clang, but shouldn't affect tests |
(...skipping 17 matching lines...) Expand all Loading... |
86 'LIBCLANG_CODE_COMPLETION_LOGGING'] | 96 'LIBCLANG_CODE_COMPLETION_LOGGING'] |
87 # Clang/Win32 may refer to %INCLUDE%. vsvarsall.bat sets it. | 97 # Clang/Win32 may refer to %INCLUDE%. vsvarsall.bat sets it. |
88 if platform.system() != 'Windows': | 98 if platform.system() != 'Windows': |
89 possibly_dangerous_env_vars.append('INCLUDE') | 99 possibly_dangerous_env_vars.append('INCLUDE') |
90 for name in possibly_dangerous_env_vars: | 100 for name in possibly_dangerous_env_vars: |
91 if name in config.environment: | 101 if name in config.environment: |
92 del config.environment[name] | 102 del config.environment[name] |
93 | 103 |
94 # Tweak the PATH to include the tools dir and the scripts dir. | 104 # Tweak the PATH to include the tools dir and the scripts dir. |
95 if clang_obj_root is not None: | 105 if clang_obj_root is not None: |
96 clang_tools_dir = getattr(config, 'clang_tools_dir', None) | 106 clang_tools_dir = FixMsysPath(getattr(config, 'clang_tools_dir', None)) # @L
OCALMOD |
97 if not clang_tools_dir: | 107 if not clang_tools_dir: |
98 lit_config.fatal('No Clang tools dir set!') | 108 lit_config.fatal('No Clang tools dir set!') |
99 llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) | 109 llvm_tools_dir = FixMsysPath(getattr(config, 'llvm_tools_dir', None)) # @LOC
ALMOD |
100 if not llvm_tools_dir: | 110 if not llvm_tools_dir: |
101 lit_config.fatal('No LLVM tools dir set!') | 111 lit_config.fatal('No LLVM tools dir set!') |
102 path = os.path.pathsep.join(( | 112 path = os.path.pathsep.join(( |
103 clang_tools_dir, llvm_tools_dir, config.environment['PATH'])) | 113 clang_tools_dir, llvm_tools_dir, config.environment['PATH'])) |
104 config.environment['PATH'] = path | 114 config.environment['PATH'] = path |
105 llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) | 115 llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) |
106 if not llvm_libs_dir: | 116 if not llvm_libs_dir: |
107 lit_config.fatal('No LLVM libs dir set!') | 117 lit_config.fatal('No LLVM libs dir set!') |
108 path = os.path.pathsep.join((llvm_libs_dir, | 118 path = os.path.pathsep.join((llvm_libs_dir, |
109 config.environment.get('LD_LIBRARY_PATH',''))) | 119 config.environment.get('LD_LIBRARY_PATH',''))) |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 use_gmalloc = False | 487 use_gmalloc = False |
478 | 488 |
479 # Allow use of an explicit path for gmalloc library. | 489 # Allow use of an explicit path for gmalloc library. |
480 # Will default to '/usr/lib/libgmalloc.dylib' if not set. | 490 # Will default to '/usr/lib/libgmalloc.dylib' if not set. |
481 gmalloc_path_str = lit_config.params.get('gmalloc_path', | 491 gmalloc_path_str = lit_config.params.get('gmalloc_path', |
482 '/usr/lib/libgmalloc.dylib') | 492 '/usr/lib/libgmalloc.dylib') |
483 if use_gmalloc: | 493 if use_gmalloc: |
484 config.environment.update({'DYLD_INSERT_LIBRARIES' : gmalloc_path_str}) | 494 config.environment.update({'DYLD_INSERT_LIBRARIES' : gmalloc_path_str}) |
485 | 495 |
486 lit.util.usePlatformSdkOnDarwin(config, lit_config) | 496 lit.util.usePlatformSdkOnDarwin(config, lit_config) |
OLD | NEW |