Currently, each jpackage JUnit test class is accompanied with
/*
* @test
* @modules jdk.jpackage
* @compile --patch-module jdk.jpackage=${test.src} --add-reads jdk.jpackage=ALL-UNNAMED --add-exports jdk.jpackage/jdk.jpackage.internal=ALL-UNNAMED PathGroupTest.java
* @run junit/othervm --patch-module jdk.jpackage=${test.classes} --add-reads jdk.jpackage=ALL-UNNAMED --add-exports jdk.jpackage/jdk.jpackage.internal=ALL-UNNAMED jdk.jpackage.internal.PathGroupTest
*/
comment. The comment was added in JDK-8292316 patch. It would be better to eliminate it as it is duplicated across all jpackage JUnit tests.
When JDK-8292316 was fixed jtreg provided only experimental support for "JUnit.dirs" property that would eliminate the need to place "@run junit/othervm" comment in each JUnit test.
Recent jtreg officially supports "JUnit.dirs" property.
Christian Stein suggested the following changes to eliminate the need to have "@run junit/othervm" comment in each jpackage JUnit test:
1. Move JUnit tests from "test/jdk/tools/jpackage/junit" to "test/jdk/tools/jpackage/junit/jdk.jpackage" directory.
2. Add "test/jdk/tools/jpackage/junit/TEST.properties" file with "JUnit.dirs = ." contents.