8157417: Some of SecureRandom test might get timed out in linux
Reviewed-by: weijun
--- a/jdk/test/java/security/SecureRandom/GetInstanceTest.java Fri May 20 09:40:29 2016 -0700
+++ b/jdk/test/java/security/SecureRandom/GetInstanceTest.java Fri May 20 09:57:01 2016 -0700
@@ -36,12 +36,9 @@
import java.security.SecureRandom;
import java.security.SecureRandomParameters;
import java.security.DrbgParameters;
-
import static java.security.DrbgParameters.Capability.*;
-
import java.security.Security;
import java.util.Arrays;
-
import jdk.testlibrary.Asserts;
public class GetInstanceTest {
@@ -77,13 +74,16 @@
+ "strong algorithm through security Property: "
+ "'securerandom.strongAlgorithms'.");
}
- Security.setProperty(STRONG_ALG_SEC_PROP, "DRBG:SUN");
- sr = matchExc(() -> SecureRandom.getInstanceStrong(),
- PASS, NoSuchAlgorithmException.class,
- "PASS - Undefined security Property "
- + "'securerandom.strongAlgorithms'");
- checkAttributes(sr, "DRBG");
- Security.setProperty(STRONG_ALG_SEC_PROP, origDRBGConfig);
+ try {
+ Security.setProperty(STRONG_ALG_SEC_PROP, "DRBG:SUN");
+ sr = matchExc(() -> SecureRandom.getInstanceStrong(),
+ PASS, NoSuchAlgorithmException.class,
+ "PASS - Undefined security Property "
+ + "'securerandom.strongAlgorithms'");
+ checkAttributes(sr, "DRBG");
+ } finally {
+ Security.setProperty(STRONG_ALG_SEC_PROP, origDRBGConfig);
+ }
for (String mech : new String[]{
"SHA1PRNG", "Hash_DRBG", "HMAC_DRBG", "CTR_DRBG", INVALID_ALGO,}) {
--- a/jdk/test/java/security/SecureRandom/MultiThreadTest.java Fri May 20 09:40:29 2016 -0700
+++ b/jdk/test/java/security/SecureRandom/MultiThreadTest.java Fri May 20 09:57:01 2016 -0700
@@ -41,7 +41,7 @@
* @library /lib/testlibrary
* @summary Test behavior of a shared SecureRandom object when it is operated
* by multiple threads concurrently.
- * @run main MultiThreadTest
+ * @run main/othervm -Djava.security.egd=file:/dev/urandom MultiThreadTest
*/
public class MultiThreadTest {
--- a/jdk/test/java/security/SecureRandom/SerializedSeedTest.java Fri May 20 09:40:29 2016 -0700
+++ b/jdk/test/java/security/SecureRandom/SerializedSeedTest.java Fri May 20 09:57:01 2016 -0700
@@ -29,7 +29,7 @@
* as well from it's serialized instance in the same time then the
* generated random numbers should be different when one or both are
* reseeded.
- * @run main SerializedSeedTest
+ * @run main/othervm -Djava.security.egd=file:/dev/urandom SerializedSeedTest
*/
import java.io.ByteArrayOutputStream;
import java.io.IOException;
--- a/jdk/test/sun/security/provider/SeedGenerator/SeedGeneratorChoice.java Fri May 20 09:40:29 2016 -0700
+++ b/jdk/test/sun/security/provider/SeedGenerator/SeedGeneratorChoice.java Fri May 20 09:57:01 2016 -0700
@@ -27,7 +27,6 @@
* @bug 6998583 8141039
* @summary NativeSeedGenerator is making 8192 byte read requests from
* entropy pool on each init.
- * @run main SeedGeneratorChoice
* @run main/othervm -Djava.security.egd=file:/dev/random SeedGeneratorChoice
* @run main/othervm -Djava.security.egd=file:filename SeedGeneratorChoice
*/