5 #define BOOST_TEST_MODULE UnitTests 6 #include <boost/test/unit_test.hpp> 12 struct ConfigureLoggingFixture
14 ConfigureLoggingFixture()
25 #include <boost/iostreams/filtering_stream.hpp> 26 #include <boost/iostreams/tee.hpp> 28 #include <common/include/WindowsWrapper.hpp> 30 using namespace boost::iostreams;
33 struct DebugOutputSink : boost::iostreams::sink
35 std::streamsize write(
const char* s, std::streamsize n)
38 std::string s2(s, armnn::numeric_cast<size_t>(n));
39 OutputDebugString(s2.c_str());
44 class SetupDebugOutput
50 m_OutputStream.push(tee(std::cout));
51 m_OutputStream.push(m_DebugOutputSink);
53 boost::unit_test::unit_test_log.set_stream(m_OutputStream);
56 filtering_ostream m_OutputStream;
57 DebugOutputSink m_DebugOutputSink;
62 #endif // defined(_MSC_VER) 72 struct StreamRedirector
75 StreamRedirector(std::ostream& stream, std::streambuf* newStreamBuffer)
77 , m_BackupBuffer(m_Stream.rdbuf(newStreamBuffer))
79 ~StreamRedirector() { m_Stream.rdbuf(m_BackupBuffer); }
82 std::ostream& m_Stream;
83 std::streambuf* m_BackupBuffer;
87 StreamRedirector redirect(std::cout, ss.rdbuf());
89 using namespace armnn;
105 BOOST_CHECK(ss.str().find(
"Trace: My trace message; -2") != std::string::npos);
106 BOOST_CHECK(ss.str().find(
"Debug: My debug message; -1") != std::string::npos);
107 BOOST_CHECK(ss.str().find(
"Info: My info message; 0") != std::string::npos);
108 BOOST_CHECK(ss.str().find(
"Warning: My warning message; 1") != std::string::npos);
109 BOOST_CHECK(ss.str().find(
"Error: My error message; 2") != std::string::npos);
110 BOOST_CHECK(ss.str().find(
"Fatal: My fatal message; 3") != std::string::npos);
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_AUTO_TEST_CASE(LoggerTest)
void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
#define ARMNN_LOG(severity)
Copyright (c) 2021 ARM Limited and Contributors.
void SetLogFilter(LogSeverity level)
void ConfigureLoggingTest()
BOOST_AUTO_TEST_SUITE_END()
BOOST_GLOBAL_FIXTURE(ConfigureLoggingFixture)