# -*- 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', '.ll'] # testFormat: The test format to use to interpret tests. import lit.formats 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. import lit.util tool = lit.util.which(binary_name, PATH) if not tool: lit_config.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(os.getenv('ANDROID_HOST_OUT'), 'bin')).replace('\\', '/') config.llvm_rs_as = inferTool('llvm-rs-as', 'LLVM_RS_AS', os.path.join(os.getenv('ANDROID_HOST_OUT'), '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')) config.scriptc_filecheck_wrapper = inferTool('scriptc-filecheck-wrapper.sh', 'SCRIPTC_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', 'rs', 'script_api', 'include') + " " \ + "-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_config.quiet: lit_config.note('using slang: %r' % config.slang) lit_config.note('using llvm-rs-as: %r' % config.llvm_rs_as) lit_config.note('using FileCheck: %r' % config.filecheck) lit_config.note('using rs-filecheck-wrapper.sh: %r' % config.rs_filecheck_wrapper) lit_config.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( ('%llvm-rs-as', config.llvm_rs_as) ) config.substitutions.append( ('%rs-filecheck-wrapper', ' ' + config.rs_filecheck_wrapper + ' ' + config.test_exec_root + ' ' + config.filecheck + ' ') ) config.substitutions.append( ('%scriptc-filecheck-wrapper', ' ' + config.scriptc_filecheck_wrapper + ' --output=' + config.test_exec_root + ' --filecheck=' + config.filecheck + ' ') ) lit_config.note(config.substitutions)