JDK-8316547 : Use JUnit.dir jtreg property with jpackage JUnit tests
  • Type: Enhancement
  • Component: tools
  • Sub-Component: jpackage
  • Affected Version: 22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2023-09-19
  • Updated: 2023-09-26
  • Resolved: 2023-09-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 22
22 b16Fixed
Related Reports
Relates :  
Relates :  
Description
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.

Comments
Hi [~asemenyuk] , before this change those tests had "@modules jdk.jpackage" in the test headers. on AIX we currently do not have the system module "jdk.jpackage" . So the tag in the test header caused that the test was not executed on AIX. Probably we should add some tags to the header again so that the test is not executed on AIX. (other question is if jtreg has some issue here too, but it is not the main issue anyway)
26-09-2023

[~mbaesken] It looks like jtreg issue to me. The best solution would be to revert the fix until jtreg is fixed. Making sure they will fix jtreg though.
25-09-2023

Seems the build - commands differ on AIX vs. Linux, see AIX : #section:build ----------messages:(3/691)---------- command: build jdk.jpackage.jdk.jpackage.internal.AppImageFileTest jdk.jpackage.jdk.jpackage.internal.ApplicationLayoutTest jdk.jpackage.jdk.jpackage.internal.CompareDottedVersionTest jdk.jpackage.jdk.jpackage.internal.DeployParamsTest jdk.jpackage.jdk.jpackage.internal.DottedVersionTest jdk.jpackage.jdk.jpackage.internal.EnquoterTest jdk.jpackage.jdk.jpackage.internal.InvalidDottedVersionTest jdk.jpackage.jdk.jpackage.internal.OverridableResourceTest jdk.jpackage.jdk.jpackage.internal.PathGroupTest jdk.jpackage.jdk.jpackage.internal.PlatformVersionTest jdk.jpackage.jdk.jpackage.internal.ToolValidatorTest reason: Named class compiled on demand started: Mon Sep 25 12:31:58 CEST 2023 result: Not run. Test running... test result: Error. can't find jdk.jpackage.jdk.jpackage.internal.AppImageFileTest in test directory or libraries Linux (works nicely) : #section:build ----------messages:(5/177)---------- command: build jdk.jpackage/* reason: Named class compiled on demand started: Mon Sep 25 13:18:59 CEST 2023 finished: Mon Sep 25 13:18:59 CEST 2023 elapsed time (seconds): 0.01 result: Passed. All files up to date Linux uses command: build jdk.jpackage/* while AIX has something different (and wrong). Maybe it is a jtreg issue ? might be related how BuildAction / JUnitAction works on AIX/Linux : https://github.com/openjdk/jtreg/blob/ef3865581bdfc55c6315a8538222fc3a91b2b872/src/share/classes/com/sun/javatest/regtest/exec/JUnitAction.java#L130 the enumeration of sources to build is for some reason different.
25-09-2023

Hi Alexey, unfortunately on AIX some jpackage tests now fail with test result: Error. can't find jdk.jpackage.jdk.jpackage.internal.AppImageFileTest in test directory or libraries e.g. tools/jpackage/junit/jdk.jpackage/jdk/jpackage/internal/DottedVersionTest.java tools/jpackage/junit/jdk.jpackage/jdk/jpackage/internal/EnquoterTest.java (we do not see this on other platforms like macOS, LINUX etc.)
25-09-2023

Changeset: 25681886 Author: Alexey Semenyuk <asemenyuk@openjdk.org> Date: 2023-09-19 21:43:35 +0000 URL: https://git.openjdk.org/jdk/commit/25681886304a87053574d4e4b0d1c3eeb4f02093
19-09-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15826 Date: 2023-09-19 20:15:20 +0000
19-09-2023