|
1 # |
|
2 # Copyright 2004 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 # CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 # have any 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 echo TESTSRC=${TESTSRC} |
|
46 echo TESTCLASSES=${TESTCLASSES} |
|
47 echo TESTJAVA=${TESTJAVA} |
|
48 echo "" |
|
49 |
|
50 # let java test exit if platform unsupported |
|
51 |
|
52 OS=`uname -s` |
|
53 case "$OS" in |
|
54 SunOS ) |
|
55 FS="/" |
|
56 PS=":" |
|
57 CP="${FS}bin${FS}cp" |
|
58 CHMOD="${FS}bin${FS}chmod" |
|
59 ;; |
|
60 Linux ) |
|
61 FS="/" |
|
62 PS=":" |
|
63 CP="${FS}bin${FS}cp" |
|
64 CHMOD="${FS}bin${FS}chmod" |
|
65 ;; |
|
66 Windows* ) |
|
67 FS="\\" |
|
68 PS=";" |
|
69 CP="cp" |
|
70 CHMOD="chmod" |
|
71 ;; |
|
72 esac |
|
73 |
|
74 # first make cert/key DBs writable |
|
75 |
|
76 ${CP} ${TESTSRC}${FS}..${FS}nss${FS}db${FS}cert8.db ${TESTCLASSES} |
|
77 ${CHMOD} +w ${TESTCLASSES}${FS}cert8.db |
|
78 |
|
79 ${CP} ${TESTSRC}${FS}..${FS}nss${FS}db${FS}key3.db ${TESTCLASSES} |
|
80 ${CHMOD} +w ${TESTCLASSES}${FS}key3.db |
|
81 |
|
82 # compile test |
|
83 |
|
84 ${TESTJAVA}${FS}bin${FS}javac \ |
|
85 -classpath ${TESTSRC}${FS}.. \ |
|
86 -d ${TESTCLASSES} \ |
|
87 ${TESTSRC}${FS}Login.java |
|
88 |
|
89 # run test |
|
90 |
|
91 ${TESTJAVA}${FS}bin${FS}java \ |
|
92 -classpath ${TESTCLASSES} \ |
|
93 -DCUSTOM_DB_DIR=${TESTCLASSES} \ |
|
94 -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}Login-nss.txt \ |
|
95 -DNO_DEFAULT=true \ |
|
96 -DNO_DEIMOS=true \ |
|
97 -Dtest.src=${TESTSRC} \ |
|
98 -Dtest.classes=${TESTCLASSES} \ |
|
99 -Djava.security.manager \ |
|
100 -Djava.security.policy=${TESTSRC}${FS}Login.policy \ |
|
101 -Djava.security.debug=${DEBUG} \ |
|
102 Login |
|
103 |
|
104 # save error status |
|
105 status=$? |
|
106 |
|
107 # return |
|
108 exit $status |