X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FTestingGuide.html;h=c39065a2824eb9279ef0043ff9a549880c6dd92e;hb=2db49d797b86b7f3615bae17b2b016727778a6c4;hp=9e4a40ade8d0eff93dfc34ac8d8afc2182cb99f9;hpb=f15380ba8ae35941dcd56d9a288ad023295dde30;p=oota-llvm.git diff --git a/docs/TestingGuide.html b/docs/TestingGuide.html index 9e4a40ade8d..c39065a2824 100644 --- a/docs/TestingGuide.html +++ b/docs/TestingGuide.html @@ -601,7 +601,7 @@ name="FileCheck-CHECK-NOT">The "CHECK-NOT:" directive

The CHECK-NOT: directive is used to verify that a string doesn't occur -between two matches (or the first matches and the beginning of the file). For +between two matches (or the first match and the beginning of the file). For example, to verify that a load is removed by a transformation, a test like this can be used:

@@ -624,6 +624,77 @@ define i8 @coerce_offset0(i32 %V, i32* %P) {
+ +
FileCheck Pattern Matching Syntax
+ +
+ +

The CHECK: and CHECK-NOT: directives both take a pattern to match. For most +uses of FileCheck, fixed string matching is perfectly sufficient. For some +things, a more flexible form of matching is desired. To support this, FileCheck +allows you to specify regular expressions in matching strings, surrounded by +double braces: {{yourregex}}. Because we want to use fixed string +matching for a majority of what we do, FileCheck has been designed to support +mixing and matching fixed string matching with regular expressions. This allows +you to write things like this:

+ +
+
+; CHECK: movhpd	{{[0-9]+}}(%esp), {{%xmm[0-7]}}
+
+
+ +

In this case, any offset from the ESP register will be allowed, and any xmm +register will be allowed.

+ +

Because regular expressions are enclosed with double braces, they are +visually distinct, and you don't need to use escape characters within the double +braces like you would in C. In the rare case that you want to match double +braces explicitly from the input, you can use something ugly like +{{[{][{]}} as your pattern.

+ +
+ + +
FileCheck Variables
+ +
+ +

It is often useful to match a pattern and then verify that it occurs again +later in the file. For codegen tests, this can be useful to allow any register, +but verify that that register is used consistently later. To do this, FileCheck +allows named variables to be defined and substituted into patterns. Here is a +simple example:

+ +
+
+; CHECK: test5:
+; CHECK:    notw	[[REGISTER:%[a-z]+]]
+; CHECK:    andw	{{.*}}[[REGISTER]]
+
+
+ +

The first check line matches a regex (%[a-z]+) and captures it into +the variables "REGISTER". The second line verifies that whatever is in REGISTER +occurs later in the file after an "andw". FileCheck variable references are +always contained in [[ ]] pairs, are named, and their names can be +formed with the regex "[a-zA-Z][a-zA-Z0-9]*". If a colon follows the +name, then it is a definition of the variable, if not, it is a use.

+ +

FileCheck variables can be defined multiple times, and uses always get the +latest value. Note that variables are all read at the start of a "CHECK" line +and are all defined at the end. This means that if you have something like +"CHECK: [[XYZ:.*]]x[[XYZ]]" that the check line will read the previous +value of the XYZ variable and define a new one after the match is performed. If +you need to do something like this you can probably take advantage of the fact +that FileCheck is not actually line-oriented when it matches, this allows you to +define two separate CHECK lines that match on the same line. +

+ +
+
Variables and substitutions
@@ -688,12 +759,6 @@ substitutions
The full path to the llvm-gxx executable as specified in the configured LLVM environment
-
llvmgcc_version (%llvmgcc_version)
-
The full version number of the llvm-gcc executable.
- -
llvmgccmajvers (%llvmgccmajvers)
-
The major version number of the llvm-gcc executable.
-
gccpath
The full path to the C compiler used to build LLVM. Note that this might not be gcc.
@@ -751,22 +816,20 @@ substitutions

Sometimes it is necessary to mark a test case as "expected fail" or XFAIL. - You can easily mark a test as XFAIL just by including XFAIL: on a + You can easily mark a test as XFAIL just by including XFAIL: on a line near the top of the file. This signals that the test case should succeed if the test fails. Such test cases are counted separately by DejaGnu. To specify an expected fail, use the XFAIL keyword in the comments of the test program followed by a colon and one or more regular expressions (separated by - a comma). The regular expressions allow you to XFAIL the test conditionally - by host platform. The regular expressions following the : are matched against - the target triplet or llvmgcc version number for the host machine. If there is - a match, the test is expected to fail. If not, the test is expected to - succeed. To XFAIL everywhere just specify XFAIL: *. When matching - the llvm-gcc version, you can specify the major (e.g. 3) or full version - (i.e. 3.4) number. Here is an example of an XFAIL line:

+ a comma). The regular expressions allow you to XFAIL the test conditionally by + host platform. The regular expressions following the : are matched against the + target triplet for the host machine. If there is a match, the test is expected + to fail. If not, the test is expected to succeed. To XFAIL everywhere just + specify XFAIL: *. Here is an example of an XFAIL line:

-; XFAIL: darwin,sun,llvmgcc4
+; XFAIL: darwin,sun
 
@@ -1072,7 +1135,6 @@ example reports that can do fancy stuff.

-
Running the nightly tester