Apply the following patch so you know what's happening:
--- a/test/hotspot/gtest/logging/logTestFixture.cpp
+++ b/test/hotspot/gtest/logging/logTestFixture.cpp
@@ -87,6 +87,9 @@ void LogTestFixture::restore_config() {
// Extract the different parameters by replacing the spaces with NULLs.
char* str = _configuration_snapshot[i];
+ printf("restore_config(%d: %s)\n", (int)i, str);
char* name = str;
str = strchr(str, ' ');
============================
$ JAVA_TOOL_OPTIONS=-Xlog:cds:file=cds.log make test TEST=gtest:LogTest
Building target 'test-only' in configuration '/home/iklam/jdk/bld/nep'
Test selection 'gtest:LogTest', will run:
* gtest:LogTest/server
Running test 'gtest:LogTest/server'
Note: Google Test filter = LogTest*
[==========] Running 7 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 7 tests from LogTest
[ RUN ] LogTest.large_message_vm
Picked up JAVA_TOOL_OPTIONS: -Xlog:cds:file=cds.log
restore_config(0: stdout all=warning uptime,level,tags)
restore_config(1: stderr all=off uptime,level,tags)
restore_config(2: file=cds.log all=off,cds=info uptime,level,tags filecount=5,filesize=20480K,async=false)
open/test/hotspot/gtest/logging/logTestFixture.cpp:64: Failure
Expected equality of these values:
""
errmsg
Which is: "Invalid option 'async' for log file output.\nInitialization of output 'file=cds.log' using options 'filecount=5,filesize=20480K,async=false' failed.\n"
With diff:
@@ -1,1 +1,2 @@
-""
+Invalid option 'async' for log file output.
+Initialization of output 'file=cds.log' using options 'filecount=5,filesize=20480K,async=false' failed.\n
Unexpected error reported
open/test/hotspot/gtest/logging/logTestFixture.cpp:65: Failure
Value of: success
Actual: false
Expected: true
Shouldn't cause errors
============================================
[Background]
Unified Logging does not allow the options of a log output to be changed:
(1) Specifying the same output twice is OK:
$ java -Xlog:cds:file=foo -Xlog:gc:file=foo -Xlog:logging -version
...
[0.019s][info][logging] #2: file=foo all=off,gc=info,cds=info uptime,level,tags filecount=5,filesize=20480K,async=false
(2) But options can be specified only in the very first use of an output. I.e., the "async=true" for "-Xlog:gc:file=foo" is ignored:
$ java -Xlog:cds:file=foo -Xlog:gc:file=foo::async=true -Xlog:logging -version
[0.000s][warning][logging] Output options for existing outputs are ignored.
...
[0.018s][info ][logging] #2: file=foo all=off,gc=info,cds=info uptime,level,tags filecount=5,filesize=20480K,async=false
(3) The warning fails even if you try to set it to the same value as before:
$ java -Xlog:cds:file=foo -Xlog:gc:file=foo::async=false -Xlog:logging -version
[0.000s][warning][logging] Output options for existing outputs are ignored.
...
[0.018s][info ][logging] #2: file=foo all=off,gc=info,cds=info uptime,level,tags filecount=5,filesize=20480K,async=false
============================================
[Suggested fix]
Do not attempt to change the options of the outputs inside LogTestFixture::restore_config() -- No one is able to change them, so there's no need to "restore" the options.
--- a/test/hotspot/gtest/logging/logTestFixture.cpp
+++ b/test/hotspot/gtest/logging/logTestFixture.cpp
@@ -87,6 +87,9 @@ void LogTestFixture::restore_config() {
// Extract the different parameters by replacing the spaces with NULLs.
char* str = _configuration_snapshot[i];
+ printf("restore_config(%d: %s)\n", (int)i, str);
char* name = str;
str = strchr(str, ' ');
============================
$ JAVA_TOOL_OPTIONS=-Xlog:cds:file=cds.log make test TEST=gtest:LogTest
Building target 'test-only' in configuration '/home/iklam/jdk/bld/nep'
Test selection 'gtest:LogTest', will run:
* gtest:LogTest/server
Running test 'gtest:LogTest/server'
Note: Google Test filter = LogTest*
[==========] Running 7 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 7 tests from LogTest
[ RUN ] LogTest.large_message_vm
Picked up JAVA_TOOL_OPTIONS: -Xlog:cds:file=cds.log
restore_config(0: stdout all=warning uptime,level,tags)
restore_config(1: stderr all=off uptime,level,tags)
restore_config(2: file=cds.log all=off,cds=info uptime,level,tags filecount=5,filesize=20480K,async=false)
open/test/hotspot/gtest/logging/logTestFixture.cpp:64: Failure
Expected equality of these values:
""
errmsg
Which is: "Invalid option 'async' for log file output.\nInitialization of output 'file=cds.log' using options 'filecount=5,filesize=20480K,async=false' failed.\n"
With diff:
@@ -1,1 +1,2 @@
-""
+Invalid option 'async' for log file output.
+Initialization of output 'file=cds.log' using options 'filecount=5,filesize=20480K,async=false' failed.\n
Unexpected error reported
open/test/hotspot/gtest/logging/logTestFixture.cpp:65: Failure
Value of: success
Actual: false
Expected: true
Shouldn't cause errors
============================================
[Background]
Unified Logging does not allow the options of a log output to be changed:
(1) Specifying the same output twice is OK:
$ java -Xlog:cds:file=foo -Xlog:gc:file=foo -Xlog:logging -version
...
[0.019s][info][logging] #2: file=foo all=off,gc=info,cds=info uptime,level,tags filecount=5,filesize=20480K,async=false
(2) But options can be specified only in the very first use of an output. I.e., the "async=true" for "-Xlog:gc:file=foo" is ignored:
$ java -Xlog:cds:file=foo -Xlog:gc:file=foo::async=true -Xlog:logging -version
[0.000s][warning][logging] Output options for existing outputs are ignored.
...
[0.018s][info ][logging] #2: file=foo all=off,gc=info,cds=info uptime,level,tags filecount=5,filesize=20480K,async=false
(3) The warning fails even if you try to set it to the same value as before:
$ java -Xlog:cds:file=foo -Xlog:gc:file=foo::async=false -Xlog:logging -version
[0.000s][warning][logging] Output options for existing outputs are ignored.
...
[0.018s][info ][logging] #2: file=foo all=off,gc=info,cds=info uptime,level,tags filecount=5,filesize=20480K,async=false
============================================
[Suggested fix]
Do not attempt to change the options of the outputs inside LogTestFixture::restore_config() -- No one is able to change them, so there's no need to "restore" the options.