blob: 23337a1fe9aaac2439e7637754f73651e408d9cf [file] [log] [blame]
mkopec1c460b372012-01-09 11:21:50 -05001# -*- Python -*-
2
3# Configuration file for the 'lit' test runner.
4
5# name: The name of this test suite.
6config.name = 'slang_lit_tests'
7
8# suffixes: A list of file extensions to treat as test files.
9config.suffixes = ['.rs']
10
11# testFormat: The test format to use to interpret tests.
Matt Walabc1f1542015-06-22 17:56:20 -070012import lit.formats
mkopec1c460b372012-01-09 11:21:50 -050013config.test_format = lit.formats.ShTest()
14
15# Get the base build directory for the android source tree from environment.
16config.base_path = os.getenv('ANDROID_BUILD_TOP')
17
18# test_source_root: The path where tests are located (default is the test suite
19# root).
20config.test_source_root = None
21
22# test_exec_root: The path where tests are located (default is the test suite
23# root).
24config.test_exec_root = os.path.join(config.base_path, 'out', 'tests', 'slang', 'lit-tests')
25
26# target_triple: Used by ShTest and TclTest formats for XFAIL checks.
27config.target_triple = 'slang'
28
29def inferTool(binary_name, env_var, PATH):
30 # Determine which tool to use.
31 tool = os.getenv(env_var)
32
33 # If the user set the overriding environment variable, use it
34 if tool and os.path.isfile(tool):
35 return tool
36
37 # Otherwise look in the path.
Matt Walabc1f1542015-06-22 17:56:20 -070038 import lit.util
mkopec1c460b372012-01-09 11:21:50 -050039 tool = lit.util.which(binary_name, PATH)
40
41 if not tool:
Matt Walabc1f1542015-06-22 17:56:20 -070042 lit_config.fatal("couldn't find " + binary_name + " program in " + PATH + " , try setting "
43 + env_var + " in your environment")
mkopec1c460b372012-01-09 11:21:50 -050044
45 return os.path.abspath(tool)
46
47config.slang = inferTool('llvm-rs-cc', 'SLANG', os.path.join(config.base_path, 'out', 'host', 'linux-x86', 'bin')).replace('\\', '/')
48
49config.filecheck = inferTool('FileCheck', 'FILECHECK', config.environment['PATH'])
50config.rs_filecheck_wrapper = inferTool('rs-filecheck-wrapper.sh', 'RS_FILECHECK_WRAPPER', os.path.join(config.base_path, 'frameworks', 'compile', 'slang', 'lit-tests'))
51
Stephen Hines04fabb42012-03-01 17:24:26 -080052# Use most up-to-date headers for includes.
Tobias Grosser1254f842013-06-10 18:22:53 -070053config.slang_includes = "-I " + os.path.join(config.base_path, 'frameworks', 'rs', 'scriptc') + " " \
Stephen Hines04fabb42012-03-01 17:24:26 -080054 + "-I " + os.path.join(config.base_path, 'external', 'clang', 'lib', 'Headers')
mkopec1c460b372012-01-09 11:21:50 -050055
56config.slang_options = "-emit-llvm -o " + config.test_exec_root \
57 + " -output-dep-dir " + config.test_exec_root \
58 + " -java-reflection-path-base " + config.test_exec_root
59
Matt Walabc1f1542015-06-22 17:56:20 -070060if not lit_config.quiet:
61 lit_config.note('using slang: %r' % config.slang)
62 lit_config.note('using FileCheck: %r' % config.filecheck)
63 lit_config.note('using rs-filecheck-wrapper.sh: %r' % config.rs_filecheck_wrapper)
64 lit_config.note('using output directory: %r' % config.test_exec_root)
mkopec1c460b372012-01-09 11:21:50 -050065
66# Tools configuration substitutions
67config.substitutions.append( ('%Slang', ' ' + config.slang + ' ' + config.slang_includes + ' ' + config.slang_options ) )
68config.substitutions.append( ('%rs-filecheck-wrapper', ' ' + config.rs_filecheck_wrapper + ' ' + config.test_exec_root + ' ' + config.filecheck + ' ') )