Skip to content

Commit 6b53212

Browse files
committed
8258855: Two tests sun/security/krb5/auto/ReplayCacheTestProc.java and ReplayCacheTestProcWithMD5.java failed on OL8.3
Reviewed-by: mbalao, serb Backport-of: 8d780729c65bbfd19f23004723b8786d52f8310a
1 parent 6a09637 commit 6b53212

File tree

2 files changed

+26
-23
lines changed

2 files changed

+26
-23
lines changed

jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
* @summary More krb5 tests
2828
* @library ../../../../java/security/testlibrary/ /test/lib
2929
* @compile -XDignore.symbol.file ReplayCacheTestProc.java
30-
* @run main/othervm/timeout=300 -Dsun.net.spi.nameservice.provider.1=ns,mock ReplayCacheTestProc
30+
* @run main/othervm/timeout=300 -Dsun.net.spi.nameservice.provider.1=ns,mock
31+
* -Dtest.libs=J ReplayCacheTestProc
32+
* @run main/othervm/timeout=300 -Dsun.net.spi.nameservice.provider.1=ns,mock
33+
* -Dtest.libs=N ReplayCacheTestProc
3134
*/
3235

3336
import java.io.*;
@@ -43,6 +46,7 @@
4346
import java.util.regex.Matcher;
4447
import java.util.regex.Pattern;
4548

49+
import jdk.test.lib.Asserts;
4650
import jdk.test.lib.Platform;
4751
import sun.security.jgss.GSSUtil;
4852
import sun.security.krb5.internal.rcache.AuthTime;
@@ -51,9 +55,8 @@
5155
* This test runs multiple acceptor Procs to mimic AP-REQ replays.
5256
* These system properties are supported:
5357
*
54-
* - test.libs on what types of acceptors to use
58+
* - test.libs on what types of acceptors to use. Cannot be null.
5559
* Format: CSV of (J|N|N<suffix>=<libname>|J<suffix>=<launcher>)
56-
* Default: J,N on Solaris and Linux where N is available, or J
5760
* Example: J,N,N14=/krb5-1.14/lib/libgssapi_krb5.so,J8=/java8/bin/java
5861
*
5962
* - test.runs on manual runs. If empty, a iterate through all pattern
@@ -117,6 +120,16 @@ public static void main0(String[] args) throws Exception {
117120
uid = -1;
118121
}
119122

123+
// User-provided libs
124+
String userLibs = System.getProperty("test.libs");
125+
Asserts.assertNotNull(userLibs, "test.libs property must be provided");
126+
libs = userLibs.split(",");
127+
if (Arrays.asList(libs).contains("N") && !isNativeLibAvailable()) {
128+
// Skip test when native GSS libs are not available in running platform
129+
System.out.println("Native mode not available - skipped");
130+
return;
131+
}
132+
120133
KDC kdc = KDC.create(OneKDC.REALM, HOST, 0, true);
121134
for (int i=0; i<nc; i++) {
122135
kdc.addPrincipal(client(i), OneKDC.PASS);
@@ -129,25 +142,6 @@ public static void main0(String[] args) throws Exception {
129142
kdc.writeKtab(OneKDC.KTAB);
130143
KDC.saveConfig(OneKDC.KRB5_CONF, kdc);
131144

132-
// User-provided libs
133-
String userLibs = System.getProperty("test.libs");
134-
135-
if (userLibs != null) {
136-
libs = userLibs.split(",");
137-
} else {
138-
if (Platform.isOSX() || Platform.isWindows()) {
139-
// macOS uses Heimdal and Windows has no native lib
140-
libs = new String[]{"J"};
141-
} else {
142-
if (acceptor("N", "sanity").waitFor() != 0) {
143-
Proc.d("Native mode sanity check failed, only java");
144-
libs = new String[]{"J"};
145-
} else {
146-
libs = new String[]{"J", "N"};
147-
}
148-
}
149-
}
150-
151145
pi = Proc.create("ReplayCacheTestProc").debug("C")
152146
.args("initiator")
153147
.start();
@@ -323,6 +317,13 @@ public static void main(String[] args) throws Exception {
323317
}
324318
}
325319

320+
// returns true if native lib is available in running platform
321+
// macOS uses Heimdal and Windows has no native lib
322+
private static boolean isNativeLibAvailable() throws Exception {
323+
return !Platform.isOSX() && !Platform.isWindows()
324+
&& acceptor("N", "sanity").waitFor() == 0;
325+
}
326+
326327
// returns the client name
327328
private static String client(int p) {
328329
return "client" + p;

jdk/test/sun/security/krb5/auto/rcache_usemd5.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
# @test
2525
# @bug 8168518
2626
# @library ../../../../java/security/testlibrary/ /test/lib
27-
# @run main/othervm/timeout=300 -Dsun.net.spi.nameservice.provider.1=ns,mock -Djdk.krb5.rcache.useMD5=true ReplayCacheTestProc
27+
# @run main/othervm/timeout=300 -Dsun.net.spi.nameservice.provider.1=ns,mock
28+
# -Djdk.krb5.rcache.useMD5=true
29+
# -Dtest.libs=J ReplayCacheTestProc
2830
# @summary testing jdk.krb5.rcache.useMD5. This action is put in a separate
2931
# test so that ReplayCacheTestProc.java can be launched with special
3032
# test.* system properties easily.

0 commit comments

Comments
 (0)