summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid L. Jones <dlj@google.com>2019-05-13 20:32:53 +0000
committerDavid L. Jones <dlj@google.com>2019-05-13 20:32:53 +0000
commit3cce23746edfc6c24f25b73bd8032582df03222c (patch)
treef41af01a58f2542af03657a9fa56d9a6fc34c1c1
parent323dc634b984b7d30e10b82ae4e9536559488f70 (diff)
downloadbcm5719-llvm-3cce23746edfc6c24f25b73bd8032582df03222c.tar.gz
bcm5719-llvm-3cce23746edfc6c24f25b73bd8032582df03222c.zip
[Support] Ensure redirected outputs don't contain output from previous tests.
stdout may be buffered, and may not flush on every write. Explicitly flushing before redirecting the output ensures that the captured output does not contain output from other tests. llvm-svn: 360617
-rw-r--r--llvm/unittests/Support/CommandLineTest.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index 2bf07e37494..4fb20b18d9b 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -1085,6 +1085,7 @@ public:
// Return std::string because the output of a failing EXPECT check is
// unreadable for StringRef. It also avoids any lifetime issues.
template <typename... Ts> std::string runTest(Ts... OptionAttributes) {
+ outs().flush(); // flush any output from previous tests
AutoDeleteFile File;
{
OutputRedirector Stdout(fileno(stdout));
OpenPOWER on IntegriCloud