mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 04:24:49 +02:00
8066473: Port timeout utils from jdk test library into hotspot
Reviewed-by: kvn, iignatyev
This commit is contained in:
parent
c39c3b01be
commit
ca033e9cde
1 changed files with 17 additions and 0 deletions
|
@ -37,6 +37,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import sun.misc.Unsafe;
|
import sun.misc.Unsafe;
|
||||||
|
@ -88,6 +89,12 @@ public final class Utils {
|
||||||
TIMEOUT_FACTOR = Double.parseDouble(toFactor);
|
TIMEOUT_FACTOR = Double.parseDouble(toFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of JTREG default test timeout in milliseconds
|
||||||
|
* converted to {@code long}.
|
||||||
|
*/
|
||||||
|
public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120);
|
||||||
|
|
||||||
private Utils() {
|
private Utils() {
|
||||||
// Private constructor to prevent class instantiation
|
// Private constructor to prevent class instantiation
|
||||||
}
|
}
|
||||||
|
@ -396,4 +403,14 @@ public final class Utils {
|
||||||
}
|
}
|
||||||
return RANDOM_GENERATOR;
|
return RANDOM_GENERATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjusts the provided timeout value for the TIMEOUT_FACTOR
|
||||||
|
* @param tOut the timeout value to be adjusted
|
||||||
|
* @return The timeout value adjusted for the value of "test.timeout.factor"
|
||||||
|
* system property
|
||||||
|
*/
|
||||||
|
public static long adjustTimeout(long tOut) {
|
||||||
|
return Math.round(tOut * Utils.TIMEOUT_FACTOR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue