comparison test/runtime/7110720/Test7110720.sh @ 6150:1e76463170b3

7110720: Issue with vm config file loadingIssue with vm config file loading Summary: disabling default config files if -XX:-ReadDefaultConfigFiles Reviewed-by: phh, jrose, dcubed, dholmes
author kamg
date Thu, 29 Mar 2012 18:55:32 -0400
parents
children 6acee021f5ac
comparison
equal deleted inserted replaced
4813:e850d8e7ea54 6150:1e76463170b3
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
6
7 #
8 # @test Test7110720.sh
9 # @bug 7110720
10 # @summary improve VM configuration file loading
11 # @run shell Test7110720.sh
12 #
13
14 if [ "${TESTSRC}" = "" ]
15 then TESTSRC=.
16 fi
17
18 if [ "${TESTJAVA}" = "" ]
19 then
20 PARENT=`dirname \`which java\``
21 TESTJAVA=`dirname ${PARENT}`
22 echo "TESTJAVA not set, selecting " ${TESTJAVA}
23 echo "If this is incorrect, try setting the variable manually."
24 fi
25
26 if [ "${TESTCLASSES}" = "" ]
27 then
28 echo "TESTCLASSES not set. Test cannot execute. Failed."
29 exit 1
30 fi
31
32 # Jtreg sets TESTVMOPTS which may include -d64 which is
33 # required to test a 64-bit JVM on some platforms.
34 # If another test harness still creates HOME/JDK64BIT,
35 # we can recognise that.
36
37 # set platform-dependent variables
38 OS=`uname -s`
39 case "$OS" in
40 SunOS | Linux )
41 FS="/"
42 RM=/bin/rm
43 CP=/bin/cp
44 MV=/bin/mv
45 ## for solaris, linux it's HOME
46 FILE_LOCATION=$HOME
47 if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
48 then
49 TESTVMOPTS=`cat ${FILE_LOCATION}${FS}JDK64BIT`
50 fi
51 ;;
52 Windows_* )
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
65 JAVA=${TESTJAVA}${FS}bin${FS}java
66
67 # Don't test debug builds, they do read the config files:
68 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "debug" >/dev/null
69 if [ "$?" = "0" ]; then
70 echo Skipping test for debug build.
71 exit 0
72 fi
73
74 ok=yes
75
76 $RM -f .hotspot_compiler .hotspotrc
77
78 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
79 if [ "$?" = "0" ]; then
80 echo "FAILED: base case failure"
81 exit 1
82 fi
83
84
85 echo "garbage in, garbage out" > .hotspot_compiler
86 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
87 if [ "$?" = "0" ]; then
88 echo "FAILED: .hotspot_compiler was read"
89 ok=no
90 fi
91
92 $MV .hotspot_compiler hs_comp.txt
93 ${JAVA} ${TESTVMOPTS} -XX:CompileCommandFile=hs_comp.txt -version 2>&1 | grep "garbage in" >/dev/null
94 if [ "$?" = "1" ]; then
95 echo "FAILED: explicit compiler command file not read"
96 ok=no
97 fi
98
99 $RM -f .hotspot_compiler hs_comp.txt
100
101 echo "garbage" > .hotspotrc
102 ${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage" >/dev/null
103 if [ "$?" = "0" ]; then
104 echo "FAILED: .hotspotrc was read"
105 ok=no
106 fi
107
108 $MV .hotspotrc hs_flags.txt
109 ${JAVA} ${TESTVMOPTS} -XX:Flags=hs_flags.txt -version 2>&1 | grep "garbage" >/dev/null
110 if [ "$?" = "1" ]; then
111 echo "FAILED: explicit flags file not read"
112 ok=no
113 fi
114
115 if [ "${ok}" = "no" ]; then
116 echo "Some tests failed."
117 exit 1
118 else
119 echo "Passed"
120 exit 0
121 fi
122