| OLD | NEW |
| 1 # Taken from utils/lit/tests in the LLVM tree and hacked together to support | 1 # Taken from utils/lit/tests in the LLVM tree and hacked together to support |
| 2 # our tests. | 2 # our tests. |
| 3 | 3 |
| 4 # -*- Python -*- | 4 # -*- Python -*- |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import re | 7 import re |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 import lit.formats | 10 import lit.formats |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 llvm2icetool = os.path.join(bin_root, 'llvm2ice') | 41 llvm2icetool = os.path.join(bin_root, 'llvm2ice') |
| 42 config.substitutions.append( | 42 config.substitutions.append( |
| 43 ('%llvm2iceinsts', ' '.join([os.path.join(pydir, 'llvm2iceinsts.py'), | 43 ('%llvm2iceinsts', ' '.join([os.path.join(pydir, 'llvm2iceinsts.py'), |
| 44 '--llvm2ice', llvm2icetool, | 44 '--llvm2ice', llvm2icetool, |
| 45 '--llvm-bin-path', llvmbinpath | 45 '--llvm-bin-path', llvmbinpath |
| 46 ]))) | 46 ]))) |
| 47 config.substitutions.append(('%llvm2ice', llvm2icetool)) | 47 config.substitutions.append(('%llvm2ice', llvm2icetool)) |
| 48 config.substitutions.append(('%szdiff', os.path.join(pydir, 'szdiff.py'))) | 48 config.substitutions.append(('%szdiff', os.path.join(pydir, 'szdiff.py'))) |
| 49 | 49 |
| 50 llvmbintools = [r"\bFileCheck\b", r"\bllvm-as\b", r"\bllvm-mc\b", | 50 llvmbintools = [r"\bFileCheck\b", r"\bllvm-as\b", r"\bllvm-mc\b", |
| 51 r"\bllvm-objdump\b", r"\bnot\b", r"\bpnacl-freeze\b"] | 51 r"\bllvm-objdump\b", r"\bnot\b", r"\bpnacl-freeze\b", |
| 52 r"\bpnacl-bcdis\b"] |
| 52 | 53 |
| 53 for tool in llvmbintools: | 54 for tool in llvmbintools: |
| 54 # The re.sub() line is adapted from one of LLVM's lit.cfg files. | 55 # The re.sub() line is adapted from one of LLVM's lit.cfg files. |
| 55 # Extract the tool name from the pattern. This relies on the tool | 56 # Extract the tool name from the pattern. This relies on the tool |
| 56 # name being surrounded by \b word match operators. If the | 57 # name being surrounded by \b word match operators. If the |
| 57 # pattern starts with "| ", include it in the string to be | 58 # pattern starts with "| ", include it in the string to be |
| 58 # substituted. | 59 # substituted. |
| 59 substitution = re.sub(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$", | 60 substitution = re.sub(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$", |
| 60 r"\2" + llvmbinpath + "/" + r"\4", | 61 r"\2" + llvmbinpath + "/" + r"\4", |
| 61 tool) | 62 tool) |
| 62 config.substitutions.append((tool, substitution)) | 63 config.substitutions.append((tool, substitution)) |
| 63 | 64 |
| 64 # Add a feature to detect the Python version. | 65 # Add a feature to detect the Python version. |
| 65 config.available_features.add("python%d.%d" % (sys.version_info[0], | 66 config.available_features.add("python%d.%d" % (sys.version_info[0], |
| 66 sys.version_info[1])) | 67 sys.version_info[1])) |
| 67 | 68 |
| 68 # Debugging output | 69 # Debugging output |
| 69 def dbg(s): | 70 def dbg(s): |
| 70 print '[DBG] %s' % s | 71 print '[DBG] %s' % s |
| 71 | 72 |
| 72 dbg('bin_root = %s' % bin_root) | 73 dbg('bin_root = %s' % bin_root) |
| 73 dbg('llvmbinpath = %s' % llvmbinpath) | 74 dbg('llvmbinpath = %s' % llvmbinpath) |
| OLD | NEW |