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