author | jjiang |
Thu, 16 Aug 2018 02:00:31 +0800 | |
changeset 51461 | 58d7aa066071 |
parent 49882 | a02abc7e5536 |
permissions | -rw-r--r-- |
2 | 1 |
# |
49882
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
2 |
# Copyright (c) 2006, 2018, 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 |
|
49882
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
27 |
# @library /test/lib |
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
28 |
# @build jdk.test.lib.util.FileUtils |
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
29 |
# @run shell/timeout=600 autotest.sh |
2067
6f9db5f305cd
6780416: New keytool commands/options: -gencert, -printcertreq, -ext
weijun
parents:
629
diff
changeset
|
30 |
# This test is only executed on several platforms |
6f9db5f305cd
6780416: New keytool commands/options: -gencert, -printcertreq, -ext
weijun
parents:
629
diff
changeset
|
31 |
# |
2 | 32 |
# set a few environment variables so that the shell-script can run stand-alone |
33 |
# in the source directory |
|
34 |
if [ "${TESTSRC}" = "" ] ; then |
|
35 |
TESTSRC="." |
|
36 |
fi |
|
37 |
if [ "${TESTCLASSES}" = "" ] ; then |
|
38 |
TESTCLASSES="." |
|
39 |
fi |
|
40 |
if [ "${TESTJAVA}" = "" ] ; then |
|
41 |
echo "TESTJAVA not set. Test cannot execute." |
|
42 |
echo "FAILED!!!" |
|
43 |
exit 1 |
|
44 |
fi |
|
15254
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14182
diff
changeset
|
45 |
if [ "${COMPILEJAVA}" = "" ]; then |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14182
diff
changeset
|
46 |
COMPILEJAVA="${TESTJAVA}" |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14182
diff
changeset
|
47 |
fi |
2 | 48 |
|
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
49 |
find_one() { |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
50 |
for TARGET_FILE in $@; do |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
51 |
if [ -e "$TARGET_FILE" ]; then |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
52 |
echo $TARGET_FILE |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
53 |
return |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
54 |
fi |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
55 |
done |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
56 |
} |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
57 |
|
20762
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
58 |
FS="/" |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
59 |
${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
|
60 |
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
|
61 |
if [ "$?" != "0" ]; then |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
62 |
B32=false |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
63 |
else |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
64 |
B32=true |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
65 |
fi |
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
66 |
|
2 | 67 |
# set platform-dependent variables |
68 |
OS=`uname -s` |
|
69 |
case "$OS" in |
|
70 |
SunOS ) |
|
71 |
FS="/" |
|
20201
50cc2d25a60b
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
ksrini
parents:
15254
diff
changeset
|
72 |
LIBNAME="/usr/lib/mps/`isainfo -n`/libsoftokn3.so" |
2 | 73 |
;; |
74 |
Linux ) |
|
20762
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
75 |
if [ $B32 = true ]; then |
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
76 |
LIBNAME=`find_one \ |
24629
97bddac495b7
8044038: Security tests fail on 32 bit linux platform
vinnie
parents:
22965
diff
changeset
|
77 |
"/usr/lib32/libsoftokn3.so" \ |
97bddac495b7
8044038: Security tests fail on 32 bit linux platform
vinnie
parents:
22965
diff
changeset
|
78 |
"/usr/lib32/nss/libsoftokn3.so" \ |
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
79 |
"/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
|
80 |
"/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
|
81 |
"/usr/lib/nss/libsoftokn3.so"` |
14010
24f9f29d5532
7200682: TEST_BUG: keytool/autotest.sh still has problems with libsoftokn.so
weijun
parents:
13809
diff
changeset
|
82 |
else |
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
83 |
LIBNAME=`find_one \ |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
84 |
"/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
|
85 |
"/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
|
86 |
"/usr/lib/nss/libsoftokn3.so"` |
14010
24f9f29d5532
7200682: TEST_BUG: keytool/autotest.sh still has problems with libsoftokn.so
weijun
parents:
13809
diff
changeset
|
87 |
fi |
2 | 88 |
;; |
89 |
* ) |
|
90 |
echo "Will not run test on: ${OS}" |
|
91 |
exit 0; |
|
92 |
;; |
|
93 |
esac |
|
49882
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
94 |
case "$OS" in |
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
95 |
Windows_* | CYGWIN* ) |
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
96 |
PS=";" |
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
97 |
;; |
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
98 |
* ) |
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
99 |
PS=":" |
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
100 |
;; |
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
101 |
esac |
2 | 102 |
|
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
103 |
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
|
104 |
echo "Cannot find libsoftokn3.so" |
20762
7ec392af43cd
8026235: keytool NSS test should use 64 bit lib on Solaris
weijun
parents:
15254
diff
changeset
|
105 |
exit 0 |
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
106 |
fi |
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
107 |
|
26863 | 108 |
echo "Using NSS lib at $LIBNAME" |
109 |
||
40261
86a49ba76f52
8136930: Simplify use of module-system options by custom launchers
mchung
parents:
36928
diff
changeset
|
110 |
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
|
111 |
--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
|
112 |
--add-exports java.base/sun.security.x509=ALL-UNNAMED" |
49882
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
113 |
${COMPILEJAVA}${FS}bin${FS}javac -classpath ${TESTCLASSPATH} ${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
|
114 |
${TESTSRC}${FS}KeyToolTest.java || exit 10 |
2 | 115 |
|
116 |
NSS=${TESTSRC}${FS}..${FS}..${FS}pkcs11${FS}nss |
|
117 |
||
118 |
cp ${TESTSRC}${FS}p11-nss.txt . |
|
119 |
cp ${NSS}${FS}db${FS}cert8.db . |
|
120 |
cp ${NSS}${FS}db${FS}key3.db . |
|
121 |
cp ${NSS}${FS}db${FS}secmod.db . |
|
122 |
||
123 |
chmod u+w key3.db |
|
124 |
chmod u+w cert8.db |
|
49882
a02abc7e5536
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks
vtewari
parents:
47216
diff
changeset
|
125 |
echo | ${TESTJAVA}${FS}bin${FS}java -classpath .${PS}${TESTCLASSPATH} ${TESTVMOPTS} ${EXTRAOPTS} -Dnss \ |
13809
dea6d093c703
7196855: autotest.sh fails on ubuntu because libsoftokn.so not found
weijun
parents:
12294
diff
changeset
|
126 |
-Dnss.lib=${LIBNAME} \ |
629 | 127 |
KeyToolTest |
128 |
status=$? |
|
2 | 129 |
|
629 | 130 |
exit $status |