1 | #
|
---|
2 | # Copyright (c) 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 |
|
---|
25 | #
|
---|
26 | # @test Test7110720.sh
|
---|
27 | # @bug 7110720
|
---|
28 | # @summary improve VM configuration file loading
|
---|
29 | # @run shell Test7110720.sh
|
---|
30 | #
|
---|
31 |
|
---|
32 | if [ "${TESTSRC}" = "" ]
|
---|
33 | then TESTSRC=.
|
---|
34 | fi
|
---|
35 |
|
---|
36 | if [ "${TESTJAVA}" = "" ]
|
---|
37 | then
|
---|
38 | PARENT=`dirname \`which java\``
|
---|
39 | TESTJAVA=`dirname ${PARENT}`
|
---|
40 | echo "TESTJAVA not set, selecting " ${TESTJAVA}
|
---|
41 | echo "If this is incorrect, try setting the variable manually."
|
---|
42 | fi
|
---|
43 |
|
---|
44 | if [ "${TESTCLASSES}" = "" ]
|
---|
45 | then
|
---|
46 | echo "TESTCLASSES not set. Test cannot execute. Failed."
|
---|
47 | exit 1
|
---|
48 | fi
|
---|
49 |
|
---|
50 | # set platform-dependent variables
|
---|
51 | OS=`uname -s`
|
---|
52 | case "$OS" in
|
---|
53 | SunOS | Linux )
|
---|
54 | FS="/"
|
---|
55 | RM=/bin/rm
|
---|
56 | CP=/bin/cp
|
---|
57 | MV=/bin/mv
|
---|
58 | ;;
|
---|
59 | Windows_* )
|
---|
60 | FS="\\"
|
---|
61 | RM=rm
|
---|
62 | CP=cp
|
---|
63 | MV=mv
|
---|
64 | ;;
|
---|
65 | * )
|
---|
66 | echo "Unrecognized system!"
|
---|
67 | exit 1;
|
---|
68 | ;;
|
---|
69 | esac
|
---|
70 |
|
---|
71 |
|
---|
72 | JAVA=${TESTJAVA}${FS}bin${FS}java
|
---|
73 |
|
---|
74 | # Don't test debug builds, they do read the config files:
|
---|
75 | ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "debug" >/dev/null
|
---|
76 | if [ "$?" = "0" ]; then
|
---|
77 | echo Skipping test for debug build.
|
---|
78 | exit 0
|
---|
79 | fi
|
---|
80 |
|
---|
81 | ok=yes
|
---|
82 |
|
---|
83 | $RM -f .hotspot_compiler .hotspotrc
|
---|
84 |
|
---|
85 | ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
|
---|
86 | if [ "$?" = "0" ]; then
|
---|
87 | echo "FAILED: base case failure"
|
---|
88 | exit 1
|
---|
89 | fi
|
---|
90 |
|
---|
91 |
|
---|
92 | echo "garbage in, garbage out" > .hotspot_compiler
|
---|
93 | ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
|
---|
94 | if [ "$?" = "0" ]; then
|
---|
95 | echo "FAILED: .hotspot_compiler was read"
|
---|
96 | ok=no
|
---|
97 | fi
|
---|
98 |
|
---|
99 | $MV .hotspot_compiler hs_comp.txt
|
---|
100 | ${JAVA} ${TESTVMOPTS} -XX:CompileCommandFile=hs_comp.txt -version 2>&1 | grep "garbage in" >/dev/null
|
---|
101 | if [ "$?" = "1" ]; then
|
---|
102 | echo "FAILED: explicit compiler command file not read"
|
---|
103 | ok=no
|
---|
104 | fi
|
---|
105 |
|
---|
106 | $RM -f .hotspot_compiler hs_comp.txt
|
---|
107 |
|
---|
108 | echo "garbage" > .hotspotrc
|
---|
109 | ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage" >/dev/null
|
---|
110 | if [ "$?" = "0" ]; then
|
---|
111 | echo "FAILED: .hotspotrc was read"
|
---|
112 | ok=no
|
---|
113 | fi
|
---|
114 |
|
---|
115 | $MV .hotspotrc hs_flags.txt
|
---|
116 | ${JAVA} ${TESTVMOPTS} -XX:Flags=hs_flags.txt -version 2>&1 | grep "garbage" >/dev/null
|
---|
117 | if [ "$?" = "1" ]; then
|
---|
118 | echo "FAILED: explicit flags file not read"
|
---|
119 | ok=no
|
---|
120 | fi
|
---|
121 |
|
---|
122 | if [ "${ok}" = "no" ]; then
|
---|
123 | echo "Some tests failed."
|
---|
124 | exit 1
|
---|
125 | else
|
---|
126 | echo "Passed"
|
---|
127 | exit 0
|
---|
128 | fi
|
---|
129 |
|
---|