RFR: 8352107: Allow jtreg test cases to query test VM properties
Jaikiran Pai
jpai at openjdk.org
Mon Mar 17 10:58:02 UTC 2025
On Mon, 17 Mar 2025 08:46:06 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> So I think the best solution may be for jtreg to save the properties to a location of its choice, and pass this location to the test cases with a property like test.vm.properties.file.
>From what I understand of the use case, certain parts of the test code would like to use key/value pairs whose keys are pre-defined in the JDK testsuite and values are computed by testsuite specific class, before jtreg launches the tests. These set of key/value pairs are currently used by jtreg in the evaluation of the `@requires` tag of the test definition. The proposal here is to make available that same key/value pairs to the test code itself (once the test is launched) so that they can do additional decisions based on those properties.
If I understood that correctly then the proposal in jtreg would be to expose the https://github.com/openjdk/jtreg/blob/master/src/share/classes/com/sun/javatest/regtest/config/RegressionContext.java#L38. Since tests are not expected to rely on jtreg classes/types, the way to expose that detail would be by persisting the key/value pairs to a (properties) file whose path is then passed along to the test as a standard jtreg system property like the ones noted in https://openjdk.org/jtreg/tag-spec.html#testvars. I think that's doable. Could you file a request for this in the CODETOOLS project? I would need additional inputs from others in that project whether it's a good thing to expose this but based on my limited knowledge of that project, I think it's OK to do that.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24071#issuecomment-2729061175
More information about the core-libs-dev
mailing list