diff options
author | David L. Jones <dlj@google.com> | 2019-05-13 20:32:53 +0000 |
---|---|---|
committer | David L. Jones <dlj@google.com> | 2019-05-13 20:32:53 +0000 |
commit | 3cce23746edfc6c24f25b73bd8032582df03222c (patch) | |
tree | f41af01a58f2542af03657a9fa56d9a6fc34c1c1 /llvm/unittests/Support/CommandLineTest.cpp | |
parent | 323dc634b984b7d30e10b82ae4e9536559488f70 (diff) | |
download | llvm-3cce23746edfc6c24f25b73bd8032582df03222c.zip llvm-3cce23746edfc6c24f25b73bd8032582df03222c.tar.gz llvm-3cce23746edfc6c24f25b73bd8032582df03222c.tar.bz2 |
[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
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
-rw-r--r-- | llvm/unittests/Support/CommandLineTest.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index 2bf07e3..4fb20b1 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)); |