From 3cce23746edfc6c24f25b73bd8032582df03222c Mon Sep 17 00:00:00 2001 From: "David L. Jones" Date: Mon, 13 May 2019 20:32:53 +0000 Subject: [PATCH] [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 --- llvm/unittests/Support/CommandLineTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index 2bf07e374940..4fb20b18d9bf 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 std::string runTest(Ts... OptionAttributes) { + outs().flush(); // flush any output from previous tests AutoDeleteFile File; { OutputRedirector Stdout(fileno(stdout));