RFR: 8323529: Relativize test image dependencies in microbenchmarks

Erik Joelsson erikj at openjdk.org
Wed Jan 10 20:40:21 UTC 2024


On Wed, 10 Jan 2024 15:10:58 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> JMH microbenchmarks may have dependencies on artifacts in the test image outside of the benchmarks.jar. This includes native libraries (built into `$TEST_IMAGE/micro/native`) and may soon include other test libraries like wb.jar (built into `$TEST_IMAGE/lib-test/`)
> 
> By moving execution to the test image root (currently we run out of the `make` directory) we can make do with relative paths, which means benchmark can supply a build-time constant flag themselves rather than have the test runner provide it for you. And needing to be explicit about external dependencies is good, I think.
> 
> Taken together this makes the benchmarks.jar more self-contained and simpler to run: all you need is to run `java -jar micro/benchmarks.jar` from the test image root.
> 
> This patch also drive-by fixes some lang.foreign tests that were printing warnings due to a missing `--enable-native-access=ALL-UNNAMED` flag.

I think this is ok. For jtreg tests, we provide the path to the test image in a system property. I was going to suggest doing the same here, but referencing system properties in annotations isn't trivial. It would require implementing some kind of string interpolation for the `@Fork` annotation. Maybe that would still be more powerful and flexible if there are ever any other file paths that tests would need to reference into.

-------------

Marked as reviewed by erikj (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17349#pullrequestreview-1814130332


More information about the core-libs-dev mailing list