[llvm-bugs] [Bug 30198] New: FileCheck .* is too greedy

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 30 10:40:00 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30198

            Bug ID: 30198
           Summary: FileCheck .* is too greedy
           Product: Test Suite
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: lit
          Assignee: unassignedbugs at nondot.org
          Reporter: paul_robinson at playstation.sony.com
                CC: daniel at zuster.org, llvm-bugs at lists.llvm.org
    Classification: Unclassified

In r280057, Richard Smith made this change to a test:

--- cfe/trunk/test/Driver/modules-ts.cpp (original)
+++ cfe/trunk/test/Driver/modules-ts.cpp Tue Aug 30 00:14:38 2016
@@ -23,8 +23,7 @@
 // CHECK-USE: -cc1
 // CHECK-USE-SAME: -emit-obj
 // CHECK-USE-SAME: -fmodule-file={{.*}}.pcm
-// CHECK-USE-SAME: -o {{.*}}.o
-// CHECK-USE-SAME: -x c++
+// CHECK-USE-SAME: -o {{.*}}.o {{.*}}-x c++
 // CHECK-USE-SAME: modules-ts.cpp


The reason is that the {{.*}}.o was matching too much text, and
indeed the following test case fails:

$ cat foo.txt
CHECK:  -o {{.*}}.o
CHECK-SAME: -x c++
$ echo '-o blah.o -x c++ llvm.org' | FileCheck foo.txt
foo.txt:2:13: error: expected string not found in input
CHECK-SAME: -x c++
            ^
<stdin>:1:24: note: scanning from here
-o blah.o -x c++ llvm.org
                       ^


I think FileCheck's '*' regex operator should not be greedy,
i.e. match the minimum necessary not the maximum.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160830/eb9d5304/attachment.html>


More information about the llvm-bugs mailing list