Index: llvm/test/FileCheck/check-label-dag.txt =================================================================== --- llvm/test/FileCheck/check-label-dag.txt +++ llvm/test/FileCheck/check-label-dag.txt @@ -1,4 +1,4 @@ -; RUN: not FileCheck -input-file %s %s 2>&1 | FileCheck --check-prefix=ERROR %s +; RUN: not FileCheck -verbose=false -input-file %s %s 2>&1 | FileCheck --check-prefix=ERROR %s bar zed Index: llvm/test/FileCheck/check-label.txt =================================================================== --- llvm/test/FileCheck/check-label.txt +++ llvm/test/FileCheck/check-label.txt @@ -1,5 +1,5 @@ ; RUN: FileCheck -input-file %s %s -check-prefix=CHECKOK -; RUN: not FileCheck -input-file %s %s -check-prefix=CHECKFAIL 2>&1 | FileCheck %s -check-prefix=CHECKERROR +; RUN: not FileCheck -verbose=false -input-file %s %s -check-prefix=CHECKFAIL 2>&1 | FileCheck %s -check-prefix=CHECKERROR label0: a Index: llvm/test/FileCheck/check-multiple-prefixes-nomatch-2.txt =================================================================== --- llvm/test/FileCheck/check-multiple-prefixes-nomatch-2.txt +++ llvm/test/FileCheck/check-multiple-prefixes-nomatch-2.txt @@ -1,4 +1,4 @@ -; RUN: not FileCheck -input-file %s %s -check-prefix=FOO -check-prefix=BAR 2>&1 | FileCheck %s +; RUN: not FileCheck -verbose=false -input-file %s %s -check-prefix=FOO -check-prefix=BAR 2>&1 | FileCheck %s fog bar Index: llvm/test/FileCheck/check-multiple-prefixes-nomatch.txt =================================================================== --- llvm/test/FileCheck/check-multiple-prefixes-nomatch.txt +++ llvm/test/FileCheck/check-multiple-prefixes-nomatch.txt @@ -1,4 +1,4 @@ -; RUN: not FileCheck -input-file %s %s -check-prefix=FOO -check-prefix=BAR 2>&1 | FileCheck %s +; RUN: not FileCheck -verbose=false -input-file %s %s -check-prefix=FOO -check-prefix=BAR 2>&1 | FileCheck %s BAR bar Index: llvm/test/FileCheck/check-not-diaginfo.txt =================================================================== --- llvm/test/FileCheck/check-not-diaginfo.txt +++ llvm/test/FileCheck/check-not-diaginfo.txt @@ -1,4 +1,4 @@ -; RUN: not FileCheck -input-file %s %s 2>&1 | FileCheck -check-prefix DIAG %s +; RUN: not FileCheck -verbose=false -input-file %s %s 2>&1 | FileCheck -check-prefix DIAG %s CHECK-NOT: test Index: llvm/utils/FileCheck/FileCheck.cpp =================================================================== --- llvm/utils/FileCheck/FileCheck.cpp +++ llvm/utils/FileCheck/FileCheck.cpp @@ -68,6 +68,10 @@ "Allows leading and trailing whitespace if --strict-whitespace\n" "is not also passed.")); +static cl::opt Verbose( + "verbose", cl::init(false), + cl::desc("(T.B.D.)")); + typedef cl::list::const_iterator prefix_iterator; //===----------------------------------------------------------------------===// @@ -1301,6 +1305,13 @@ int main(int argc, char **argv) { sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); + + // Override default value of Verbose + if (auto p = std::getenv("LLVM_FILECHECK")) { + if (StringRef(p) == "-verbose") + Verbose = true; + } + cl::ParseCommandLineOptions(argc, argv); if (!ValidateCheckPrefixes()) { @@ -1342,6 +1353,15 @@ // Check that we have all of the expected strings, in order, in the input // file. StringRef Buffer = F->getBuffer(); + if (Verbose) { + errs() << "================\nCommand line:"; + for (int i = 0; i < argc; ++i) + errs() << " " << argv[i]; + errs() << "\n================\n" + << Buffer + << "\n================\n"; + } + SM.AddNewSourceBuffer(std::move(F), SMLoc()); Index: llvm/utils/lit/lit/TestingConfig.py =================================================================== --- llvm/utils/lit/lit/TestingConfig.py +++ llvm/utils/lit/lit/TestingConfig.py @@ -25,6 +25,12 @@ pass_vars = ['LIBRARY_PATH', 'LD_LIBRARY_PATH', 'SYSTEMROOT', 'TERM', 'LD_PRELOAD', 'ASAN_OPTIONS', 'UBSAN_OPTIONS', 'LSAN_OPTIONS', 'ADB', 'ANDROID_SERIAL'] + + # Passed vars can be defined in LIT_PASS_VARS, like "TEMP:TMP:TMPDIR" + extra_pass_vars = os.environ.get("LIT_PASS_VARS") + if extra_pass_vars: + pass_vars.extend(extra_pass_vars.split(':')) + for var in pass_vars: val = os.environ.get(var, '') # Check for empty string as some variables such as LD_PRELOAD cannot be empty