On Wed, 19 Mar 2025 20:09:51 GMT, Roger Riggs <[email protected]> wrote:
>> KIRIYAMA Takuya has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> 8352016: Improve java/lang/RuntimeTests/RuntimeExitLogTest.java
>
> test/jdk/java/lang/RuntimeTests/ExitLogging-FINER.properties line 8:
>
>> 6:
>> 7: java.util.logging.ConsoleHandler.level = ALL
>> 8: java.lang.Runtime.level = FINER
>
> It is a waste of resources to test every combination of logger levels.
> This is not a test of the filtering mechanism built into the logger; it is a
> test that the message is logged when the logger level is set to DEBUG or
> finer.
> Only two test cases are needed for that.
I see. This test only takes a very short time, but shouldn't the cases be added?
> test/jdk/java/lang/RuntimeTests/RuntimeExitLogTest.java line 78:
>
>> 76: "java\\.lang\\.Throwable: Runtime\\.exit\\(" + status +
>> "\\)\\n" +
>> 77: "\\s+at
>> java\\.base/java\\.lang\\.Shutdown\\.logRuntimeExit\\(Shutdown\\.java:\\d+\\)\\n"
>> +
>> 78: "\\s+at(?: .+)";
>
> Testing the exact logging message is too brittle/too exact.
> It should only be testing for the specific variable information that is
> unique to the case under test.
> It becomes burdensome to update tests when some small change occurs in a
> message.
The test should verify that the stack traces required for troubleshooting are
logged correctly.
It avoid verifying line numbers likely to change frequently.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24050#discussion_r2007141009
PR Review Comment: https://git.openjdk.org/jdk/pull/24050#discussion_r2007140416