1715
|
1 #
|
|
2 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
|
3 # SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
|
4 #
|
|
5
|
|
6 #
|
|
7 # @test @(#)Test6626217.sh
|
|
8 # @bug 6626217
|
|
9 # @summary Loader-constraint table allows arrays instead of only the base-classes
|
|
10 # @run shell Test6626217.sh
|
|
11 #
|
|
12
|
|
13 if [ "${TESTSRC}" = "" ]
|
|
14 then TESTSRC=.
|
|
15 fi
|
|
16
|
|
17 if [ "${TESTJAVA}" = "" ]
|
|
18 then
|
|
19 PARENT=`dirname \`which java\``
|
|
20 TESTJAVA=`dirname ${PARENT}`
|
|
21 echo "TESTJAVA not set, selecting " ${TESTJAVA}
|
|
22 echo "If this is incorrect, try setting the variable manually."
|
|
23 fi
|
|
24
|
|
25 if [ "${TESTCLASSES}" = "" ]
|
|
26 then
|
|
27 echo "TESTCLASSES not set. Test cannot execute. Failed."
|
|
28 exit 1
|
|
29 fi
|
|
30
|
|
31 BIT_FLAG=""
|
|
32
|
|
33 # set platform-dependent variables
|
|
34 OS=`uname -s`
|
|
35 case "$OS" in
|
|
36 SunOS | Linux )
|
|
37 NULL=/dev/null
|
|
38 PS=":"
|
|
39 FS="/"
|
|
40 RM=/bin/rm
|
|
41 CP=/bin/cp
|
|
42 MV=/bin/mv
|
|
43 ## for solaris, linux it's HOME
|
|
44 FILE_LOCATION=$HOME
|
|
45 if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
|
|
46 then
|
|
47 BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT`
|
|
48 fi
|
|
49 ;;
|
|
50 Windows_* )
|
|
51 NULL=NUL
|
|
52 PS=";"
|
|
53 FS="\\"
|
|
54 RM=rm
|
|
55 CP=cp
|
|
56 MV=mv
|
|
57 ;;
|
|
58 * )
|
|
59 echo "Unrecognized system!"
|
|
60 exit 1;
|
|
61 ;;
|
|
62 esac
|
|
63
|
|
64 JEMMYPATH=${CPAPPEND}
|
|
65 CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
|
|
66
|
|
67 THIS_DIR=`pwd`
|
|
68
|
|
69 JAVA=${TESTJAVA}${FS}bin${FS}java
|
|
70 JAVAC=${TESTJAVA}${FS}bin${FS}javac
|
|
71
|
|
72 ${JAVA} ${BIT_FLAG} -version
|
|
73
|
|
74 # Current directory is scratch directory, copy all the test source there
|
|
75 # (for the subsequent moves to work).
|
|
76 ${CP} ${TESTSRC}${FS}* ${THIS_DIR}
|
|
77
|
|
78 # A Clean Compile: this line will probably fail within jtreg as have a clean dir:
|
|
79 ${RM} -f *.class *.impl many_loader.java
|
|
80
|
|
81 # Compile all the usual suspects, including the default 'many_loader'
|
|
82 ${CP} many_loader1.java.foo many_loader.java
|
|
83 ${JAVAC} -source 1.4 -target 1.4 -Xlint *.java
|
|
84
|
|
85 # Rename the class files, so the custom loader (and not the system loader) will find it
|
|
86 ${MV} from_loader2.class from_loader2.impl2
|
|
87
|
|
88 # Compile the next version of 'many_loader'
|
|
89 ${MV} many_loader.class many_loader.impl1
|
|
90 ${CP} many_loader2.java.foo many_loader.java
|
|
91 ${JAVAC} -source 1.4 -target 1.4 -Xlint many_loader.java
|
|
92
|
|
93 # Rename the class file, so the custom loader (and not the system loader) will find it
|
|
94 ${MV} many_loader.class many_loader.impl2
|
|
95 ${MV} many_loader.impl1 many_loader.class
|
|
96 ${RM} many_loader.java
|
|
97
|
|
98 ${JAVA} ${BIT_FLAG} -Xverify -Xint -cp . bug_21227 >test.out 2>&1
|
|
99 grep "violates loader constraints" test.out
|
|
100 exit $?
|
|
101
|