mkopec1 | c460b37 | 2012-01-09 11:21:50 -0500 | [diff] [blame] | 1 | # -*- Python -*- |
| 2 | |
| 3 | # Configuration file for the 'lit' test runner. |
| 4 | |
| 5 | # name: The name of this test suite. |
| 6 | config.name = 'slang_lit_tests' |
| 7 | |
| 8 | # suffixes: A list of file extensions to treat as test files. |
| 9 | config.suffixes = ['.rs'] |
| 10 | |
| 11 | # testFormat: The test format to use to interpret tests. |
Matt Wala | bc1f154 | 2015-06-22 17:56:20 -0700 | [diff] [blame] | 12 | import lit.formats |
mkopec1 | c460b37 | 2012-01-09 11:21:50 -0500 | [diff] [blame] | 13 | config.test_format = lit.formats.ShTest() |
| 14 | |
| 15 | # Get the base build directory for the android source tree from environment. |
| 16 | config.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). |
| 20 | config.test_source_root = None |
| 21 | |
| 22 | # test_exec_root: The path where tests are located (default is the test suite |
| 23 | # root). |
| 24 | config.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. |
| 27 | config.target_triple = 'slang' |
| 28 | |
| 29 | def 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 Wala | bc1f154 | 2015-06-22 17:56:20 -0700 | [diff] [blame] | 38 | import lit.util |
mkopec1 | c460b37 | 2012-01-09 11:21:50 -0500 | [diff] [blame] | 39 | tool = lit.util.which(binary_name, PATH) |
| 40 | |
| 41 | if not tool: |
Matt Wala | bc1f154 | 2015-06-22 17:56:20 -0700 | [diff] [blame] | 42 | lit_config.fatal("couldn't find " + binary_name + " program in " + PATH + " , try setting " |
| 43 | + env_var + " in your environment") |
mkopec1 | c460b37 | 2012-01-09 11:21:50 -0500 | [diff] [blame] | 44 | |
| 45 | return os.path.abspath(tool) |
| 46 | |
| 47 | config.slang = inferTool('llvm-rs-cc', 'SLANG', os.path.join(config.base_path, 'out', 'host', 'linux-x86', 'bin')).replace('\\', '/') |
| 48 | |
| 49 | config.filecheck = inferTool('FileCheck', 'FILECHECK', config.environment['PATH']) |
| 50 | config.rs_filecheck_wrapper = inferTool('rs-filecheck-wrapper.sh', 'RS_FILECHECK_WRAPPER', os.path.join(config.base_path, 'frameworks', 'compile', 'slang', 'lit-tests')) |
| 51 | |
Stephen Hines | 04fabb4 | 2012-03-01 17:24:26 -0800 | [diff] [blame] | 52 | # Use most up-to-date headers for includes. |
Tobias Grosser | 1254f84 | 2013-06-10 18:22:53 -0700 | [diff] [blame] | 53 | config.slang_includes = "-I " + os.path.join(config.base_path, 'frameworks', 'rs', 'scriptc') + " " \ |
Stephen Hines | 04fabb4 | 2012-03-01 17:24:26 -0800 | [diff] [blame] | 54 | + "-I " + os.path.join(config.base_path, 'external', 'clang', 'lib', 'Headers') |
mkopec1 | c460b37 | 2012-01-09 11:21:50 -0500 | [diff] [blame] | 55 | |
| 56 | config.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 Wala | bc1f154 | 2015-06-22 17:56:20 -0700 | [diff] [blame] | 60 | if 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) |
mkopec1 | c460b37 | 2012-01-09 11:21:50 -0500 | [diff] [blame] | 65 | |
| 66 | # Tools configuration substitutions |
| 67 | config.substitutions.append( ('%Slang', ' ' + config.slang + ' ' + config.slang_includes + ' ' + config.slang_options ) ) |
| 68 | config.substitutions.append( ('%rs-filecheck-wrapper', ' ' + config.rs_filecheck_wrapper + ' ' + config.test_exec_root + ' ' + config.filecheck + ' ') ) |