7152582: PKCS11 tests should use the NSS libraries available in the OS
authorvinnie
Mon, 26 Mar 2012 17:14:20 +0100
changeset 12294 f313586fc3cc
parent 12293 6c4b13381b81
child 12295 2e08a27dd105
7152582: PKCS11 tests should use the NSS libraries available in the OS Reviewed-by: mullan
jdk/test/sun/security/pkcs11/PKCS11Test.java
jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libfreebl3.chk
jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libfreebl3.so
jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libnspr4.so
jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libnss3.so
jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libnssckbi.so
jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libplc4.so
jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libplds4.so
jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libsoftokn3.chk
jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libsoftokn3.so
jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libnspr4.so
jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libnss3.so
jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libnssckbi.so
jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libplc4.so
jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libplds4.so
jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libsoftokn3.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libnspr4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libnss3.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libnssckbi.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libplc4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libplds4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libsoftokn3.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libfreebl3.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libnspr4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libnss3.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libnssckbi.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libplc4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libplds4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libsoftokn3.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libfreebl_hybrid_3.chk
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libfreebl_hybrid_3.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libnspr4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libnss3.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libnssckbi.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libplc4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libplds4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libsoftokn3.chk
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libsoftokn3.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libnspr4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libnss3.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libnssckbi.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libplc4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libplds4.so
jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libsoftokn3.so
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libnspr4.dll
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libplc4.dll
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libplds4.dll
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/nss3.dll
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/nssckbi.dll
jdk/test/sun/security/pkcs11/nss/lib/windows-i586/softokn3.dll
jdk/test/sun/security/tools/keytool/autotest.sh
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java	Fri Mar 23 09:27:44 2012 -0700
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java	Mon Mar 26 17:14:20 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, 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
@@ -129,6 +129,13 @@
     }
 
     private static String PKCS11_BASE;
+    static {
+        try {
+            PKCS11_BASE = getBase();
+        } catch (Exception e) {
+            // ignore
+        }
+    }
 
     private final static String PKCS11_REL_PATH = "sun/security/pkcs11";
 
@@ -160,20 +167,18 @@
         }
         String osid = osName + "-"
                 + props.getProperty("os.arch") + "-" + props.getProperty("sun.arch.data.model");
-        String ostype = osMap.get(osid);
-        if (ostype == null) {
+        String nssLibDir = osMap.get(osid);
+        if (nssLibDir == null) {
             System.out.println("Unsupported OS, skipping: " + osid);
             return null;
-//          throw new Exception("Unsupported OS " + osid);
+//          throw new Exception("Unsupported OS " + osName);
         }
-        if (ostype.length() == 0) {
+        if (nssLibDir.length() == 0) {
             System.out.println("NSS not supported on this platform, skipping test");
             return null;
         }
-        String base = getBase();
-        String libdir = base + SEP + "nss" + SEP + "lib" + SEP + ostype + SEP;
-        System.setProperty("pkcs11test.nss.libdir", libdir);
-        return libdir;
+        System.setProperty("pkcs11test.nss.libdir", nssLibDir);
+        return nssLibDir;
     }
 
     protected static void safeReload(String lib) throws Exception {
@@ -191,6 +196,8 @@
         safeReload(libdir + System.mapLibraryName(NSPR_PREFIX + "nspr4"));
         safeReload(libdir + System.mapLibraryName(NSPR_PREFIX + "plc4"));
         safeReload(libdir + System.mapLibraryName(NSPR_PREFIX + "plds4"));
+        safeReload(libdir + System.mapLibraryName("sqlite3"));
+        safeReload(libdir + System.mapLibraryName("nssutil3"));
         return true;
     }
 
@@ -229,15 +236,15 @@
 
     private static final Map<String,String> osMap;
 
+    // Location of the NSS libraries on each supported platform
     static {
         osMap = new HashMap<String,String>();
-        osMap.put("SunOS-sparc-32", "solaris-sparc");
-        osMap.put("SunOS-sparcv9-64", "solaris-sparcv9");
-        osMap.put("SunOS-x86-32", "solaris-i586");
-        osMap.put("SunOS-amd64-64", "solaris-amd64");
-        osMap.put("Linux-i386-32", "linux-i586");
-        osMap.put("Linux-amd64-64", "linux-amd64");
-        osMap.put("Windows-x86-32", "windows-i586");
+        osMap.put("SunOS-sparc-32", "/usr/lib/mps/");
+        osMap.put("SunOS-sparcv9-64", "/usr/lib/mps/64/");
+        osMap.put("SunOS-x86-32", "/usr/lib/mps/");
+        osMap.put("SunOS-amd64-64", "/usr/lib/mps/64/");
+        osMap.put("Linux-i386-32", "/usr/lib/");
+        osMap.put("Linux-amd64-64", "/usr/lib64/");
     }
 
     private final static char[] hexDigits = "0123456789abcdef".toCharArray();
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libfreebl3.chk has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libfreebl3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libnspr4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libnss3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libnssckbi.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libplc4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libplds4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libsoftokn3.chk has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-amd64/libsoftokn3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libnspr4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libnss3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libnssckbi.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libplc4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libplds4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/linux-i586/libsoftokn3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libnspr4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libnss3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libnssckbi.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libplc4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libplds4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-amd64/libsoftokn3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libfreebl3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libnspr4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libnss3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libnssckbi.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libplc4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libplds4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-i586/libsoftokn3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libfreebl_hybrid_3.chk has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libfreebl_hybrid_3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libnspr4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libnss3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libnssckbi.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libplc4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libplds4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libsoftokn3.chk has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparc/libsoftokn3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libnspr4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libnss3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libnssckbi.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libplc4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libplds4.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/solaris-sparcv9/libsoftokn3.so has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libnspr4.dll has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libplc4.dll has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/windows-i586/libplds4.dll has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/windows-i586/nss3.dll has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/windows-i586/nssckbi.dll has changed
Binary file jdk/test/sun/security/pkcs11/nss/lib/windows-i586/softokn3.dll has changed
--- a/jdk/test/sun/security/tools/keytool/autotest.sh	Fri Mar 23 09:27:44 2012 -0700
+++ b/jdk/test/sun/security/tools/keytool/autotest.sh	Mon Mar 26 17:14:20 2012 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2012, 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
@@ -50,7 +50,7 @@
     ARCH=`isainfo`
     case "$ARCH" in
       sparc* )
-        PF="solaris-sparc"
+        NSSDIR="/usr/lib/mps"
         ;;
       * )
         echo "Will not run test on: Solaris ${ARCH}"
@@ -64,7 +64,7 @@
     FS="/"
     case "$ARCH" in
       i[3-6]86 )
-        PF="linux-i586"
+        NSSDIR="/usr/lib"
         ;;
       * )
         echo "Will not run test on: Linux ${ARCH}"
@@ -91,7 +91,7 @@
 chmod u+w cert8.db
 
 echo | ${TESTJAVA}${FS}bin${FS}java -Dnss \
-   -Dnss.lib=${NSS}${FS}lib${FS}${PF}${FS}${LIBNAME} \
+   -Dnss.lib=${NSSDIR}${FS}${LIBNAME} \
    KeyToolTest
 status=$?