jdk/test/sun/security/tools/keytool/printssl.sh
author weijun
Fri, 25 Apr 2014 10:57:09 +0800
changeset 24116 9f9b4ba34aad
parent 23237 0c0c7f131faa
permissions -rw-r--r--
8040321: keytool and jarsigner tests doesn't pass though VM tools to tools Reviewed-by: alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
904
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
     1
#
23237
0c0c7f131faa 8036844: test failures due to wrong keystore paths
juh
parents: 23010
diff changeset
     2
# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
904
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
     4
#
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
     7
# published by the Free Software Foundation.
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
     8
#
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    13
# accompanied this code).
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    14
#
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    18
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3433
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3433
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3433
diff changeset
    21
# questions.
904
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    22
#
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    23
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    24
# @test
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    25
# @bug 6480981
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    26
# @summary keytool should be able to import certificates from remote SSL servers
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    27
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    28
if [ "${TESTSRC}" = "" ] ; then
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    29
  TESTSRC="."
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    30
fi
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    31
if [ "${TESTJAVA}" = "" ] ; then
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    32
  echo "TESTJAVA not set.  Test cannot execute."
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    33
  echo "FAILED!!!"
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    34
  exit 1
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    35
fi
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    36
if [ "${COMPILEJAVA}" = "" ]; then
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    37
  COMPILEJAVA="${TESTJAVA}"
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    38
fi
904
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    39
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    40
# set platform-dependent variables
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    41
OS=`uname -s`
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    42
case "$OS" in
22602
0d9a07b0d7e9 8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents: 15254
diff changeset
    43
  SunOS | Linux | Darwin | AIX )
904
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    44
    FS="/"
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    45
    ;;
3433
3b2490b7a752 6867657: Many JSN tests do not run under cygwin
wetmore
parents: 904
diff changeset
    46
  CYGWIN* )
3b2490b7a752 6867657: Many JSN tests do not run under cygwin
wetmore
parents: 904
diff changeset
    47
    FS="/"
3b2490b7a752 6867657: Many JSN tests do not run under cygwin
wetmore
parents: 904
diff changeset
    48
    ;;
904
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    49
  Windows_* )
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    50
    FS="\\"
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    51
    ;;
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    52
  * )
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    53
    echo "Unrecognized operating system!"
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    54
    exit 1;
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    55
    ;;
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    56
esac
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    57
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    58
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}${FS}PrintSSL.java || exit 10
23237
0c0c7f131faa 8036844: test failures due to wrong keystore paths
juh
parents: 23010
diff changeset
    59
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dtest.src=$TESTSRC PrintSSL | (
0c0c7f131faa 8036844: test failures due to wrong keystore paths
juh
parents: 23010
diff changeset
    60
      read PORT
0c0c7f131faa 8036844: test failures due to wrong keystore paths
juh
parents: 23010
diff changeset
    61
      if [ "$PORT" = "" ]; then
0c0c7f131faa 8036844: test failures due to wrong keystore paths
juh
parents: 23010
diff changeset
    62
          echo "Server not started"
0c0c7f131faa 8036844: test failures due to wrong keystore paths
juh
parents: 23010
diff changeset
    63
          exit 2
0c0c7f131faa 8036844: test failures due to wrong keystore paths
juh
parents: 23010
diff changeset
    64
      else
24116
9f9b4ba34aad 8040321: keytool and jarsigner tests doesn't pass though VM tools to tools
weijun
parents: 23237
diff changeset
    65
          ${TESTJAVA}${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -printcert -sslserver localhost:$PORT
23237
0c0c7f131faa 8036844: test failures due to wrong keystore paths
juh
parents: 23010
diff changeset
    66
      fi
0c0c7f131faa 8036844: test failures due to wrong keystore paths
juh
parents: 23010
diff changeset
    67
)
904
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    68
status=$?
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    69
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    70
rm PrintSSL*.class
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    71
eadc9fa4b700 6480981: keytool should be able to import certificates from remote SSL servers
weijun
parents:
diff changeset
    72
exit $status