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