jdk/test/sun/security/pkcs11/PKCS11Test.java
changeset 12294 f313586fc3cc
parent 12042 88bd85bd793d
child 13250 c342d30b70da
--- 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();