Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # -*- Python -*- | 1 # -*- Python -*- |
| 2 # Taken from utils/lit/tests in the LLVM tree and hacked together to support | 2 # Taken from utils/lit/tests in the LLVM tree and hacked together to support |
| 3 # our tests. | 3 # our tests. |
| 4 # | 4 # |
| 5 # Note: This configuration has simple commands to run Subzero's translator. | 5 # Note: This configuration has simple commands to run Subzero's translator. |
| 6 # They have the form %X2i (i.e. %p2i, %l2i, and %lc2i) where X is defined | 6 # They have the form %X2i (i.e. %p2i, %l2i, and %lc2i) where X is defined |
| 7 # as follows: | 7 # as follows: |
| 8 # | 8 # |
| 9 # p : Run Subzero's translator, building ICE from PNaCl bitcode directly. | 9 # p : Run Subzero's translator, building ICE from PNaCl bitcode directly. |
| 10 # l : Run Subzero's translator, converting the .ll file to a PNaCl bitcode | 10 # l : Run Subzero's translator, converting the .ll file to a PNaCl bitcode |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 sys.path.insert(0, 'pydir') | 41 sys.path.insert(0, 'pydir') |
| 42 from utils import FindBaseNaCl, shellcmd | 42 from utils import FindBaseNaCl, shellcmd |
| 43 | 43 |
| 44 # name: The name of this test suite. | 44 # name: The name of this test suite. |
| 45 config.name = 'subzero' | 45 config.name = 'subzero' |
| 46 | 46 |
| 47 # testFormat: The test format to use to interpret tests. | 47 # testFormat: The test format to use to interpret tests. |
| 48 config.test_format = lit.formats.ShTest() | 48 config.test_format = lit.formats.ShTest() |
| 49 | 49 |
| 50 # suffixes: A list of file extensions to treat as test files. | 50 # suffixes: A list of file extensions to treat as test files. |
| 51 config.suffixes = ['.ll'] | 51 config.suffixes = ['.ll', '.test'] |
| 52 | 52 |
| 53 # test_source_root: The root path where tests are located. | 53 # test_source_root: The root path where tests are located. |
| 54 config.test_source_root = os.path.dirname(__file__) | 54 config.test_source_root = os.path.dirname(__file__) |
| 55 config.test_exec_root = config.test_source_root | 55 config.test_exec_root = config.test_source_root |
| 56 config.target_triple = '(unused)' | 56 config.target_triple = '(unused)' |
| 57 | 57 |
| 58 src_root = os.path.join(FindBaseNaCl(), 'toolchain_build/src/subzero') | 58 src_root = os.path.join(FindBaseNaCl(), 'toolchain_build/src/subzero') |
| 59 bin_root = src_root | 59 bin_root = src_root |
| 60 config.substitutions.append(('%{src_root}', src_root)) | 60 config.substitutions.append(('%{src_root}', src_root)) |
| 61 config.substitutions.append(('%{python}', sys.executable)) | 61 config.substitutions.append(('%{python}', sys.executable)) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 | 99 |
| 100 # Translate LLVM source for each compiler setup. | 100 # Translate LLVM source for each compiler setup. |
| 101 config.substitutions.append(('%p2i', ' '.join(pnacl_sz_cmd))) | 101 config.substitutions.append(('%p2i', ' '.join(pnacl_sz_cmd))) |
| 102 config.substitutions.append(('%l2i', ' '.join(ifl2i_atts_cmd + pnacl_sz_cmd | 102 config.substitutions.append(('%l2i', ' '.join(ifl2i_atts_cmd + pnacl_sz_cmd |
| 103 + ['--llvm']))) | 103 + ['--llvm']))) |
| 104 config.substitutions.append(('%lc2i', ' '.join(iflc2i_atts_cmd + pnacl_sz_cmd | 104 config.substitutions.append(('%lc2i', ' '.join(iflc2i_atts_cmd + pnacl_sz_cmd |
| 105 + ['--llvm-source']))) | 105 + ['--llvm-source']))) |
| 106 | 106 |
| 107 config.substitutions.append(('%pnacl_sz', pnacl_sz_tool)) | 107 config.substitutions.append(('%pnacl_sz', pnacl_sz_tool)) |
| 108 | 108 |
| 109 pnaclbintools = [r"\bFileCheck\b", | 109 pnaclbintools = [r"\bFileCheck\b", |
|
Jim Stichnoth
2015/06/29 22:43:12
Maybe it's time to rewrite this clumsy array, some
Karl
2015/06/30 18:46:09
Done.
| |
| 110 r"\ble32-nacl-objdump\b", | 110 r"\ble32-nacl-objdump\b", |
| 111 r"\bllvm-as\b", | 111 r"\bllvm-as\b", |
| 112 r"\bllvm-mc\b", | 112 r"\bllvm-mc\b", |
| 113 r"\bllvm-readobj\b", | 113 r"\bllvm-readobj\b", |
| 114 r"\bnot\b", | 114 r"\bnot\b", |
| 115 r"\bpnacl-bcfuzz\b", | |
| 115 r"\bpnacl-freeze\b", | 116 r"\bpnacl-freeze\b", |
| 116 r"\bpnacl-bcdis\b"] | 117 r"\bpnacl-bcdis\b"] |
| 117 | 118 |
| 118 for tool in pnaclbintools: | 119 for tool in pnaclbintools: |
| 119 # The re.sub() line is adapted from one of LLVM's lit.cfg files. | 120 # The re.sub() line is adapted from one of LLVM's lit.cfg files. |
| 120 # Extract the tool name from the pattern. This relies on the tool | 121 # Extract the tool name from the pattern. This relies on the tool |
| 121 # name being surrounded by \b word match operators. If the | 122 # name being surrounded by \b word match operators. If the |
| 122 # pattern starts with "| ", include it in the string to be | 123 # pattern starts with "| ", include it in the string to be |
| 123 # substituted. | 124 # substituted. |
| 124 substitution = re.sub(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$", | 125 substitution = re.sub(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$", |
| 125 r"\2" + pnaclbinpath + "/" + r"\4", | 126 r"\2" + pnaclbinpath + "/" + r"\4", |
| 126 tool) | 127 tool) |
| 127 config.substitutions.append((tool, substitution)) | 128 config.substitutions.append((tool, substitution)) |
| 128 | 129 |
| 129 # Add a feature to detect the Python version. | 130 # Add a feature to detect the Python version. |
| 130 config.available_features.add("python%d.%d" % (sys.version_info[0], | 131 config.available_features.add("python%d.%d" % (sys.version_info[0], |
| 131 sys.version_info[1])) | 132 sys.version_info[1])) |
| 132 | 133 |
| 133 # Debugging output | 134 # Debugging output |
| 134 def dbg(s): | 135 def dbg(s): |
| 135 print '[DBG] %s' % s | 136 print '[DBG] %s' % s |
| 136 | 137 |
| 137 dbg('bin_root = %s' % bin_root) | 138 dbg('bin_root = %s' % bin_root) |
| 138 dbg('pnaclbinpath = %s' % pnaclbinpath) | 139 dbg('pnaclbinpath = %s' % pnaclbinpath) |
| 139 dbg("Build attributes = %s" % pnacl_sz_atts) | 140 dbg("Build attributes = %s" % pnacl_sz_atts) |
| OLD | NEW |