From 204720bc71f69a07f111dc4ea35b959921d18bbf Mon Sep 17 00:00:00 2001 From: Nick Kledzik Date: Tue, 31 Jul 2012 22:18:15 +0000 Subject: [PATCH] Suppress stderr noise when test case runs. llvm-svn: 161085 --- llvm/unittests/Support/YAMLParserTest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/unittests/Support/YAMLParserTest.cpp b/llvm/unittests/Support/YAMLParserTest.cpp index e88427ac09d3..480a5739f444 100644 --- a/llvm/unittests/Support/YAMLParserTest.cpp +++ b/llvm/unittests/Support/YAMLParserTest.cpp @@ -16,11 +16,17 @@ namespace llvm { +static void SuppressDiagnosticsOutput(const SMDiagnostic &, void *) { + // Prevent SourceMgr from writing errors to stderr + // to reduce noise in unit test runs. +} + // Checks that the given input gives a parse error. Makes sure that an error // text is available and the parse fails. static void ExpectParseError(StringRef Message, StringRef Input) { SourceMgr SM; yaml::Stream Stream(Input, SM); + SM.setDiagHandler(SuppressDiagnosticsOutput); EXPECT_FALSE(Stream.validate()) << Message << ": " << Input; EXPECT_TRUE(Stream.failed()) << Message << ": " << Input; }