Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8350013: Add a test for JDK-8150442 #23825

Open
wants to merge 49 commits into
base: master
Choose a base branch
from

Conversation

alexeysemenyukoracle
Copy link
Member

@alexeysemenyukoracle alexeysemenyukoracle commented Feb 27, 2025

Add a test to verify jpackage is using a custom MSI condition blocking package installation depending on the version of Windows where the package installer runs. Support for this MSI condition was added in JDK-8150442.

The test adds an unconditionally failing OS-version MSI condition to the resource directory. MSI installer using this condition should always fail. The exit code of the failed installation would be 1603. Extended error information can be dug in the MSI log file. To make the test work, the following changes to jpackage test lib have been made:

  • Support non-0 exit code from MSI install handler. Support for non-0 exit codes was added to install handlers of all other types too. Added PackageTest.setExpectedInstallExitCode(int) method to configure the expected exit code of a package installation;
  • Support using msi log files when MSI and EXE packages get installed, unpacked, or uninstalled. Added PackageTest.createMsiLog(boolean) to enable or disable creation of msi log files in a PackageTest instance and Optional<Path> JPackageCommand.winMsiLogFile() to access the current log file from the callbacks registered with the PackageTest instance.

Added tests for PackageTest class (PackageTestTest).

Additionally, improved the code in WindowsHelper detecting paths to Start Menu, Desktop, and other common paths. Previously, it relied on reading these paths from the registry. On some machines, required registry keys are not available. The code now will call .NET Environment.GetFolderPath() function through powershell if a registry key is missing.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8350013: Add a test for JDK-8150442 (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23825/head:pull/23825
$ git checkout pull/23825

Update a local copy of the PR:
$ git checkout pull/23825
$ git pull https://git.openjdk.org/jdk.git pull/23825/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23825

View PR using the GUI difftool:
$ git pr show -t 23825

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23825.diff

Using Webrev

Link to Webrev Comment

…annotation if the class has a function with the given name and @test annotation
…only in the test work directory but in the sub-directories too.
…s. Make WindowsHelper use PS as alternative to reading registry values to get paths of special folders
@bridgekeeper
Copy link

bridgekeeper bot commented Feb 27, 2025

👋 Welcome back asemenyuk! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Feb 27, 2025

@alexeysemenyukoracle This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8350013: Add a test for JDK-8150442

Reviewed-by: almatvee

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 40 new commits pushed to the master branch:

  • 3c72c04: 8350818: Improve OperatingSystemMXBean cpu load tests to not accept -1.0 by default
  • 6b719ee: 8348596: Update FreeType to 2.13.3
  • a87dd1a: 8347139: [macos] Test tools/jpackage/share/InOutPathTest.java failed: "execution error: Finder got an error: AppleEvent timed out."
  • c7fa499: 8350118: Simplify the layout access VarHandle
  • fb659eb: 8350915: [JMH] test SocketChannelConnectionSetup failed for 2 threads config
  • 3a7d986: 8350646: Calendar.Builder.build() Throws ArrayIndexOutOfBoundsException
  • 197004f: 8350820: OperatingSystemMXBean CpuLoad() methods return -1.0 on Windows
  • e98df71: 8348028: Unable to run gtests with CDS enabled
  • d6c4be6: 8350758: G1: Use actual last prediction in accumulated survivor rate prediction too
  • 2019f44: 8343832: Enhance test summary with number of skipped tests
  • ... and 30 more: https://git.openjdk.org/jdk/compare/0f82268134df65bbc65ecda158d25f708f18d150...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Feb 27, 2025

⚠️ @alexeysemenyukoracle This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk
Copy link

openjdk bot commented Feb 27, 2025

@alexeysemenyukoracle The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@alexeysemenyukoracle alexeysemenyukoracle marked this pull request as ready for review February 27, 2025 17:33
@alexeysemenyukoracle
Copy link
Member Author

@sashamatveev PTAL

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 27, 2025
@mlbridge
Copy link

mlbridge bot commented Feb 27, 2025

Webrevs

Copy link
Member

@sashamatveev sashamatveev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with minor comments.

}

void configureUninstallVerifiers(PackageTest test, Consumer<Verifiable> verifiableAccumulator) {
for (final var verifier : uninstallVerifiers) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space after verifier.

case SKIP_NO_PACKAGE_HANDLER -> {
TKit.trace(String.format("No handler of [%s] action for %s command",
action, cmd.getPrintableCommandLine()));
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need return here and at line 495? Also, do you think it might be better to make switch consistent? For example this one uses -> and below :.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need return here and at line 495?

Yes. It should exit the function early to avoid jumping in the next switch block.

do you think it might be better to make switch consistent?

Totally!

Copy link
Member

@sashamatveev sashamatveev Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It should exit the function early to avoid jumping in the next switch block.

With -> it should not fall into next case. Maybe I am missing something.

Copy link
Member Author

@alexeysemenyukoracle alexeysemenyukoracle Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With -> it should not fall into next case. Maybe I am missing something.

Right, but there are two siwtch blocks in the function. Without return the control flow will get to the second one. return-s prevents this.

@openjdk openjdk bot removed the rfr Pull request is ready for review label Feb 28, 2025
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 28, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs [email protected] ready Pull request is ready to be integrated rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants