1 # 2 # Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. 8 # 9 # This code is distributed in the hope that it will be useful, but WITHOUT 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 # version 2 for more details (a copy is included in the LICENSE file that 13 # accompanied this code). 14 # 15 # You should have received a copy of the GNU General Public License version 16 # 2 along with this work; if not, write to the Free Software Foundation, 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 # 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 # or visit www.oracle.com if you need additional information or have any 21 # questions. 22 # 23 24 # @test 25 # @bug 4850423 26 # @summary login facilities for hardware tokens 27 # 28 # @run shell Login.sh 29 30 # set a few environment variables so that the shell-script can run stand-alone 31 # in the source directory 32 33 # if running by hand on windows, change TESTSRC and TESTCLASSES to "." 34 if [ "${TESTSRC}" = "" ] ; then 35 TESTSRC=`pwd` 36 fi 37 if [ "${TESTCLASSES}" = "" ] ; then 38 TESTCLASSES=`pwd` 39 fi 40 41 # if running by hand on windows, change this to appropriate value 42 if [ "${TESTJAVA}" = "" ] ; then 43 TESTJAVA="/net/radiant/export1/charlie/mustang/build/solaris-sparc" 44 fi 45 if [ "${COMPILEJAVA}" = "" ]; then 46 COMPILEJAVA="${TESTJAVA}" 47 fi 48 echo TESTSRC=${TESTSRC} 49 echo TESTCLASSES=${TESTCLASSES} 50 echo TESTJAVA=${TESTJAVA} 51 echo COMPILEJAVA=${COMPILEJAVA} 52 echo CPAPPEND=${CPAPPEND} 53 echo "" 54 55 # let java test exit if platform unsupported 56 57 OS=`uname -s` 58 case "$OS" in 59 Linux ) 60 FS="/" 61 PS=":" 62 CP="${FS}bin${FS}cp" 63 CHMOD="${FS}bin${FS}chmod" 64 ;; 65 Darwin ) 66 FS="/" 67 PS=":" 68 CP="${FS}bin${FS}cp" 69 CHMOD="${FS}bin${FS}chmod" 70 ;; 71 AIX ) 72 FS="/" 73 PS=":" 74 CP="${FS}bin${FS}cp" 75 CHMOD="${FS}bin${FS}chmod" 76 ;; 77 Windows* ) 78 FS="\\" 79 PS=";" 80 CP="cp" 81 CHMOD="chmod" 82 ;; 83 CYGWIN* ) 84 FS="/" 85 PS=";" 86 CP="cp" 87 CHMOD="chmod" 88 # 89 # javac does not like /cygdrive produced by `pwd` 90 # 91 TESTSRC=`cygpath -d ${TESTSRC}` 92 ;; 93 * ) 94 echo "Unrecognized system!" 95 exit 1; 96 ;; 97 esac 98 99 # first make cert/key DBs writable 100 101 ${CP} ${TESTSRC}${FS}..${FS}nss${FS}db${FS}cert8.db ${TESTCLASSES} 102 ${CHMOD} +w ${TESTCLASSES}${FS}cert8.db 103 104 ${CP} ${TESTSRC}${FS}..${FS}nss${FS}db${FS}key3.db ${TESTCLASSES} 105 ${CHMOD} +w ${TESTCLASSES}${FS}key3.db 106 107 # compile test 108 109 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \ 110 -classpath ${TESTSRC}${FS}.. \ 111 -d ${TESTCLASSES} \ 112 ${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \ 113 ${TESTSRC}${FS}Login.java \ 114 ${TESTSRC}${FS}..${FS}PKCS11Test.java 115 116 # run test 117 118 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ 119 -classpath ${TESTCLASSES}${PS}${CPAPPEND} \ 120 -DCUSTOM_DB_DIR=${TESTCLASSES} \ 121 -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}Login-nss.txt \ 122 -DNO_DEFAULT=true \ 123 -DNO_DEIMOS=true \ 124 -Dtest.src=${TESTSRC} \ 125 -Dtest.classes=${TESTCLASSES} \ 126 -Djava.security.debug=${DEBUG} \ 127 Login sm Login.policy 128 129 # save error status 130 status=$? 131 132 # return 133 exit $status