| 1 |
# -*- Python -*- |
| 2 |
import os |
| 3 |
import sys |
| 4 |
|
| 5 |
import lit.formats |
| 6 |
|
| 7 |
config.name = "per_test_timeout" |
| 8 |
|
| 9 |
shellType = lit_config.params.get("external", "1") |
| 10 |
|
| 11 |
if shellType == "0": |
| 12 |
lit_config.note("Using internal shell") |
| 13 |
externalShell = False |
| 14 |
else: |
| 15 |
lit_config.note("Using external shell") |
| 16 |
externalShell = True |
| 17 |
|
| 18 |
configSetTimeout = lit_config.params.get("set_timeout", "0") |
| 19 |
|
| 20 |
if configSetTimeout != "0": |
| 21 |
# Try setting the max individual test time in the configuration |
| 22 |
lit_config.maxIndividualTestTime = int(configSetTimeout) |
| 23 |
|
| 24 |
config.test_format = lit.formats.ShTest(execute_external=externalShell) |
| 25 |
config.suffixes = [".py"] |
| 26 |
|
| 27 |
config.test_source_root = os.path.dirname(__file__) |
| 28 |
config.test_exec_root = config.test_source_root |
| 29 |
config.target_triple = "(unused)" |
| 30 |
src_root = os.path.join(config.test_source_root, "..") |
| 31 |
|
| 32 |
pythonpath_list = [src_root] |
| 33 |
# Ensure the user's PYTHONPATH is included. |
| 34 |
if "PYTHONPATH" in os.environ: |
| 35 |
pythonpath_list.append(os.environ["PYTHONPATH"]) |
| 36 |
if "PYTHONPATH" in config.environment: |
| 37 |
pythonpath_list.append(config.environment["PYTHONPATH"]) |
| 38 |
config.environment["PYTHONPATH"] = os.pathsep.join(pythonpath_list) |
| 39 |
|
| 40 |
config.substitutions.append(("%{python}", '"%s"' % (sys.executable))) |