From 55dcc422520b7de51d91a413eb8953725b066af4 Mon Sep 17 00:00:00 2001 From: Michal Gorny Date: Fri, 26 Jul 2019 15:38:57 +0000 Subject: [PATCH] [llvm] [FileCheck] Use FILECHECK_DUMP_INPUT_ON_FAILURE only when non-empty Enable dumping output only if FILECHECK_DUMP_INPUT_ON_FAILURE is set to a non-empty value. This is necessary to support disabling it via POSIX-compliant env(1) that does not support '-u' argument, and therefore fix regression caused by r366980. Differential Revision: https://reviews.llvm.org/D65334 llvm-svn: 367122 --- utils/FileCheck/FileCheck.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp index c882736d4bf..d9cad13c465 100644 --- a/utils/FileCheck/FileCheck.cpp +++ b/utils/FileCheck/FileCheck.cpp @@ -93,7 +93,8 @@ static cl::opt VerboseVerbose( static const char * DumpInputEnv = "FILECHECK_DUMP_INPUT_ON_FAILURE"; static cl::opt DumpInputOnFailure( - "dump-input-on-failure", cl::init(std::getenv(DumpInputEnv)), + "dump-input-on-failure", + cl::init(std::getenv(DumpInputEnv) && *std::getenv(DumpInputEnv)), cl::desc("Dump original input to stderr before failing.\n" "The value can be also controlled using\n" "FILECHECK_DUMP_INPUT_ON_FAILURE environment variable.\n"