| # -*- Python -*- |
| |
| # Configuration file for the 'lit' test runner. |
| |
| # name: The name of this test suite. |
| config.name = 'slang_lit_tests' |
| |
| # suffixes: A list of file extensions to treat as test files. |
| config.suffixes = ['.rs'] |
| |
| # testFormat: The test format to use to interpret tests. |
| config.test_format = lit.formats.ShTest() |
| |
| # Get the base build directory for the android source tree from environment. |
| config.base_path = os.getenv('ANDROID_BUILD_TOP') |
| |
| # test_source_root: The path where tests are located (default is the test suite |
| # root). |
| config.test_source_root = None |
| |
| # test_exec_root: The path where tests are located (default is the test suite |
| # root). |
| config.test_exec_root = os.path.join(config.base_path, 'out', 'tests', 'slang', 'lit-tests') |
| |
| # target_triple: Used by ShTest and TclTest formats for XFAIL checks. |
| config.target_triple = 'slang' |
| |
| def inferTool(binary_name, env_var, PATH): |
| # Determine which tool to use. |
| tool = os.getenv(env_var) |
| |
| # If the user set the overriding environment variable, use it |
| if tool and os.path.isfile(tool): |
| return tool |
| |
| # Otherwise look in the path. |
| tool = lit.util.which(binary_name, PATH) |
| |
| if not tool: |
| lit.fatal("couldn't find " + binary_name + " program in " + PATH + " , try setting " |
| + env_var + " in your environment") |
| |
| return os.path.abspath(tool) |
| |
| config.slang = inferTool('llvm-rs-cc', 'SLANG', os.path.join(config.base_path, 'out', 'host', 'linux-x86', 'bin')).replace('\\', '/') |
| |
| config.filecheck = inferTool('FileCheck', 'FILECHECK', config.environment['PATH']) |
| config.rs_filecheck_wrapper = inferTool('rs-filecheck-wrapper.sh', 'RS_FILECHECK_WRAPPER', os.path.join(config.base_path, 'frameworks', 'compile', 'slang', 'lit-tests')) |
| |
| # Use most up-to-date headers for includes. |
| config.slang_includes = "-I " + os.path.join(config.base_path, 'frameworks', 'base', 'libs', 'rs', 'scriptc') + " " \ |
| + "-I " + os.path.join(config.base_path, 'external', 'clang', 'lib', 'Headers') |
| |
| config.slang_options = "-emit-llvm -o " + config.test_exec_root \ |
| + " -output-dep-dir " + config.test_exec_root \ |
| + " -java-reflection-path-base " + config.test_exec_root |
| |
| if not lit.quiet: |
| lit.note('using slang: %r' % config.slang) |
| lit.note('using FileCheck: %r' % config.filecheck) |
| lit.note('using rs-filecheck-wrapper.sh: %r' % config.rs_filecheck_wrapper) |
| lit.note('using output directory: %r' % config.test_exec_root) |
| |
| # Tools configuration substitutions |
| config.substitutions.append( ('%Slang', ' ' + config.slang + ' ' + config.slang_includes + ' ' + config.slang_options ) ) |
| config.substitutions.append( ('%rs-filecheck-wrapper', ' ' + config.rs_filecheck_wrapper + ' ' + config.test_exec_root + ' ' + config.filecheck + ' ') ) |