[llvm] r360617 - [Support] Ensure redirected outputs don't contain output from previous tests.
David L. Jones via llvm-commits
llvm-commits at lists.llvm.org
Mon May 13 13:32:53 PDT 2019
Author: dlj
Date: Mon May 13 13:32:53 2019
New Revision: 360617
URL: http://llvm.org/viewvc/llvm-project?rev=360617&view=rev
Log:
[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.
Modified:
llvm/trunk/unittests/Support/CommandLineTest.cpp
Modified: llvm/trunk/unittests/Support/CommandLineTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CommandLineTest.cpp?rev=360617&r1=360616&r2=360617&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/CommandLineTest.cpp (original)
+++ llvm/trunk/unittests/Support/CommandLineTest.cpp Mon May 13 13:32:53 2019
@@ -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));
More information about the llvm-commits
mailing list