< prev index next >

test/hotspot/gtest/logging/test_logMessageTest.cpp

Print this page
rev 58036 : [mq]: asynclog

*** 213,222 **** --- 213,255 ---- }; EXPECT_TRUE(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected)) << "error in prefixed output"; } + TEST_VM_F(LogMessageTest, nwrite) { + const char* msg = "The quick brown fox jumps over the lazy dog"; + const char* msg2 = "test-without-prefix"; + Arena* arena = new (mtLogging)Arena(mtLogging); + LogMessageBuffer buf(arena); + + buf.set_prefix(dummy_prefixer); + size_t len = strlen(msg); + // keep writing until reallocation + while (buf._message_buffer_size + < LogMessageBuffer::InitialMessageBufferCapacity * 3) { + buf.write_n(LogLevel::Trace, msg, len); + } + + buf.set_prefix(NULL); + len = strlen(msg2); + buf.write_n(LogLevel::Trace, msg2, len); + _log.write(buf); + + const char* expected[] = { + "] some prefix: The quick brown fox jumps over the lazy dog", + "] some prefix: The quick brown fox jumps over the lazy dog", + "] some prefix: The quick brown fox jumps over the lazy dog", + "] test-without-prefix", + NULL + }; + + EXPECT_TRUE(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected)) + << "error in prefixed output"; + + delete arena; + } + TEST_VM_F(LogMessageTest, scoped_messages) { { LogMessage(logging) msg; msg.info("scoped info"); msg.warning("scoped warn");
< prev index next >