mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Added %(line), %(line+<number>), %(line-<number>) substitutions to lit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167971 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
984639b7a4
commit
08639983de
@ -723,6 +723,11 @@ define two separate CHECK lines that match on the same line.
|
|||||||
<dd>The full path to the test case's source. This is suitable for passing
|
<dd>The full path to the test case's source. This is suitable for passing
|
||||||
on the command line as the input to an llvm tool.</dd>
|
on the command line as the input to an llvm tool.</dd>
|
||||||
|
|
||||||
|
<dt><b>%(line), %(line+<i>number</i>), %(line-<i>number</i>)</b></dt>
|
||||||
|
<dd>The number of the line where this variable is used, with an optional
|
||||||
|
integer offset. This can be used in tests with multiple RUN: lines, which
|
||||||
|
reference test file's line numbers.</dd>
|
||||||
|
|
||||||
<dt><b>$srcdir</b></dt>
|
<dt><b>$srcdir</b></dt>
|
||||||
<dd>The source directory from where the "<tt>make check</tt>" was run.</dd>
|
<dd>The source directory from where the "<tt>make check</tt>" was run.</dd>
|
||||||
|
|
||||||
|
@ -432,7 +432,9 @@ def parseIntegratedTestScript(test, normalize_slashes=False,
|
|||||||
script = []
|
script = []
|
||||||
xfails = []
|
xfails = []
|
||||||
requires = []
|
requires = []
|
||||||
|
line_number = 0
|
||||||
for ln in open(sourcepath):
|
for ln in open(sourcepath):
|
||||||
|
line_number += 1
|
||||||
if 'RUN:' in ln:
|
if 'RUN:' in ln:
|
||||||
# Isolate the command to run.
|
# Isolate the command to run.
|
||||||
index = ln.index('RUN:')
|
index = ln.index('RUN:')
|
||||||
@ -441,6 +443,15 @@ def parseIntegratedTestScript(test, normalize_slashes=False,
|
|||||||
# Trim trailing whitespace.
|
# Trim trailing whitespace.
|
||||||
ln = ln.rstrip()
|
ln = ln.rstrip()
|
||||||
|
|
||||||
|
# Substitute line number expressions
|
||||||
|
ln = re.sub('%\(line\)', str(line_number), ln)
|
||||||
|
def replace_line_number(match):
|
||||||
|
if match.group(1) == '+':
|
||||||
|
return str(line_number + int(match.group(2)))
|
||||||
|
if match.group(1) == '-':
|
||||||
|
return str(line_number - int(match.group(2)))
|
||||||
|
ln = re.sub('%\(line *([\+-]) *(\d+)\)', replace_line_number, ln)
|
||||||
|
|
||||||
# Collapse lines with trailing '\\'.
|
# Collapse lines with trailing '\\'.
|
||||||
if script and script[-1][-1] == '\\':
|
if script and script[-1][-1] == '\\':
|
||||||
script[-1] = script[-1][:-1] + ln
|
script[-1] = script[-1][:-1] + ln
|
||||||
|
Loading…
Reference in New Issue
Block a user