Alexey Samsonov | 59c33c0 | 2012-08-07 08:59:15 +0000 | [diff] [blame] | 1 | # -*- Python -*- |
| 2 | |
| 3 | # Configuration file for 'lit' test runner. |
| 4 | # This file contains common config setup rules for unit tests in various |
| 5 | # compiler-rt testsuites. |
| 6 | |
| 7 | import os |
| 8 | |
Daniel Dunbar | beadec4 | 2013-08-09 22:23:23 +0000 | [diff] [blame] | 9 | import lit.formats |
| 10 | |
Alexey Samsonov | 59c33c0 | 2012-08-07 08:59:15 +0000 | [diff] [blame] | 11 | # Setup test format |
Alexey Samsonov | 0d92533 | 2013-01-30 12:18:49 +0000 | [diff] [blame] | 12 | llvm_build_mode = getattr(config, "llvm_build_mode", "Debug") |
| 13 | config.test_format = lit.formats.GoogleTest(llvm_build_mode, "Test") |
Alexey Samsonov | 59c33c0 | 2012-08-07 08:59:15 +0000 | [diff] [blame] | 14 | |
| 15 | # Setup test suffixes. |
| 16 | config.suffixes = [] |
| 17 | |
Alexey Samsonov | 071cc9e | 2013-09-08 13:23:29 +0000 | [diff] [blame] | 18 | # Tweak PATH to include llvm tools dir. |
Zachary Turner | ce92db1 | 2017-09-15 22:10:46 +0000 | [diff] [blame] | 19 | llvm_tools_dir = config.llvm_tools_dir |
Alexey Samsonov | 071cc9e | 2013-09-08 13:23:29 +0000 | [diff] [blame] | 20 | if (not llvm_tools_dir) or (not os.path.exists(llvm_tools_dir)): |
| 21 | lit_config.fatal("Invalid llvm_tools_dir config attribute: %r" % llvm_tools_dir) |
| 22 | path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH'])) |
| 23 | config.environment['PATH'] = path |
| 24 | |
Alexey Samsonov | 59c33c0 | 2012-08-07 08:59:15 +0000 | [diff] [blame] | 25 | # Propagate the temp directory. Windows requires this because it uses \Windows\ |
| 26 | # if none of these are present. |
| 27 | if 'TMP' in os.environ: |
| 28 | config.environment['TMP'] = os.environ['TMP'] |
| 29 | if 'TEMP' in os.environ: |
| 30 | config.environment['TEMP'] = os.environ['TEMP'] |
Kuba Mracek | 245318c | 2017-01-20 00:25:01 +0000 | [diff] [blame] | 31 | |
| 32 | if config.host_os == 'Darwin': |
Julian Lettner | 6eef7d0 | 2019-02-27 19:06:20 +0000 | [diff] [blame] | 33 | # Only run up to 3 processes that require shadow memory simultaneously on |
| 34 | # 64-bit Darwin. Using more scales badly and hogs the system due to |
| 35 | # inefficient handling of large mmap'd regions (terabytes) by the kernel. |
| 36 | lit_config.parallelism_groups["shadow-memory"] = 3 |
Kuba Mracek | 245318c | 2017-01-20 00:25:01 +0000 | [diff] [blame] | 37 | |
Reid Kleckner | f6e857c | 2017-04-07 01:23:15 +0000 | [diff] [blame] | 38 | # The test config gets pickled and sent to multiprocessing workers, and that |
| 39 | # only works for code if it is stored at the top level of some module. |
| 40 | # Therefore, we have to put the code in a .py file, add it to path, and import |
| 41 | # it to store it in the config. |
Reid Kleckner | 78495ea | 2017-04-07 01:24:48 +0000 | [diff] [blame] | 42 | import site |
Reid Kleckner | f6e857c | 2017-04-07 01:23:15 +0000 | [diff] [blame] | 43 | site.addsitedir(os.path.dirname(__file__)) |
| 44 | import lit_unittest_cfg_utils |
| 45 | config.darwin_sanitizer_parallelism_group_func = \ |
| 46 | lit_unittest_cfg_utils.darwin_sanitizer_parallelism_group_func |