7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
authorweijun
Mon, 17 Sep 2012 18:19:16 +0800
changeset 13809 dea6d093c703
parent 13808 ad4ecc16c5ea
child 13810 5c2d6a14cc6c
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found Reviewed-by: vinnie
jdk/test/sun/security/tools/keytool/autotest.sh
--- a/jdk/test/sun/security/tools/keytool/autotest.sh	Mon Sep 17 11:27:25 2012 +0200
+++ b/jdk/test/sun/security/tools/keytool/autotest.sh	Mon Sep 17 18:19:16 2012 +0800
@@ -41,30 +41,35 @@
   exit 1
 fi
 
+find_one() {
+  for TARGET_FILE in $@; do
+    if [ -e "$TARGET_FILE" ]; then
+      echo $TARGET_FILE
+      return
+    fi
+  done
+}
+
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
   SunOS )
     FS="/"
-    LIBNAME=libsoftokn3.so
-    ARCH=`isainfo`
-    case "$ARCH" in
-      sparc* )
-        NSSDIR="/usr/lib/mps"
-        ;;
-      * )
-        echo "Will not run test on: Solaris ${ARCH}"
-        exit 0;
-        ;;
-    esac
+    LIBNAME="/usr/lib/mps/libsoftokn3.so"
     ;;
   Linux )
-    LIBNAME=libsoftokn3.so
     ARCH=`uname -m`
     FS="/"
     case "$ARCH" in
       i[3-6]86 )
-        NSSDIR="/usr/lib"
+        LIBNAME=`find_one \
+            "/usr/lib/libsoftokn3.so" \
+            "/usr/lib/i386-linux-gnu/nss/libsoftokn3.so"`
+        ;;
+      x86_64 )
+        LIBNAME=`find_one \
+            "/usr/lib64/libsoftokn3.so" \
+            "/usr/lib/x86_64-linux-gnu/nss/libsoftokn3.so"`
         ;;
       * )
         echo "Will not run test on: Linux ${ARCH}"
@@ -78,7 +83,13 @@
     ;;
 esac
 
-${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}KeyToolTest.java || exit 10
+if [ "$LIBNAME" = "" ]; then
+  echo "Cannot find LIBNAME"
+  exit 1
+fi
+
+${TESTJAVA}${FS}bin${FS}javac -d . -XDignore.symbol.file \
+        ${TESTSRC}${FS}KeyToolTest.java || exit 10
 
 NSS=${TESTSRC}${FS}..${FS}..${FS}pkcs11${FS}nss
 
@@ -91,7 +102,7 @@
 chmod u+w cert8.db
 
 echo | ${TESTJAVA}${FS}bin${FS}java -Dnss \
-   -Dnss.lib=${NSSDIR}${FS}${LIBNAME} \
+   -Dnss.lib=${LIBNAME} \
    KeyToolTest
 status=$?
 
@@ -105,4 +116,3 @@
 rm TestException.class
 
 exit $status
-