mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8350824: New async logging gtest StallingModePreventsDroppedMessages fails
Reviewed-by: mbaesken, dholmes
This commit is contained in:
parent
eada1ea8d2
commit
ac76d8d63f
@ -253,18 +253,6 @@ TEST_VM_F(AsyncLogTest, droppingMessage) {
|
||||
EXPECT_TRUE(file_contains_substring(TestLogFileName, "messages dropped due to async logging"));
|
||||
}
|
||||
|
||||
TEST_VM_F(AsyncLogTest, StallingModePreventsDroppedMessages) {
|
||||
if (AsyncLogWriter::instance() == nullptr) {
|
||||
return;
|
||||
}
|
||||
set_log_config(TestLogFileName, "logging=debug");
|
||||
LogConfiguration::AsyncMode prev_mode = LogConfiguration::async_mode();
|
||||
LogConfiguration::set_async_mode(LogConfiguration::AsyncMode::Off);
|
||||
test_asynclog_drop_messages();
|
||||
EXPECT_FALSE(file_contains_substring(TestLogFileName, "messages dropped due to async logging"));
|
||||
LogConfiguration::set_async_mode(prev_mode);
|
||||
}
|
||||
|
||||
TEST_VM_F(AsyncLogTest, stdoutOutput) {
|
||||
testing::internal::CaptureStdout();
|
||||
|
||||
@ -272,7 +260,8 @@ TEST_VM_F(AsyncLogTest, stdoutOutput) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool async = AsyncLogWriter::instance() != nullptr;
|
||||
bool async = AsyncLogWriter::instance() != nullptr
|
||||
&& LogConfiguration::async_mode() == LogConfiguration::AsyncMode::Drop;
|
||||
if (async) {
|
||||
test_asynclog_drop_messages();
|
||||
AsyncLogWriter::flush();
|
||||
@ -301,7 +290,8 @@ TEST_VM_F(AsyncLogTest, stderrOutput) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool async = AsyncLogWriter::instance() != nullptr;
|
||||
bool async = AsyncLogWriter::instance() != nullptr
|
||||
&& LogConfiguration::async_mode() == LogConfiguration::AsyncMode::Drop;
|
||||
if (async) {
|
||||
test_asynclog_drop_messages();
|
||||
AsyncLogWriter::flush();
|
||||
|
||||
@ -35,19 +35,22 @@ import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
public class StressAsyncUL {
|
||||
static void analyze_output(String... args) throws Exception {
|
||||
static void analyze_output(boolean stalling_mode, String... args) throws Exception {
|
||||
ProcessBuilder pb =
|
||||
ProcessTools.createLimitedTestJavaProcessBuilder(args);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldHaveExitValue(0);
|
||||
if (stalling_mode) {
|
||||
output.shouldNotContain("messages dropped due to async logging");
|
||||
}
|
||||
}
|
||||
public static void main(String[] args) throws Exception {
|
||||
analyze_output("-Xlog:async:drop", "-Xlog:all=trace", InnerClass.class.getName());
|
||||
analyze_output("-Xlog:async:stall", "-Xlog:all=trace", InnerClass.class.getName());
|
||||
analyze_output(false, "-Xlog:async:drop", "-Xlog:all=trace", InnerClass.class.getName());
|
||||
analyze_output(true, "-Xlog:async:stall", "-Xlog:all=trace", InnerClass.class.getName());
|
||||
// Stress test with a very small buffer. Note: Any valid buffer size must be able to hold a flush token.
|
||||
// Therefore the size of the buffer cannot be zero.
|
||||
analyze_output("-Xlog:async:drop", "-Xlog:all=trace", "-XX:AsyncLogBufferSize=192", InnerClass.class.getName());
|
||||
analyze_output("-Xlog:async:stall", "-Xlog:all=trace", "-XX:AsyncLogBufferSize=192", InnerClass.class.getName());
|
||||
analyze_output(false, "-Xlog:async:drop", "-Xlog:all=trace", "-XX:AsyncLogBufferSize=192", InnerClass.class.getName());
|
||||
analyze_output(true, "-Xlog:async:stall", "-Xlog:all=trace", "-XX:AsyncLogBufferSize=192", InnerClass.class.getName());
|
||||
}
|
||||
|
||||
public static class InnerClass {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user