ktcheck.sh revision 9330:8b1f1c2a400f
1#
2# Copyright (c) 2010, 2012, 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 6950546
26# @summary "ktab -d name etype" to "ktab -d name [-e etype] [kvno | all | old]"
27# @run shell ktcheck.sh
28#
29
30if [ "${TESTJAVA}" = "" ] ; then
31  JAVAC_CMD=`which javac`
32  TESTJAVA=`dirname $JAVAC_CMD`/..
33fi
34
35if [ "${TESTSRC}" = "" ] ; then
36  TESTSRC="."
37fi
38
39OS=`uname -s`
40case "$OS" in
41  CYGWIN* )
42    FS="/"
43    ;;
44  Windows_* )
45    FS="\\"
46    ;;
47  * )
48    FS="/"
49    echo "Unsupported system!"
50    exit 0;
51    ;;
52esac
53
54KEYTAB=ktab.tmp
55
56rm $KEYTAB
57${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}KtabCheck.java
58
59EXTRA_OPTIONS="-Djava.security.krb5.conf=${TESTSRC}${FS}onlythree.conf"
60KTAB="${TESTJAVA}${FS}bin${FS}ktab -J${EXTRA_OPTIONS} -k $KEYTAB -f"
61CHECK="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRA_OPTIONS} KtabCheck $KEYTAB"
62
63echo ${EXTRA_OPTIONS}
64
65$KTAB -a me mine
66$CHECK 1 16 1 23 1 17 || exit 1
67$KTAB -a me mine -n 0
68$CHECK 0 16 0 23 0 17 || exit 1
69$KTAB -a me mine -n 1 -append
70$CHECK 0 16 0 23 0 17 1 16 1 23 1 17 || exit 1
71$KTAB -a me mine -append
72$CHECK 0 16 0 23 0 17 1 16 1 23 1 17 2 16 2 23 2 17 || exit 1
73$KTAB -a me mine
74$CHECK 3 16 3 23 3 17 || exit 1
75$KTAB -a me mine -n 4 -append
76$CHECK 3 16 3 23 3 17 4 16 4 23 4 17 || exit 1
77$KTAB -a me mine -n 5 -append
78$CHECK 3 16 3 23 3 17 4 16 4 23 4 17 5 16 5 23 5 17 || exit 1
79$KTAB -a me mine -n 6 -append
80$CHECK 3 16 3 23 3 17 4 16 4 23 4 17 5 16 5 23 5 17 6 16 6 23 6 17 || exit 1
81$KTAB -d me 3
82$CHECK 4 16 4 23 4 17 5 16 5 23 5 17 6 16 6 23 6 17 || exit 1
83$KTAB -d me -e 16 6
84$CHECK 4 16 4 23 4 17 5 16 5 23 5 17 6 23 6 17 || exit 1
85$KTAB -d me -e 17 6
86$CHECK 4 16 4 23 4 17 5 16 5 23 5 17 6 23 || exit 1
87$KTAB -d me -e 16 5
88$CHECK 4 16 4 23 4 17 5 23 5 17 6 23 || exit 1
89$KTAB -d me old
90$CHECK 4 16 5 17 6 23 || exit 1
91$KTAB -d me old
92$CHECK 4 16 5 17 6 23 || exit 1
93$KTAB -d me
94$CHECK || exit 1
95