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 24 matching lines...) Expand all Loading... |
35 # Finding Subzero tools | 35 # Finding Subzero tools |
36 llvm2icetool = os.path.join(bin_root, 'llvm2ice') | 36 llvm2icetool = os.path.join(bin_root, 'llvm2ice') |
37 config.substitutions.append( | 37 config.substitutions.append( |
38 ('%llvm2iceinsts', ' '.join([os.path.join(bin_root, 'llvm2iceinsts.py'), | 38 ('%llvm2iceinsts', ' '.join([os.path.join(bin_root, 'llvm2iceinsts.py'), |
39 '--llvm2ice', llvm2icetool, | 39 '--llvm2ice', llvm2icetool, |
40 '--llvm-bin-path', llvmbinpath | 40 '--llvm-bin-path', llvmbinpath |
41 ]))) | 41 ]))) |
42 config.substitutions.append(('%llvm2ice', llvm2icetool)) | 42 config.substitutions.append(('%llvm2ice', llvm2icetool)) |
43 config.substitutions.append(('%szdiff', os.path.join(bin_root, 'szdiff.py'))) | 43 config.substitutions.append(('%szdiff', os.path.join(bin_root, 'szdiff.py'))) |
44 | 44 |
45 llvmbintools = [r"\bFileCheck\b", r"\bllvm-mc\b", r"\bnot\b", | 45 llvmbintools = [r"\bFileCheck\b", r"\bllvm-mc\b", r"\bllvm-objdump\b", |
46 r"\bpnacl-freeze\b"] | 46 r"\bnot\b", r"\bpnacl-freeze\b"] |
47 | 47 |
48 for tool in llvmbintools: | 48 for tool in llvmbintools: |
49 # The re.sub() line is adapted from one of LLVM's lit.cfg files. | 49 # The re.sub() line is adapted from one of LLVM's lit.cfg files. |
50 # Extract the tool name from the pattern. This relies on the tool | 50 # Extract the tool name from the pattern. This relies on the tool |
51 # name being surrounded by \b word match operators. If the | 51 # name being surrounded by \b word match operators. If the |
52 # pattern starts with "| ", include it in the string to be | 52 # pattern starts with "| ", include it in the string to be |
53 # substituted. | 53 # substituted. |
54 substitution = re.sub(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$", | 54 substitution = re.sub(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$", |
55 r"\2" + llvmbinpath + "/" + r"\4", | 55 r"\2" + llvmbinpath + "/" + r"\4", |
56 tool) | 56 tool) |
57 config.substitutions.append((tool, substitution)) | 57 config.substitutions.append((tool, substitution)) |
58 | 58 |
59 # Add a feature to detect the Python version. | 59 # Add a feature to detect the Python version. |
60 config.available_features.add("python%d.%d" % (sys.version_info[0], | 60 config.available_features.add("python%d.%d" % (sys.version_info[0], |
61 sys.version_info[1])) | 61 sys.version_info[1])) |
62 | 62 |
63 # Debugging output | 63 # Debugging output |
64 def dbg(s): | 64 def dbg(s): |
65 print '[DBG] %s' % s | 65 print '[DBG] %s' % s |
66 | 66 |
67 dbg('bin_root = %s' % bin_root) | 67 dbg('bin_root = %s' % bin_root) |
68 dbg('llvmbinpath = %s' % llvmbinpath) | 68 dbg('llvmbinpath = %s' % llvmbinpath) |
OLD | NEW |