llvm.org GIT mirror llvm / 234da68
Revert 122341. It breaks some darwin tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122346 91177308-0d34-0410-b5e6-96231b3b80d8 David Greene 8 years ago
3 changed file(s) with 2 addition(s) and 50 deletion(s). Raw diff Collapse all Expand all
375375 shell. Consequently the syntax differs from normal shell script syntax in a
376376 few ways. You can specify as many RUN lines as needed.

377377
378

lit performs substitution on each RUN line to replace LLVM tool

379 names with the full paths to the executable built for each tool (in
380 $(LLVM_OBJ_ROOT)/$(BuildMode)/bin). This ensures that lit does not
381 invoke any stray LLVM tools in the user's path during testing.

382
383378

Each RUN line is executed on its own, distinct from other lines unless

384379 its last character is \. This continuation character causes the RUN
385380 line to be concatenated with the next one. In this way you can build up long
33
44 import os
55 import sys
6 import re
76
87 # name: The name of this test suite.
98 config.name = 'LLVM'
148147 else:
149148 config.substitutions.append(('%' + sub, site_exp[sub]))
150149
151 # For each occurrence of an llvm tool name as its own word, replace it
152 # with the full path to the build directory holding that tool. This
153 # ensures that we are testing the tools just built and not some random
154 # tools that might happen to be in the user's PATH. Thus this list
155 # includes every tool placed in $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
156 # (llvm_tools_dir in lit parlance).
157 # Don't match 'bugpoint-'.
158 for pattern in [r"\bbugpoint\b(?!-)", r"\bclang\b",
159 r"\bedis\b", r"\bgold\b",
160 r"\bllc\b", r"\blli\b",
161 r"\bllvm-ar\b", r"\bllvm-as\b",
162 r"\bllvm-bcanalyzer\b", r"\bllvm-config\b",
163 r"\bllvm-diff\b", r"\bllvm-dis\b",
164 r"\bllvm-extract\b", r"\bllvm-ld\b",
165 r"\bllvm-link\b", r"\bllvm-mc\b",
166 r"\bllvm-nm\b", r"\bllvm-prof\b",
167 r"\bllvm-ranlib\b", r"\bllvm-shlib\b",
168 r"\bllvm-stub\b", r"\bllvm2cpp\b",
169 # Don't match '-llvmc'.
170 r"(?
171 # Don't match '.opt', '-opt'
172 # or '^opt'.
173 r"\bmacho-dump\b", r"(?
174 r"\btblgen\b", r"\bFileCheck\b",
175 r"\bFileUpdate\b", r"\bc-index-test\b",
176 r"\bfpcmp\b", r"\bllvm-PerfectShuffle\b",
177 # Handle these specially as they are strings searched
178 # for during testing.
179 r"\| \bcount\b", r"\| \bnot\b"]:
180 # Extract the tool name from the pattern. This relies on the tool
181 # name being surrounded by \b word match operators. If the
182 # pattern starts with "| ", include it in the string to be
183 # substituted.
184 substitution = re.sub(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$",
185 r"\2" + llvm_tools_dir + "/" + r"\4",
186 pattern)
187 config.substitutions.append((pattern, substitution))
188
189150 excludes = []
190151
191152 # Provide target_triple for use in XFAIL and XTARGET.
66
77 import platform
88 import tempfile
9
10 import re
119
1210 class InternalShellError(Exception):
1311 def __init__(self, command, message):
445443 if ln[ln.index('END.'):].strip() == 'END.':
446444 break
447445
448 # Apply substitutions to the script. Allow full regular
449 # expression syntax. Replace each matching occurrence of regular
450 # expression pattern a with substitution b in line ln.
446 # Apply substitutions to the script.
451447 def processLine(ln):
452448 # Apply substitutions
453449 for a,b in substitutions:
454 ln = re.sub(a, b, ln)
450 ln = ln.replace(a,b)
455451
456452 # Strip the trailing newline and any extra whitespace.
457453 return ln.strip()