Suppress stderr noise when test case runs.
authorNick Kledzik <kledzik@apple.com>
Tue, 31 Jul 2012 22:18:15 +0000 (22:18 +0000)
committerNick Kledzik <kledzik@apple.com>
Tue, 31 Jul 2012 22:18:15 +0000 (22:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161085 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/Support/YAMLParserTest.cpp

index e88427ac09d3eee87da3eae92eba93f37178d304..480a5739f44464092d8901e536e4cf0ec8042fd4 100644 (file)
 
 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;
 }