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
8231591: [TESTBUG] Create additional two phase jpackage tests #263
Conversation
|
@sashamatveev The following label will be automatically applied to this pull request: 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 |
Webrevs
|
How about testing of other jpackage command line options in two phase mode? Like "--name", "--version"? Any plans to add them?
@@ -524,6 +546,7 @@ private static String stringifyShellCommands(List<String> commands) { | |||
|
|||
private final List<LinuxFileAssociation> associations; | |||
|
|||
private static boolean initAppImageLaunchers = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the logic behind static variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used to avoid infinite calls in DesktopIntegration(). I modified it by removing PREDEFINED_APP_IMAGE from launcherParams.
cmd.verifyIsOfType(PackageType.WINDOWS); | ||
this.cmd = cmd; | ||
this.name = name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to have the following initialization of "name" field:
this.name = (name == null ? cmd.name() : name)
This will help to avoid multiple (name == null ? cmd.name() : name)
in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
public class MultiLauncherTwoPhaseTest { | ||
|
||
public static void main(String[] args) throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace main() function with dedicated test function. You can use SimplePackageTest as a template, This would give better control on how to run the test in debug mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
.addInstallVerifier(cmd -> { | ||
launcher1.verify(cmd); | ||
launcher1.verifyPackageInstalled(cmd); | ||
launcher2.verify(cmd); | ||
launcher2.verifyPackageInstalled(cmd); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a duplicate of verify logic added with the preceding addInstallVerifier() call.
"--win-menu-group", "MultiLauncherTwoPhaseTest"); | ||
}) | ||
.addInstallVerifier(cmd -> { | ||
launcher1.verify(cmd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need in explicit call to AdditionalLauncher.verify() as this function is scheduled for the call from AdditionalLauncher.applyTo() call.
Thus there is no need to change access to this function from "private" to "public" in your patch to AdditionalLauncher.java.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
public static void main(String[] args) throws Exception { | ||
TKit.run(args, () -> { | ||
Path appimageOutput = TKit.workDir().resolve("appimage"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use TKit.createTempDirectory() to create directories for intermediate data of test runs. This allows clean multiple runs of the test in the same work directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Path appInstallDir = cmd.appInstallationDirectory(); | ||
if (TKit.isLinux() && Path.of("/").equals(appInstallDir)) { | ||
ApplicationLayout appLayout = cmd.appLayout(); | ||
TKit.assertPathExists(appLayout.runtimeDirectory(), false); | ||
} else { | ||
TKit.assertPathExists(appInstallDir, false); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what is going on here and why branching is required. Also seems like verifyPackageUninstalled() function is never called.
new WindowsHelper.DesktopIntegrationVerifier(cmd); | ||
new WindowsHelper.DesktopIntegrationVerifier(cmd, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather add a loop calling DesktopIntegrationVerifier() for all launchers than copy/paste the code in AdditionalLauncher.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. I also removed code from AdditionalLaunchers.
Plan was to file separate bugs for any additional options. I do not think we should put everything in one issue. This issue for desktop integration for additional launchers. |
Agree that separate bugs can be filed for additional options, can you file them ? |
@@ -618,6 +633,7 @@ private void verifyPackageUninstalled(JPackageCommand cmd) { | |||
private Map<PackageType, Handler> handlers; | |||
private Set<String> namedInitializers; | |||
private Map<PackageType, PackageHandlers> packageHandlers; | |||
private final List<String> launchersName = new ArrayList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the variable name "launcherNames" be more accurate?
@@ -317,6 +317,11 @@ public PackageTest configureHelloApp(String javaAppDesc) { | |||
return this; | |||
} | |||
|
|||
public PackageTest addLauncherName(String name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to make this function public and explicitly call it from tests.
It would be better to add call to this function from AdditionalLauncher.applyTo(PackageTest).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But test calls AdditionalLauncher.applyTo(JPackageCommand cmd), which does not have reference to PackageTest. Do you know why we need two applyTo()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just change the test code to call AdditionalLauncher.applyTo(PackageTest):
launcher1.applyTo(packageTest); launcher2.applyTo(packageTest)
AdditionalLauncher.applyTo(JPackageCommand) is for non-packaging tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it will not work. I am running appImageCmd command before test executes to generate app image. If I add it to packageTest, jpackage will fail when trying to run command with app-image and launchers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will keep addLauncherName() inside test to add launchers manually and will also call it in applyTo(PackageTest) for future tests, that might use such functionality.
@sashamatveev This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
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 156 new commits pushed to the
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.
|
/integrate |
@sashamatveev Since your change was applied there have been 156 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 5a57945. |
https://bugs.openjdk.java.net/browse/JDK-8231591
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/263/head:pull/263
$ git checkout pull/263