-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8315097: Rename createJavaProcessBuilder #15452
Conversation
👋 Welcome back lkorinth! A progress list of the required criteria for merging this PR into |
@lkorinth The following labels 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 lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
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.
The. changes looks good. Please update copyrights for changed filed.
I expect that you completed execution of all tests to ensure that nothing is broken.
@lkorinth 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:
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 126 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. ➡️ To integrate this PR with the above commit message to the |
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 think the admonition about using this method is a bit strong in that it is natural to use this plain process builder method when a test is going to set its own specific flags for the exec'd process. But I'm okay with renaming to avoid copy'n'paste errors that accidentally use the wrong version.
Thanks
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 think this is the best change across so many files.
It gives a very ugly name to a common test function and affects a very large number of tests.
/reviewers 3 reviewer |
@RogerRiggs |
@RogerRiggs If it is only the name you want changed, maybe you can offer a better name? |
Sorry for the too short comment; I wanted to make sure it wasn't integrated before I could look at it more closely. |
...but it's used in 462 files. That implies it is commonly used. Are you suggesting nearly all those uses are incorrect and eventually should be converted to |
@RogerRiggs , @plummercj , please see the additional discussion in the parent bug: https://bugs.openjdk.org/browse/JDK-8314823 |
I don't think a name change is required. The method is createJavaProcessBuilder with a "list" of argurments and a builder is returned. As such, there is no inference, in the name, that test args will be propagated. Adding the additional java doc description should be sufficient to dispell any misconceptions. So you could create a single createJavaProcessBuilder with add an additional parameter boolean addTestOpts e.g. createProcessBuilderIgnoreJavaTestOpt(cmdArgs) maps to createJavaProcessBuilder(cmdArgs, false) createTestJvm(cmdArgs) maps to createJavaProcessBuilder(cmdArgs, true) But this is a lot more work. alternatively change createTestJvm to createTestJavaProcessBuilder or createJavaProcessBuilderAddTestOpts |
In the context of the goal is to declaratively identify tests that do or do not benefit from additional test flags renaming the The method name and javadoc of |
sorry... |
@lkorinth this pull request can not be integrated into git checkout _8315097
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
Hi, if you want to see what I have modified manually, you can do my sed commands and compare to this pull request:
It will give you an easier way to review. |
public static ProcessBuilder createTestJavaProcessBuilder(List<String> command) { | ||
return createTestJavaProcessBuilder(command.toArray(String[]::new)); |
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.
The javadoc shoul d describe all of the options being added to the ProcessBuilder.
They were inadequated described previously and still are.
The other options (seem to be from the code), test.noclasspath, java.class.path, and test.thread.factory.
The description of test.thread.factory and addTestThreadFactoryArgs method seems inadequately described.
/** | ||
* Create ProcessBuilder using the java launcher from the jdk to | ||
* be tested. | ||
* |
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.
As above, should described the limited options that are added to the ProcessBuilder, the same as for reateTestJavaProcessBuilder(...)
/** | ||
* Create ProcessBuilder using the java launcher from the jdk to | ||
* be tested. | ||
* |
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.
As above, should described the limited options that are added to the ProcessBuilder, the same as for reateTestJavaProcessBuilder(...)
@@ -562,7 +596,7 @@ public static OutputAnalyzer executeTestJvm(List<String> cmds) throws Exception | |||
* @return The output from the process. | |||
*/ | |||
public static OutputAnalyzer executeTestJvm(String... cmds) throws Exception { | |||
ProcessBuilder pb = createTestJvm(cmds); | |||
ProcessBuilder pb = createTestJavaProcessBuilder(cmds); |
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.
This should also describe all of the options being set in the ProcessBuilder before executing the process.
@RogerRiggs You seem to know what you want w.r.t. the extra java doc comments. Could you help write those? Could we also do that as a separate RFE? I think that would make it easier to get this PR and the javadoc update through the door. |
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.
Suggestions to complete the descriptions of the createXXXJavaProcessBuilder methods.
* createLimitedTestJavaProcessBuilder() you should probably use | ||
* it in combination with <b>@requires vm.flagless</b> JTREG | ||
* anotation as to not waste energy and test resources. | ||
* |
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.
Consider adding this description of what this method does.
* | |
* Unless the "test.noclasspath" property is "true" | |
* the classpath property "java.class.path" is appended to the command line and | |
* the environment of the ProcessBuilder is modified to remove "CLASSPATH". | |
* If the property "test.thread.factory" is provided the command args are | |
* updated and appended to invoke ProcessTools main() and provide the | |
* name of the thread factory. | |
* The "-Dtest.thread.factory" is appended to the arguments with the thread factory value. | |
* The remaining command args are scanned for unsupported options and | |
* are appended to the ProcessBuilder. | |
* createLimitedTestJavaProcessBuilder() you should probably use | ||
* it in combination with <b>@requires vm.flagless</b> JTREG | ||
* anotation as to not waste energy and test resources. | ||
* |
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.
* | |
* Unless the "test.noclasspath" property is "true" | |
* the classpath property "java.class.path" is appended to the command line and | |
* the environment of the ProcessBuilder is modified to remove "CLASSPATH". | |
* If the property "test.thread.factory" is provided the command args are | |
* updated and appended to invoke ProcessTools main() and provide the | |
* name of the thread factory. | |
* The "-Dtest.thread.factory" is appended to the arguments with the thread factory value. | |
* The remaining command args are scanned for unsupported options and | |
* are appended to the ProcessBuilder. |
@@ -527,10 +517,54 @@ public static ProcessBuilder createTestJvm(List<String> command) { | |||
* @param command Arguments to pass to the java command. | |||
* @return The ProcessBuilder instance representing the java command. | |||
*/ | |||
public static ProcessBuilder createTestJvm(String... command) { | |||
public static ProcessBuilder createTestJavaProcessBuilder(String... command) { |
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.
Include the same description of other properties that are included in creating the ProcessBuilder...
* Unless the "test.noclasspath" property is "true"
* the classpath property "java.class.path" is appended to the command line and
* the environment of the ProcessBuilder is modified to remove "CLASSPATH".
* If the property "test.thread.factory" is provided the command args are
* updated and appended to invoke ProcessTools main() and provide the
* name of the thread factory.
* The "-Dtest.thread.factory" is appended to the arguments with the thread factory value.
* The remaining command args are scanned for unsupported options and
* are appended to the ProcessBuilder.
@@ -512,8 +502,8 @@ private static void printStack(Thread t, StackTraceElement[] stack) { | |||
* @param command Arguments to pass to the java command. | |||
* @return The ProcessBuilder instance representing the java command. | |||
*/ | |||
public static ProcessBuilder createTestJvm(List<String> command) { | |||
return createTestJvm(command.toArray(String[]::new)); | |||
public static ProcessBuilder createTestJavaProcessBuilder(List<String> command) { |
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.
Include the same description of other properties that are included in creating the ProcessBuilder...
* the classpath property "java.class.path" is appended to the command line and
* the environment of the ProcessBuilder is modified to remove "CLASSPATH".
* If the property "test.thread.factory" is provided the command args are
* updated and appended to invoke ProcessTools main() and provide the
* name of the thread factory.
* The "-Dtest.thread.factory" is appended to the arguments with the thread factory value.
* The remaining command args are scanned for unsupported options and
* are appended to the ProcessBuilder.
Would it be okay if we handle the new method documentation in a separate pull request? After applying your changes, I also noted that the existing description Is it all right if we push what we have now, and that I create a new pull requests with these improvements in documentation that are actually not related to the changes in this pull request? |
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.
ok, to correct the javadoc in a subsequent PR.
/integrate |
Going to push as commit d52a995.
Your commit was automatically rebased without conflicts. |
Thanks, see: |
…lder(). ProcessTools.createJavaProcessBuilder() was renamed to ProcessTools.createLimitedTestJavaProcessBuilder by openjdk/jdk#15452.
This pull request renames
createJavaProcessBuilder
tocreateLimitedTestJavaProcessBuilder
and renamescreateTestJvm
tocreateTestJavaProcessBuilder
. Both are implemented through a privatecreateJavaProcessBuilder
. It also updates the java doc.This is so that it should be harder to by mistake use
createLimitedTestJavaProcessBuilder
that is problematic because it will not forward JVM flags to the tested JVM.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15452/head:pull/15452
$ git checkout pull/15452
Update a local copy of the PR:
$ git checkout pull/15452
$ git pull https://git.openjdk.org/jdk.git pull/15452/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15452
View PR using the GUI difftool:
$ git pr show -t 15452
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15452.diff
Webrev
Link to Webrev Comment