The JDK-8314823 showed up a number of tests that ignore JVM flags or are interested in controlling some of them. Such tests usually reach that control by spawning 2nd process without using the `ProcessTools.createTestJvm(...)` and therefore not forwarding additional JVM arguments passed to them.
Marking such tests `vm.flagless` seems like an overkill in many cases. Good behaviour would be to skip them if JVM arguments provided by either 'test.vm.opts' or 'test.java.opts' contain combinations not accepted by the test.
I suggest adding functionality to Utils that would allow in a simple and concise manner to specify the JVM flags requirements.
Speaking of the scenarios and APIs, in discussions we've identified 3 basic cases... but this obviously is open to discussions. So, we skip the test if:
1. any of provided arguments are present. Sample:
Utils.skipIfJvmArgsHaveAnyOf("TieredStopAtLevel", "TieredCompilation")
(that is, the test wants to control Tiered compilation strategy)
2. None of provided arguments is present. Sample:
Utils.skipIfJvmArgsHaveNoneOf("UseZGC", "ZGenerational")
3. VM has any arguments other than some allowed white list.
That is needed mostly for flaky and sensitive tests.
Marking such tests `vm.flagless` seems like an overkill in many cases. Good behaviour would be to skip them if JVM arguments provided by either 'test.vm.opts' or 'test.java.opts' contain combinations not accepted by the test.
I suggest adding functionality to Utils that would allow in a simple and concise manner to specify the JVM flags requirements.
Speaking of the scenarios and APIs, in discussions we've identified 3 basic cases... but this obviously is open to discussions. So, we skip the test if:
1. any of provided arguments are present. Sample:
Utils.skipIfJvmArgsHaveAnyOf("TieredStopAtLevel", "TieredCompilation")
(that is, the test wants to control Tiered compilation strategy)
2. None of provided arguments is present. Sample:
Utils.skipIfJvmArgsHaveNoneOf("UseZGC", "ZGenerational")
3. VM has any arguments other than some allowed white list.
That is needed mostly for flaky and sensitive tests.