Skip to content

Commit

Permalink
8318962: Update ProcessTools javadoc with suggestions in 8315097
Browse files Browse the repository at this point in the history
Reviewed-by: rriggs
  • Loading branch information
lkorinth committed Nov 9, 2023
1 parent 0b58bde commit 7e4cb2f
Showing 1 changed file with 66 additions and 28 deletions.
94 changes: 66 additions & 28 deletions test/lib/jdk/test/lib/process/ProcessTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,21 @@ private static void printStack(Thread t, StackTraceElement[] stack) {
}

/**
* Create ProcessBuilder using the java launcher from the jdk to be tested.
* The default jvm options from jtreg, test.vm.opts and test.java.opts, are added.
* <p>
* The command line will be like:
* {test.jdk}/bin/java {test.vm.opts} {test.java.opts} cmds
* Create ProcessBuilder using the java launcher from the jdk to be tested.
* Create ProcessBuilder using the java launcher from the jdk to
* be tested. The default jvm options from jtreg, test.vm.opts and
* test.java.opts, are added.
*
* <p>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.
*
* <p>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.
*
* @param command Arguments to pass to the java command.
* @return The ProcessBuilder instance representing the java command.
Expand All @@ -507,12 +516,21 @@ public static ProcessBuilder createTestJavaProcessBuilder(List<String> command)
}

/**
* Create ProcessBuilder using the java launcher from the jdk to be tested.
* The default jvm options from jtreg, test.vm.opts and test.java.opts, are added.
* <p>
* The command line will be like:
* {test.jdk}/bin/java {test.vm.opts} {test.java.opts} cmds
* Create ProcessBuilder using the java launcher from the jdk to be tested.
* Create ProcessBuilder using the java launcher from the jdk to
* be tested. The default jvm options from jtreg, test.vm.opts and
* test.java.opts, are added.
*
* <p>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.
*
* <p>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.
*
* @param command Arguments to pass to the java command.
* @return The ProcessBuilder instance representing the java command.
Expand All @@ -536,6 +554,18 @@ public static ProcessBuilder createTestJavaProcessBuilder(String... command) {
* it in combination with <b>@requires vm.flagless</b> JTREG
* anotation as to not waste energy and test resources.
*
* <p>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.
*
* <p>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.
*
* @param command Arguments to pass to the java command.
* @return The ProcessBuilder instance representing the java command.
*/
Expand All @@ -558,6 +588,18 @@ public static ProcessBuilder createLimitedTestJavaProcessBuilder(List<String> co
* it in combination with <b>@requires vm.flagless</b> JTREG
* anotation as to not waste energy and test resources.
*
* <p>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.
*
* <p>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.
*
* @param command Arguments to pass to the java command.
* @return The ProcessBuilder instance representing the java command.
*/
Expand All @@ -566,14 +608,12 @@ public static ProcessBuilder createLimitedTestJavaProcessBuilder(String... comma
}

/**
* Executes a test jvm process, waits for it to finish and returns the process output.
* The default jvm options from jtreg, test.vm.opts and test.java.opts, are added.
* The java from the test.jdk is used to execute the command.
* <p>
* The command line will be like:
* {test.jdk}/bin/java {test.vm.opts} {test.java.opts} cmds
* <p>
* The jvm process will have exited before this method returns.
* Executes a test jvm process, waits for it to finish and returns
* the process output.
*
* <p>The process is created using runtime flags set up by:
* {@link #createTestJavaProcessBuilder(String...)}. The
* jvm process will have exited before this method returns.
*
* @param cmds User specified arguments.
* @return The output from the process.
Expand All @@ -583,14 +623,12 @@ public static OutputAnalyzer executeTestJvm(List<String> cmds) throws Exception
}

/**
* Executes a test jvm process, waits for it to finish and returns the process output.
* The default jvm options from jtreg, test.vm.opts and test.java.opts, are added.
* The java from the test.jdk is used to execute the command.
* <p>
* The command line will be like:
* {test.jdk}/bin/java {test.vm.opts} {test.java.opts} cmds
* <p>
* The jvm process will have exited before this method returns.
* Executes a test jvm process, waits for it to finish and returns
* the process output.
*
* <p>The process is created using runtime flags set up by:
* {@link #createTestJavaProcessBuilder(String...)}. The
* jvm process will have exited before this method returns.
*
* @param cmds User specified arguments.
* @return The output from the process.
Expand Down

3 comments on commit 7e4cb2f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 7e4cb2f Apr 5, 2024

Choose a reason for hiding this comment

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

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 7e4cb2f Apr 5, 2024

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch backport-GoeLin-7e4cb2f0 in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 7e4cb2f0 from the openjdk/jdk repository.

The commit being backported was authored by Leo Korinth on 9 Nov 2023 and was reviewed by Roger Riggs.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-7e4cb2f0:backport-GoeLin-7e4cb2f0
$ git checkout backport-GoeLin-7e4cb2f0
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-7e4cb2f0

Please sign in to comment.