diff --git a/test/jdk/sun/security/pkcs11/PKCS11Test.java b/test/jdk/sun/security/pkcs11/PKCS11Test.java index fe1b894f2366d..5a619ec59b5ec 100644 --- a/test/jdk/sun/security/pkcs11/PKCS11Test.java +++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java @@ -183,45 +183,14 @@ public static void main(PKCS11Test test, String[] args) throws Exception { Provider[] oldProviders = Security.getProviders(); try { System.out.println("Beginning test run " + test.getClass().getName() + "..."); - boolean skippedDefault = false; - boolean skippedNSS = false; - boolean skippedDeimos = false; - - // Use separate try-catch for each test to allow all test run - try { - testDefault(test); - } catch (SkippedException se) { - System.out.println("testDefault: Skipped"); - skippedDefault = true; - se.printStackTrace(System.out); - } - - try { - testNSS(test); - } catch (SkippedException se) { - System.out.println("testNSS: Skipped"); - skippedNSS = true; - se.printStackTrace(System.out); - } - - try { - testDeimos(test); - } catch (SkippedException se) { - System.out.println("testDeimos: Skipped"); - skippedDeimos = true; - se.printStackTrace(System.out); - } - - if (skippedDefault && skippedNSS && skippedDeimos) { - throw new SkippedException("All tests are skipped, check logs"); - } + testNSS(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 + // Do not restore providers if nothing changed. This is especially // useful for ./Provider/Login.sh, where a SecurityManager exists. if (oldProviders.length == newProviders.length) { found = false; @@ -243,51 +212,6 @@ public static void main(PKCS11Test test, String[] args) throws Exception { } } - public static void testDeimos(PKCS11Test test) throws Exception { - System.out.println("===> testDeimos: Starting test run"); - if ("true".equals(System.getProperty("NO_DEIMOS"))) { - System.out.println("Skip Deimos software as test configured with NO_DEIMOS"); - return; - } - - if (!new File("/opt/SUNWconn/lib/libpkcs11.so").isFile()) { - throw new SkippedException("testDeimos: \"/opt/SUNWconn/lib/libpkcs11.so\" " + - "file required for Deimos not found"); - } - - String base = getBase(); - String p11config = base + SEP + "nss" + SEP + "p11-deimos.txt"; - Provider p = getSunPKCS11(p11config); - test.premain(p); - System.out.println("testDeimos: Completed"); - } - - // Run test for default configured PKCS11 providers (if any) - public static void testDefault(PKCS11Test test) throws Exception { - System.out.println("===> testDefault: Starting test run"); - boolean foundPKCS11 = false; - - if ("true".equals(System.getProperty("NO_DEFAULT"))) { - System.out.println("Skip default provider as test configured with NO_DEFAULT"); - return; - } - - Provider[] providers = Security.getProviders(); - for (Provider p : providers) { - if (p.getName().startsWith("SunPKCS11-")) { - foundPKCS11 = true; - test.premain(p); - } - } - - if (!foundPKCS11) { - throw new SkippedException("testDefault: Skip default test as SunPKCS11 " + - "provider is not configured"); - } - - System.out.println("testDefault: Completed"); - } - public static String getBase() throws Exception { if (PKCS11_BASE != null) { return PKCS11_BASE; @@ -973,8 +897,6 @@ T[] concat(T[] a, T[] b) { protected void setCommonSystemProps() { System.setProperty("java.security.debug", "true"); - System.setProperty("NO_DEIMOS", "true"); - System.setProperty("NO_DEFAULT", "true"); System.setProperty("CUSTOM_DB_DIR", TEST_CLASSES); } diff --git a/test/jdk/sun/security/pkcs11/Provider/MultipleLogins.sh b/test/jdk/sun/security/pkcs11/Provider/MultipleLogins.sh index 273f44bbb7dae..00dafabd03c3c 100644 --- a/test/jdk/sun/security/pkcs11/Provider/MultipleLogins.sh +++ b/test/jdk/sun/security/pkcs11/Provider/MultipleLogins.sh @@ -120,8 +120,6 @@ TEST_ARGS="${TESTVMOPTS} -classpath ${TESTCLASSPATH} \ --add-exports jdk.crypto.cryptoki/sun.security.pkcs11=ALL-UNNAMED \ -DCUSTOM_DB_DIR=${TESTCLASSES} \ -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}MultipleLogins-nss.txt \ - -DNO_DEFAULT=true \ - -DNO_DEIMOS=true \ -Dtest.src=${TESTSRC} \ -Dtest.classes=${TESTCLASSES} \ -Djava.security.debug=${DEBUG}" diff --git a/test/jdk/sun/security/pkcs11/nss/p11-deimos.txt b/test/jdk/sun/security/pkcs11/nss/p11-deimos.txt deleted file mode 100644 index 813930022c739..0000000000000 --- a/test/jdk/sun/security/pkcs11/nss/p11-deimos.txt +++ /dev/null @@ -1,14 +0,0 @@ -# -# -# -# Configuration to run unit tests with the Deimos (SCA1000) software -# - -name = Deimos - -#showInfo = true - -library = /opt/SUNWconn/lib/libpkcs11.so - -attributes = compatibility - diff --git a/test/jdk/sun/security/pkcs11/rsa/TestP11KeyFactoryGetRSAKeySpec.java b/test/jdk/sun/security/pkcs11/rsa/TestP11KeyFactoryGetRSAKeySpec.java index 2babc77e37a92..cc9a07d360809 100644 --- a/test/jdk/sun/security/pkcs11/rsa/TestP11KeyFactoryGetRSAKeySpec.java +++ b/test/jdk/sun/security/pkcs11/rsa/TestP11KeyFactoryGetRSAKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -39,7 +39,7 @@ * @library /test/lib .. * @run main/othervm TestP11KeyFactoryGetRSAKeySpec * @run main/othervm -Djava.security.manager=allow TestP11KeyFactoryGetRSAKeySpec sm rsakeys.ks.policy - * @run main/othervm -DCUSTOM_P11_CONFIG_NAME=p11-nss-sensitive.txt -DNO_DEIMOS=true -DNO_DEFAULT=true TestP11KeyFactoryGetRSAKeySpec + * @run main/othervm -DCUSTOM_P11_CONFIG_NAME=p11-nss-sensitive.txt TestP11KeyFactoryGetRSAKeySpec * @modules jdk.crypto.cryptoki */