[llvm-commits] [llvm] r167971 - in /llvm/trunk: docs/TestingGuide.html utils/lit/lit/TestRunner.py
Sean Silva
silvas at purdue.edu
Wed Nov 14 12:31:24 PST 2012
Thanks for the docs!
-- Sean Silva
On Wed, Nov 14, 2012 at 3:26 PM, Alexander Kornienko <alexfh at google.com> wrote:
> Author: alexfh
> Date: Wed Nov 14 14:26:19 2012
> New Revision: 167971
>
> URL: http://llvm.org/viewvc/llvm-project?rev=167971&view=rev
> Log:
> Added %(line), %(line+<number>), %(line-<number>) substitutions to lit
>
> Modified:
> llvm/trunk/docs/TestingGuide.html
> llvm/trunk/utils/lit/lit/TestRunner.py
>
> Modified: llvm/trunk/docs/TestingGuide.html
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TestingGuide.html?rev=167971&r1=167970&r2=167971&view=diff
> ==============================================================================
> --- llvm/trunk/docs/TestingGuide.html (original)
> +++ llvm/trunk/docs/TestingGuide.html Wed Nov 14 14:26:19 2012
> @@ -723,6 +723,11 @@
> <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>
>
> + <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>
> <dd>The source directory from where the "<tt>make check</tt>" was run.</dd>
>
>
> Modified: llvm/trunk/utils/lit/lit/TestRunner.py
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=167971&r1=167970&r2=167971&view=diff
> ==============================================================================
> --- llvm/trunk/utils/lit/lit/TestRunner.py (original)
> +++ llvm/trunk/utils/lit/lit/TestRunner.py Wed Nov 14 14:26:19 2012
> @@ -432,7 +432,9 @@
> script = []
> xfails = []
> requires = []
> + line_number = 0
> for ln in open(sourcepath):
> + line_number += 1
> if 'RUN:' in ln:
> # Isolate the command to run.
> index = ln.index('RUN:')
> @@ -441,6 +443,15 @@
> # Trim trailing whitespace.
> 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 '\\'.
> if script and script[-1][-1] == '\\':
> script[-1] = script[-1][:-1] + ln
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list