< prev index next >
test/testlibrary/jdk/test/lib/Utils.java
Print this page
*** 22,34 ****
*/
package jdk.test.lib;
import static jdk.test.lib.Asserts.assertTrue;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.UnknownHostException;
--- 22,31 ----
*** 56,71 ****
* Returns the sequence used by operating system to separate lines.
*/
public static final String NEW_LINE = System.getProperty("line.separator");
/**
! * Returns the value of 'test.vm.opts'system property.
*/
public static final String VM_OPTIONS = System.getProperty("test.vm.opts", "").trim();
/**
! * Returns the value of 'test.java.opts'system property.
*/
public static final String JAVA_OPTIONS = System.getProperty("test.java.opts", "").trim();
private static Unsafe unsafe = null;
--- 53,68 ----
* Returns the sequence used by operating system to separate lines.
*/
public static final String NEW_LINE = System.getProperty("line.separator");
/**
! * Returns the value of 'test.vm.opts' system property.
*/
public static final String VM_OPTIONS = System.getProperty("test.vm.opts", "").trim();
/**
! * Returns the value of 'test.java.opts' system property.
*/
public static final String JAVA_OPTIONS = System.getProperty("test.java.opts", "").trim();
private static Unsafe unsafe = null;
*** 127,137 ****
}
/**
* Returns the default JTReg arguments for a jvm running a test.
* This is the combination of JTReg arguments test.vm.opts and test.java.opts.
! * @return An array of options, or an empty array if no opptions.
*/
public static String[] getTestJavaOpts() {
List<String> opts = new ArrayList<String>();
Collections.addAll(opts, safeSplitString(VM_OPTIONS));
Collections.addAll(opts, safeSplitString(JAVA_OPTIONS));
--- 124,134 ----
}
/**
* Returns the default JTReg arguments for a jvm running a test.
* This is the combination of JTReg arguments test.vm.opts and test.java.opts.
! * @return An array of options, or an empty array if no options.
*/
public static String[] getTestJavaOpts() {
List<String> opts = new ArrayList<String>();
Collections.addAll(opts, safeSplitString(VM_OPTIONS));
Collections.addAll(opts, safeSplitString(JAVA_OPTIONS));
*** 274,284 ****
* Example output from jcmd is:
* 12498 sun.tools.jcmd.JCmd -l
* 12254 /tmp/jdk8/tl/jdk/JTwork/classes/com/sun/tools/attach/Application.jar
*
* @param key A regular expression to search for.
! * @return The found pid, or -1 if Enot found.
* @throws Exception If multiple matching jvms are found.
*/
public static int tryFindJvmPid(String key) throws Throwable {
OutputAnalyzer output = null;
try {
--- 271,281 ----
* Example output from jcmd is:
* 12498 sun.tools.jcmd.JCmd -l
* 12254 /tmp/jdk8/tl/jdk/JTwork/classes/com/sun/tools/attach/Application.jar
*
* @param key A regular expression to search for.
! * @return The found pid, or -1 if not found.
* @throws Exception If multiple matching jvms are found.
*/
public static int tryFindJvmPid(String key) throws Throwable {
OutputAnalyzer output = null;
try {
*** 390,400 ****
* Wait until timeout for condition to be true
*
* @param condition, a condition to wait for
* @param timeout a time in milliseconds to wait for condition to be true
* specifying -1 will wait forever
! * @return condition value, to determine if wait was successfull
*/
public static final boolean waitForCondition(BooleanSupplier condition,
long timeout) {
return waitForCondition(condition, timeout, 100L);
}
--- 387,397 ----
* Wait until timeout for condition to be true
*
* @param condition, a condition to wait for
* @param timeout a time in milliseconds to wait for condition to be true
* specifying -1 will wait forever
! * @return condition value, to determine if wait was successful
*/
public static final boolean waitForCondition(BooleanSupplier condition,
long timeout) {
return waitForCondition(condition, timeout, 100L);
}
*** 404,414 ****
*
* @param condition, a condition to wait for
* @param timeout a time in milliseconds to wait for condition to be true,
* specifying -1 will wait forever
* @param sleepTime a time to sleep value in milliseconds
! * @return condition value, to determine if wait was successfull
*/
public static final boolean waitForCondition(BooleanSupplier condition,
long timeout, long sleepTime) {
long startTime = System.currentTimeMillis();
while (!(condition.getAsBoolean() || (timeout != -1L
--- 401,411 ----
*
* @param condition, a condition to wait for
* @param timeout a time in milliseconds to wait for condition to be true,
* specifying -1 will wait forever
* @param sleepTime a time to sleep value in milliseconds
! * @return condition value, to determine if wait was successful
*/
public static final boolean waitForCondition(BooleanSupplier condition,
long timeout, long sleepTime) {
long startTime = System.currentTimeMillis();
while (!(condition.getAsBoolean() || (timeout != -1L
< prev index next >