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