8258855: Two tests sun/security/krb5/auto/ReplayCacheTestProc.java and ReplayCacheTestProcWithMD5.java failed on OL8.3

Reviewed-by: weijun, rhalade
This commit is contained in:
Fernando Guallini 2021-02-24 17:05:58 +00:00 committed by Weijun Wang
parent 9d9ad969ca
commit d70fd7b3c4
3 changed files with 24 additions and 25 deletions

@ -695,8 +695,6 @@ javax/security/auth/kerberos/KerberosTixDateTest.java 8039280 generic-
sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 generic-all
sun/security/provider/PolicyParser/ExtDirsChange.java 8039280 generic-all
sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all
sun/security/krb5/auto/ReplayCacheTestProcWithMD5.java 8258855 linux-all
sun/security/krb5/auto/ReplayCacheTestProc.java 8258855 linux-all
############################################################################

@ -29,7 +29,9 @@
* @build jdk.test.lib.Platform
* @run main jdk.test.lib.FileInstaller TestHosts TestHosts
* @run main/othervm/timeout=300 -Djdk.net.hosts.file=TestHosts
* ReplayCacheTestProc
* -Dtest.libs=J ReplayCacheTestProc
* @run main/othervm/timeout=300 -Djdk.net.hosts.file=TestHosts
* -Dtest.libs=N ReplayCacheTestProc
*/
import java.io.*;
@ -45,6 +47,7 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jdk.test.lib.Asserts;
import jdk.test.lib.Platform;
import sun.security.jgss.GSSUtil;
import sun.security.krb5.internal.rcache.AuthTime;
@ -53,9 +56,8 @@ import sun.security.krb5.internal.rcache.AuthTime;
* This test runs multiple acceptor Procs to mimic AP-REQ replays.
* These system properties are supported:
*
* - test.libs on what types of acceptors to use
* - test.libs on what types of acceptors to use. Cannot be null.
* Format: CSV of (J|N|N<suffix>=<libname>|J<suffix>=<launcher>)
* Default: J,N on Solaris and Linux where N is available, or J
* Example: J,N,N14=/krb5-1.14/lib/libgssapi_krb5.so,J8=/java8/bin/java
*
* - test.runs on manual runs. If empty, a iterate through all pattern
@ -117,6 +119,16 @@ public class ReplayCacheTestProc {
Ex[] result;
int numPerType = 2; // number of acceptors per type
// User-provided libs
String userLibs = System.getProperty("test.libs");
Asserts.assertNotNull(userLibs, "test.libs property must be provided");
libs = userLibs.split(",");
if (Arrays.asList(libs).contains("N") && !isNativeLibAvailable()) {
// Skip test when native GSS libs are not available in running platform
System.out.println("Native mode not available - skipped");
return;
}
KDC kdc = KDC.create(OneKDC.REALM, HOST, 0, true);
for (int i=0; i<nc; i++) {
kdc.addPrincipal(client(i), OneKDC.PASS);
@ -134,25 +146,6 @@ public class ReplayCacheTestProc {
// Write KTAB after krb5.conf so it contains no aes-sha2 keys
kdc.writeKtab(OneKDC.KTAB);
// User-provided libs
String userLibs = System.getProperty("test.libs");
if (userLibs != null) {
libs = userLibs.split(",");
} else {
if (Platform.isOSX() || Platform.isWindows()) {
// macOS uses Heimdal and Windows has no native lib
libs = new String[]{"J"};
} else {
if (acceptor("N", "sanity").waitFor() != 0) {
Proc.d("Native mode sanity check failed, only java");
libs = new String[]{"J"};
} else {
libs = new String[]{"J", "N"};
}
}
}
pi = Proc.create("ReplayCacheTestProc").debug("C")
.inheritProp("jdk.net.hosts.file")
.args("initiator")
@ -329,6 +322,13 @@ public class ReplayCacheTestProc {
}
}
// returns true if native lib is available in running platform
// macOS uses Heimdal and Windows has no native lib
private static boolean isNativeLibAvailable() throws Exception {
return !Platform.isOSX() && !Platform.isWindows()
&& acceptor("N", "sanity").waitFor() == 0;
}
// returns the client name
private static String client(int p) {
return "client" + p;

@ -32,5 +32,6 @@
* @run main jdk.test.lib.FileInstaller TestHosts TestHosts
* @run main/othervm/timeout=300 -Djdk.krb5.rcache.useMD5=true
* -Djdk.net.hosts.file=TestHosts
* -Dtest.service=host ReplayCacheTestProc
* -Dtest.service=host
* -Dtest.libs=J ReplayCacheTestProc
*/