author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 40261 | jdk/test/sun/security/tools/keytool/autotest.sh@86a49ba76f52 |
child 49882 | a02abc7e5536 |
permissions | -rw-r--r-- |
2 | 1 |
# |
24629
97bddac495b7
8044038: Security tests fail on 32 bit linux platform
vinnie
parents:
22965
diff
changeset
|
2 |
# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
# |
|
5506 | 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. |
|
2 | 22 |
# |
23 |
||
24 |
# @test |
|
25 |
# @summary (almost) all keytool behaviors |
|
26 |
# @author Weijun Wang |
|
27 |
# |
|
2067
6f9db5f305cd
6780416: New keytool commands/options: -gencert, -printcertreq, -ext
weijun
parents:
629
diff
changeset
|
28 |
# This test is only executed on several platforms |
6f9db5f305cd
6780416: New keytool commands/options: -gencert, -printcertreq, -ext
weijun
parents:
629
diff
changeset
|
29 |
# |
2 | 30 |
# set a few environment variables so that the shell-script can run stand-alone |
31 |
# in the source directory |
|
32 |
if [ "${TESTSRC}" = "" ] ; then |
|
33 |
TESTSRC="." |
|
34 |
fi |
|
35 |
if [ "${TESTCLASSES}" = "" ] ; then |
|
36 |
TESTCLASSES="." |
|
37 |
fi |
|
38 |
if [ "${TESTJAVA}" = "" ] ; then |
|
39 |
echo "TESTJAVA not set. Test cannot execute." |
|
40 |
echo "FAILED!!!" |
|
41 |
exit 1 |
|
42 |
fi |
|
15254
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14182
diff
changeset
|
43 |
if [ "${COMPILEJAVA}" = "" ]; then |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14182
diff
changeset
|
44 |
COMPILEJAVA="${TESTJAVA}" |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14182
diff
changeset
|
45 |
fi |
2 | 46 |
|
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
47 |
find_one() { |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
48 |
for TARGET_FILE in $@; do |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
49 |
if [ -e "$TARGET_FILE" ]; then |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
50 |
echo $TARGET_FILE |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
51 |
return |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
52 |
fi |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
53 |
done |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
54 |
} |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
55 |
|
20762
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
56 |
FS="/" |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
57 |
${TESTJAVA}${FS}bin${FS}java -XshowSettings:properties -version 2> allprop |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
58 |
cat allprop | grep sun.arch.data.model | grep 32 |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
59 |
if [ "$?" != "0" ]; then |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
60 |
B32=false |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
61 |
else |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
62 |
B32=true |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
63 |
fi |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
64 |
|
2 | 65 |
# set platform-dependent variables |
66 |
OS=`uname -s` |
|
67 |
case "$OS" in |
|
68 |
SunOS ) |
|
69 |
FS="/" |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
15254
diff
changeset
|
70 |
LIBNAME="/usr/lib/mps/`isainfo -n`/libsoftokn3.so" |
2 | 71 |
;; |
72 |
Linux ) |
|
20762
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
73 |
if [ $B32 = true ]; then |
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
74 |
LIBNAME=`find_one \ |
24629
97bddac495b7
8044038: Security tests fail on 32 bit linux platform
vinnie
parents:
22965
diff
changeset
|
75 |
"/usr/lib32/libsoftokn3.so" \ |
97bddac495b7
8044038: Security tests fail on 32 bit linux platform
vinnie
parents:
22965
diff
changeset
|
76 |
"/usr/lib32/nss/libsoftokn3.so" \ |
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
77 |
"/usr/lib/libsoftokn3.so" \ |
20871
b5fa714232e7
8026712: TEST_BUG: update sun/security/tools/keytool/autotest.sh with a new location to find of libsoftokn3.so
weijun
parents:
20771
diff
changeset
|
78 |
"/usr/lib/i386-linux-gnu/nss/libsoftokn3.so" \ |
b5fa714232e7
8026712: TEST_BUG: update sun/security/tools/keytool/autotest.sh with a new location to find of libsoftokn3.so
weijun
parents:
20771
diff
changeset
|
79 |
"/usr/lib/nss/libsoftokn3.so"` |
14010
24f9f29d5532
7200682: TEST_BUG: keytool/autotest.sh still has problems with libsoftokn.so
weijun
parents:
13809
diff
changeset
|
80 |
else |
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
81 |
LIBNAME=`find_one \ |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
82 |
"/usr/lib64/libsoftokn3.so" \ |
20871
b5fa714232e7
8026712: TEST_BUG: update sun/security/tools/keytool/autotest.sh with a new location to find of libsoftokn3.so
weijun
parents:
20771
diff
changeset
|
83 |
"/usr/lib/x86_64-linux-gnu/nss/libsoftokn3.so" \ |
b5fa714232e7
8026712: TEST_BUG: update sun/security/tools/keytool/autotest.sh with a new location to find of libsoftokn3.so
weijun
parents:
20771
diff
changeset
|
84 |
"/usr/lib/nss/libsoftokn3.so"` |
14010
24f9f29d5532
7200682: TEST_BUG: keytool/autotest.sh still has problems with libsoftokn.so
weijun
parents:
13809
diff
changeset
|
85 |
fi |
2 | 86 |
;; |
26863 | 87 |
Darwin ) |
26970
51018a2f505d
8060007: Keytool test can use bundled NSS lib on Mac
weijun
parents:
26863
diff
changeset
|
88 |
LIBNAME="$TESTSRC/../../pkcs11/nss/lib/macosx-x86_64/libsoftokn3.dylib" |
26863 | 89 |
;; |
2 | 90 |
* ) |
91 |
echo "Will not run test on: ${OS}" |
|
92 |
exit 0; |
|
93 |
;; |
|
94 |
esac |
|
95 |
||
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
96 |
if [ "$LIBNAME" = "" ]; then |
14182
3041082abb40
7194449: String resources for Key Tool and Policy Tool should be in their respective packages
sflores
parents:
14010
diff
changeset
|
97 |
echo "Cannot find libsoftokn3.so" |
20762
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
98 |
exit 0 |
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
99 |
fi |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
100 |
|
26863 | 101 |
echo "Using NSS lib at $LIBNAME" |
102 |
||
40261
86a49ba76f52
8136930: Simplify use of module-system options by custom launchers
mchung
parents:
36928
diff
changeset
|
103 |
EXTRAOPTS="--add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED \ |
86a49ba76f52
8136930: Simplify use of module-system options by custom launchers
mchung
parents:
36928
diff
changeset
|
104 |
--add-exports java.base/sun.security.util=ALL-UNNAMED \ |
86a49ba76f52
8136930: Simplify use of module-system options by custom launchers
mchung
parents:
36928
diff
changeset
|
105 |
--add-exports java.base/sun.security.x509=ALL-UNNAMED" |
36511 | 106 |
|
107 |
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . -XDignore.symbol.file \ |
|
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
108 |
${TESTSRC}${FS}KeyToolTest.java || exit 10 |
2 | 109 |
|
110 |
NSS=${TESTSRC}${FS}..${FS}..${FS}pkcs11${FS}nss |
|
111 |
||
112 |
cp ${TESTSRC}${FS}p11-nss.txt . |
|
113 |
cp ${NSS}${FS}db${FS}cert8.db . |
|
114 |
cp ${NSS}${FS}db${FS}key3.db . |
|
115 |
cp ${NSS}${FS}db${FS}secmod.db . |
|
116 |
||
117 |
chmod u+w key3.db |
|
118 |
chmod u+w cert8.db |
|
119 |
||
36511 | 120 |
echo | ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRAOPTS} -Dnss \ |
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
121 |
-Dnss.lib=${LIBNAME} \ |
629 | 122 |
KeyToolTest |
123 |
status=$? |
|
2 | 124 |
|
629 | 125 |
exit $status |