diff --git a/test/hotspot/gtest/logging/test_asynclog.cpp b/test/hotspot/gtest/logging/test_asynclog.cpp index cb674603563..ebc3e35a4b9 100644 --- a/test/hotspot/gtest/logging/test_asynclog.cpp +++ b/test/hotspot/gtest/logging/test_asynclog.cpp @@ -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(); diff --git a/test/hotspot/jtreg/runtime/logging/StressAsyncUL.java b/test/hotspot/jtreg/runtime/logging/StressAsyncUL.java index 1fa6ab76ec2..e14cad6cc65 100644 --- a/test/hotspot/jtreg/runtime/logging/StressAsyncUL.java +++ b/test/hotspot/jtreg/runtime/logging/StressAsyncUL.java @@ -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 {