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. 12 config.test_format = lit.formats.ShTest() 13 14 # Get the base build directory for the android source tree from environment. 15 config.base_path = os.getenv('ANDROID_BUILD_TOP') 16 17 # test_source_root: The path where tests are located (default is the test suite 18 # root). 19 config.test_source_root = None 20 21 # test_exec_root: The path where tests are located (default is the test suite 22 # root). 23 config.test_exec_root = os.path.join(config.base_path, 'out', 'tests', 'slang', 'lit-tests') 24 25 # target_triple: Used by ShTest and TclTest formats for XFAIL checks. 26 config.target_triple = 'slang' 27 28 def inferTool(binary_name, env_var, PATH): 29 # Determine which tool to use. 30 tool = os.getenv(env_var) 31 32 # If the user set the overriding environment variable, use it 33 if tool and os.path.isfile(tool): 34 return tool 35 36 # Otherwise look in the path. 37 tool = lit.util.which(binary_name, PATH) 38 39 if not tool: 40 lit.fatal("couldn't find " + binary_name + " program in " + PATH + " , try setting " 41 + env_var + " in your environment") 42 43 return os.path.abspath(tool) 44 45 config.slang = inferTool('llvm-rs-cc', 'SLANG', os.path.join(config.base_path, 'out', 'host', 'linux-x86', 'bin')).replace('\\', '/') 46 47 config.filecheck = inferTool('FileCheck', 'FILECHECK', config.environment['PATH']) 48 config.rs_filecheck_wrapper = inferTool('rs-filecheck-wrapper.sh', 'RS_FILECHECK_WRAPPER', os.path.join(config.base_path, 'frameworks', 'compile', 'slang', 'lit-tests')) 49 50 # Use most up-to-date headers for includes. 51 config.slang_includes = "-I " + os.path.join(config.base_path, 'frameworks', 'base', 'libs', 'rs', 'scriptc') + " " \ 52 + "-I " + os.path.join(config.base_path, 'external', 'clang', 'lib', 'Headers') 53 54 config.slang_options = "-emit-llvm -o " + config.test_exec_root \ 55 + " -output-dep-dir " + config.test_exec_root \ 56 + " -java-reflection-path-base " + config.test_exec_root 57 58 if not lit.quiet: 59 lit.note('using slang: %r' % config.slang) 60 lit.note('using FileCheck: %r' % config.filecheck) 61 lit.note('using rs-filecheck-wrapper.sh: %r' % config.rs_filecheck_wrapper) 62 lit.note('using output directory: %r' % config.test_exec_root) 63 64 # Tools configuration substitutions 65 config.substitutions.append( ('%Slang', ' ' + config.slang + ' ' + config.slang_includes + ' ' + config.slang_options ) ) 66 config.substitutions.append( ('%rs-filecheck-wrapper', ' ' + config.rs_filecheck_wrapper + ' ' + config.test_exec_root + ' ' + config.filecheck + ' ') ) 67