Skip to content

Commit b99be50

Browse files
nehajoshinjRajan Halade
authored andcommitted
8368524: Tests are skipped and shown as passed in test/jdk/sun/security/pkcs11/Cipher/KeyWrap
Reviewed-by: myankelevich, rhalade
1 parent 831fe94 commit b99be50

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public class NISTWrapKAT extends PKCS11Test {
8383
private static String KEK2 =
8484
"5840DF6E29B02AF1AB493B705BF16EA1AE8338F4DCC176A8";
8585

86-
private static final List<String> skippedList = new ArrayList <>();
86+
private static final List<String> skippedAlgoList = new ArrayList <>();
8787

8888
private static byte[] toBytes(String hex, int hexLen) {
8989
if (hexLen < hex.length()) {
@@ -274,8 +274,8 @@ public void testKeyWrap(String algo, String key, int keyLen,
274274
dataLen + "-byte key with " + 8*keyLen + "-bit KEK");
275275
int allowed = Cipher.getMaxAllowedKeyLength("AES");
276276
if (keyLen > allowed) {
277-
System.out.println("=> skip, exceeds max allowed size " + allowed);
278-
skippedList.add(algo + " Cipher with wrapping " +
277+
System.err.println("Skip, exceeds max allowed size " + allowed);
278+
skippedAlgoList.add(algo + " Cipher with wrapping " +
279279
dataLen + "-byte key with " + 8 * keyLen +
280280
"-bit KEK exceeds max allowed size " + allowed);
281281
return;
@@ -344,8 +344,8 @@ public void testEnc(String algo, String key, int keyLen, String data,
344344
dataLen + "-byte data with " + 8*keyLen + "-bit KEK");
345345
int allowed = Cipher.getMaxAllowedKeyLength("AES");
346346
if (keyLen > allowed) {
347-
System.out.println("=> skip, exceeds max allowed size " + allowed);
348-
skippedList.add(algo + " Cipher with enc " +
347+
System.err.println("Skip, exceeds max allowed size " + allowed);
348+
skippedAlgoList.add(algo + " Cipher with enc " +
349349
dataLen + "-byte data with " + 8 * keyLen +
350350
"-bit KEK exceeds max allowed size " + allowed);
351351
return;
@@ -416,17 +416,19 @@ public void main(Provider p) throws Exception {
416416
for (Object[] td : testDatum) {
417417
String algo = (String) td[0];
418418
if (p.getService("Cipher", algo) == null) {
419-
skippedList.add("No support for " + algo);
419+
System.err.println("Skip, due to no support: " + algo);
420+
skippedAlgoList.add("No support for " + algo);
421+
continue;
420422
}
421423
testKeyWrap(algo, (String) td[1], (int) td[2], (String) td[3],
422424
(int) td[4], (String) td[5], p);
423425
testEnc(algo, (String) td[1], (int) td[2], (String) td[3],
424426
(int) td[4], (String) td[5], p);
425427
}
426428

427-
if (!skippedList.isEmpty()) {
429+
if (!skippedAlgoList.isEmpty()) {
428430
throw new SkippedException("One or more tests skipped "
429-
+ skippedList);
431+
+ skippedAlgoList);
430432
} else {
431433
System.out.println("All Tests Passed");
432434
}

test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ public void main(Provider p) throws Exception {
273273
for (String a : algos) {
274274
if (p.getService("Cipher", a) == null) {
275275
skippedList.add(a);
276+
continue;
276277
}
277278

278279
System.out.println("Testing " + a);

0 commit comments

Comments
 (0)