diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-04-15 08:01:04 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-04-15 08:01:04 +0000 |
commit | f190277fca23c3405e44f80023e0695b436c3183 (patch) | |
tree | 832759a867e590a22b0327ab904e9913deab983e /docs | |
parent | 7c65d4345ea93967e2d943765c3fa945beb72aab (diff) |
Describe quoting rules.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36060 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/TestingGuide.html | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/docs/TestingGuide.html b/docs/TestingGuide.html index df8cfefddf..f03adaaef6 100644 --- a/docs/TestingGuide.html +++ b/docs/TestingGuide.html @@ -323,6 +323,13 @@ location of these external programs is configured by the llvm-test any process in the pipeline fails, the entire line (and test case) fails too. </p> + <p> Below is an example of legal RUN lines in a <tt>.ll</tt> file:</p> + <pre> + ; RUN: llvm-as < %s | llvm-dis > %t1 + ; RUN: llvm-dis < %s.bc-13 > %t2 + ; RUN: diff %t1 %t2 + </pre> + <p>As with a Unix shell, the RUN: lines permit pipelines and I/O redirection to be used. However, the usage is slightly different than for Bash. To check what's legal, see the documentation for the @@ -341,12 +348,47 @@ location of these external programs is configured by the llvm-test shouldn't use that here.</li> </ul> - <p> Below is an example of legal RUN lines in a <tt>.ll</tt> file:</p> + <p>There are some quoting rules that you must pay attention to when writing + your RUN lines. In general nothing needs to be quoted. Tcl won't strip off any + ' or " so they will get passed to the invoked program. For example:</p> <pre> - ; RUN: llvm-as < %s | llvm-dis > %t1 - ; RUN: llvm-dis < %s.bc-13 > %t2 - ; RUN: diff %t1 %t2 + ... | grep 'find this string' </pre> + <p>This will fail because the ' characters are passed to grep. This would + instruction grep to look for <tt>'find</tt> in the files <tt>this</tt> and + <tt>string'</tt>. To avoid this use curly braces to tell Tcl that it should + treat everything enclosed as one value. So our example would become:</p> + <pre> + ... | grep {find this string} + </pre> + <p>Additionally, the characters <tt>[</tt> and <tt>]</tt> are treated + specially by Tcl. They tell Tcl to interpret the content as a command to + execute. Since these characters are often used in regular expressions this can + have disastrous results and cause the entire test run in a directory to fail. + For example, a common idiom is to look for some basicblock number:</p> + <pre> + ... | grep bb[2-8] + </pre> + <p>This, however, will cause Tcl to fail because its going to try to execute + a program named "2-8". Instead, what you want is this:</p> + <pre> + ... | grep {bb\[2-8\]} + </pre> + <p>Finally, if you need to pass the <tt>\</tt> character down to a program, + then it must be doubled. This is another Tcl special character. So, suppose + you had: + <pre> + ... | grep 'i32\*' + </pre> + <p>This will fail to match what you want (a pointer to i32). First, the + <tt>'</tt> do not get stripped off. Second, the <tt>\</tt> gets stripped off + by Tcl so what grep sees is: <tt>'i32*'</tt>. That's not likely to match + anything. To resolve this you must use <tt>\\</tt> and the <tt>{}</tt>, like + this:</p> + <pre> + ... | grep {i32\\*} + </pre> + </div> <!-- _______________________________________________________________________ --> |