RFR: 8352435: Refactor CDS test library for execution and module packaging [v2]
Ioi Lam
iklam at openjdk.org
Wed Mar 19 23:03:51 UTC 2025
> In CDS/AOT testing, we have a lot of code that deal with compiling/packaging modules, as well as running various child processes for the training/assembly/production phases.
>
> Currently, these operations are done in many low-level steps, so it's difficult to understand and maintain:
>
> https://github.com/openjdk/jdk/blob/fcc2a24291d499f7149debad1250903ddc369d91/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ExportModule.java
>
> This PR adds a few new classes to simplify the test cases:
>
> Example: build two modular JAR files into `modulePath`
>
>
> CDSModulePackager modulePackager = new CDSModulePackager(SRC);
> modulePath = modulePackager.getOutputDir().toString();
>
> modulePackager.createModularJar("com.foos");
> modulePackager.createModularJar("com.needsfoosaddexport",
> "--add-exports",
> "com.foos/com.foos.internal=com.needsfoosaddexport");
>
>
> Example: use modules in training/assembly/production phases
>
>
> SimpleCDSAppTester.of("moduleNeedsJdkAddExport")
> .classpath(dummyJar)
> .modulepath(modulePath)
> .addVmArgs("--add-modules", "com.needsjdkaddexport",
> "--add-exports", "java.base/jdk.internal.misc=com.needsjdkaddexport", "-Xlog:cds")
> .appCommandLine("-m", "com.needsjdkaddexport/com.needsjdkaddexport.Main")
> .setAssemblyChecker((OutputAnalyzer out) -> {
> out.shouldContain("Full module graph = enabled");
> })
> .setProductionChecker((OutputAnalyzer out) -> {
> out.shouldContain("use_full_module_graph = true; java.base");
> })
> .runStaticWorkflow()
> .runAOTWorkflow();
Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
added comments
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/24122/files
- new: https://git.openjdk.org/jdk/pull/24122/files/88b4bd58..6a95590b
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=24122&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=24122&range=00-01
Stats: 6 lines in 1 file changed: 5 ins; 1 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/24122.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24122/head:pull/24122
PR: https://git.openjdk.org/jdk/pull/24122
More information about the hotspot-runtime-dev
mailing list