From b8dc172b1b653830c1ca299ef7ded2dc81fcf4fa Mon Sep 17 00:00:00 2001 From: ascarpino Date: Fri, 19 Jul 2013 11:34:33 -0700 Subject: [PATCH] 8012971: PKCS11Test hiding exception failures Reviewed-by: vinnie, valeriep --- test/ProblemList.txt | 17 +++++++++++ test/sun/security/pkcs11/PKCS11Test.java | 38 +++++++++++++++++------- test/sun/security/pkcs11/SecmodTest.java | 1 + 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/test/ProblemList.txt b/test/ProblemList.txt index a2e02261a..2fb32245a 100644 --- a/test/ProblemList.txt +++ b/test/ProblemList.txt @@ -255,6 +255,23 @@ sun/rmi/transport/proxy/EagerHttpFallback.java generic-all # jdk_security +# 8012971 PKCS11Test hiding exception failures +sun/security/pkcs11/KeyStore/SecretKeysBasic.java solaris-all +sun/security/pkcs11/KeyStore/SecretKeysBasic.java linux-all +sun/security/pkcs11/ec/TestCurves.java solaris-all +sun/security/pkcs11/ec/TestCurves.java linux-all +sun/security/pkcs11/ec/TestECDH.java solaris-all +sun/security/pkcs11/ec/TestECDH2.java solaris-all +sun/security/pkcs11/ec/TestECDH2.java linux-all +sun/security/pkcs11/ec/TestECDSA.java solaris-all +sun/security/pkcs11/ec/TestECDSA.java linux-all +sun/security/pkcs11/ec/TestECDSA2.java solaris-all +sun/security/pkcs11/ec/TestECDSA2.java linux-all +sun/security/pkcs11/ec/TestECGenSpec.java solaris-all +sun/security/pkcs11/ec/TestECGenSpec.java linux-all +sun/security/pkcs11/ec/TestKeyFactory.java solaris-all +sun/security/pkcs11/ec/TestKeyFactory.java linux-all + # 7164518: no PortUnreachableException on Mac sun/security/krb5/auto/Unreachable.java macosx-all diff --git a/test/sun/security/pkcs11/PKCS11Test.java b/test/sun/security/pkcs11/PKCS11Test.java index deb7302a2..eff8a44b6 100644 --- a/test/sun/security/pkcs11/PKCS11Test.java +++ b/test/sun/security/pkcs11/PKCS11Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,6 +54,11 @@ public abstract class PKCS11Test { static String NSPR_PREFIX = ""; + // The NSS library we need to search for in getNSSLibDir() + // Default is "libsoftokn3.so", listed as "softokn3" + // The other is "libnss3.so", listed as "nss3". + static String nss_library = "softokn3"; + static Provider getSunPKCS11(String config) throws Exception { Class clazz = Class.forName("sun.security.pkcs11.SunPKCS11"); Constructor cons = clazz.getConstructor(new Class[] {String.class}); @@ -79,24 +84,28 @@ public abstract class PKCS11Test { testNSS(test); testDeimos(test); } finally { + // NOTE: Do not place a 'return' in any finally block + // as it will suppress exceptions and hide test failures. Provider[] newProviders = Security.getProviders(); + boolean found = true; // Do not restore providers if nothing changed. This is especailly // useful for ./Provider/Login.sh, where a SecurityManager exists. if (oldProviders.length == newProviders.length) { - boolean found = false; + found = false; for (int i = 0; i