1import os 2import re 3import lit.formats 4 5config.name = 'subzero_crosstests' 6config.test_format = lit.formats.ShTest() 7config.suffixes = ['.xtest'] 8config.test_source_root = os.path.dirname(__file__) 9config.test_exec_root = config.test_source_root 10 11pnaclbintools = [r"\bFileCheck\b"] 12pnaclbinpath = os.path.abspath(os.environ.get('PNACL_BIN_PATH')) 13 14for tool in pnaclbintools: 15 # The re.sub() line is adapted from one of LLVM's lit.cfg files. 16 # Extract the tool name from the pattern. This relies on the tool 17 # name being surrounded by \b word match operators. If the 18 # pattern starts with "| ", include it in the string to be 19 # substituted. 20 substitution = re.sub(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$", 21 r"\2" + pnaclbinpath + "/" + r"\4", 22 tool) 23 config.substitutions.append((tool, substitution)) 24