[PATCH] D82601: [FileCheck] Permit multiple -v or -vv

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 14:44:58 PDT 2020


jdenny created this revision.
jdenny added reviewers: probinson, thopre, jhenderson, kpn.
Herald added a subscriber: kristof.beyls.
Herald added a project: LLVM.

`FILECHECK_OPTS` was implemented so that a test runner, such as CI, 
can specify FileCheck debugging options, such as `-v` and `-vv`.
However, if a test suite has a FileCheck call that already specifies
`-v` or `-vv`, then that call will fail if `FILECHECK_OPTS` also
specifies it.

For `-vv`, this problem already exists:

`clang/test/CodeGen/aarch64-v8.2a-fp16-intrinsics-constrained.c`

It's not yet clear if the `-vv` in that test was intentional, but this
usage shouldn't fail anyway.  It's already true that FileCheck permits
`-vv` and `-v` together even though `-vv` implies `-v`.

Compare D70784 <https://reviews.llvm.org/D70784>, which fixed the same problem for `-dump-input`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82601

Files:
  llvm/test/FileCheck/verbose.txt
  llvm/utils/FileCheck/FileCheck.cpp


Index: llvm/utils/FileCheck/FileCheck.cpp
===================================================================
--- llvm/utils/FileCheck/FileCheck.cpp
+++ llvm/utils/FileCheck/FileCheck.cpp
@@ -97,12 +97,12 @@
              "non-overlapping CHECK-DAG implementation.\n"));
 
 static cl::opt<bool> Verbose(
-    "v", cl::init(false),
+    "v", cl::init(false), cl::ZeroOrMore,
     cl::desc("Print directive pattern matches, or add them to the input dump\n"
              "if enabled.\n"));
 
 static cl::opt<bool> VerboseVerbose(
-    "vv", cl::init(false),
+    "vv", cl::init(false), cl::ZeroOrMore,
     cl::desc("Print information helpful in diagnosing internal FileCheck\n"
              "issues, or add it to the input dump if enabled.  Implies\n"
              "-v.\n"));
Index: llvm/test/FileCheck/verbose.txt
===================================================================
--- llvm/test/FileCheck/verbose.txt
+++ llvm/test/FileCheck/verbose.txt
@@ -1,10 +1,33 @@
-; RUN: %ProtectFileCheckOutput FileCheck -dump-input=never -input-file %s %s 2>&1 \
+; RUN: %ProtectFileCheckOutput \
+; RUN: FileCheck -dump-input=never -input-file %s %s 2>&1 \
 ; RUN: | FileCheck -check-prefix QUIET --allow-empty %s
-; RUN: %ProtectFileCheckOutput FileCheck -dump-input=never -v -input-file %s %s 2>&1 \
+
+; RUN: %ProtectFileCheckOutput \
+; RUN: FileCheck -dump-input=never -v -input-file %s %s 2>&1 \
+; RUN: | FileCheck --strict-whitespace -check-prefix V %s
+
+; RUN: %ProtectFileCheckOutput \
+; RUN: FileCheck -dump-input=never -vv -input-file %s %s 2>&1 \
+; RUN: | FileCheck --strict-whitespace -check-prefixes V,VV %s
+
+; RUN: %ProtectFileCheckOutput \
+; RUN: FileCheck -dump-input=never -v -v -input-file %s %s 2>&1 \
 ; RUN: | FileCheck --strict-whitespace -check-prefix V %s
-; RUN: %ProtectFileCheckOutput FileCheck -dump-input=never -vv -input-file %s %s 2>&1 \
+
+; RUN: %ProtectFileCheckOutput \
+; RUN: FileCheck -dump-input=never -vv -vv -input-file %s %s 2>&1 \
 ; RUN: | FileCheck --strict-whitespace -check-prefixes V,VV %s
 
+; RUN: %ProtectFileCheckOutput \
+; RUN: FileCheck -dump-input=never -v -vv -input-file %s %s 2>&1 \
+; RUN: | FileCheck --strict-whitespace -check-prefixes V,VV %s
+
+; RUN: %ProtectFileCheckOutput \
+; RUN: FileCheck -dump-input=never -vv -v -input-file %s %s 2>&1 \
+; RUN: | FileCheck --strict-whitespace -check-prefixes V,VV %s
+
+; END.
+
 foo
 bar
 CHECK: foo


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82601.273510.patch
Type: text/x-patch
Size: 2413 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200625/1c3906ee/attachment.bin>


More information about the llvm-commits mailing list