Fri, 25 Oct 2013 12:40:10 -0700
Merge
1 #!/bin/sh
2 #
3 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 #
6 # This code is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License version 2 only, as
8 # published by the Free Software Foundation.
9 #
10 # This code is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # version 2 for more details (a copy is included in the LICENSE file that
14 # accompanied this code).
15 #
16 # You should have received a copy of the GNU General Public License version
17 # 2 along with this work; if not, write to the Free Software Foundation,
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 #
20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 # or visit www.oracle.com if you need additional information or have any
22 # questions.
23 #
25 #
26 # This Environment script was written to capture typically used environment
27 # setup for a given shell test.
28 #
30 # TESTJAVA can be a JDK or JRE. If JRE you need to set COMPILEJAVA
31 if [ "${TESTJAVA}" = "" ]
32 then
33 echo "TESTJAVA not set. Test cannot execute. Failed."
34 exit 1
35 fi
36 echo "TESTJAVA=${TESTJAVA}"
38 # COMPILEJAVA requires a JDK, some shell test use javac,jar,etc
39 if [ "${COMPILEJAVA}" = "" ]
40 then
41 echo "COMPILEJAVA not set. Using TESTJAVA as default"
42 COMPILEJAVA=${TESTJAVA}
43 fi
44 echo "COMPILEJAVA=${COMPILEJAVA}"
46 if [ "${TESTCLASSES}" = "" ]
47 then
48 echo "TESTCLASES not set. Using "." as default"
49 TESTCLASSES=.
50 fi
51 echo "TESTCLASSES=${TESTCLASSES}"
53 # set platform-dependent variables
54 OS=`uname -s`
55 case "$OS" in
56 SunOS | Linux | Darwin )
57 NULL=/dev/null
58 PS=":"
59 FS="/"
60 RM=/bin/rm
61 CP=/bin/cp
62 MV=/bin/mv
63 ;;
64 Windows_* )
65 NULL=NUL
66 PS=";"
67 FS="\\"
68 RM=rm
69 CP=cp
70 MV=mv
71 ;;
72 CYGWIN_* )
73 NULL=/dev/null
74 PS=";"
75 FS="/"
76 RM=rm
77 CP=cp
78 MV=mv
79 ;;
80 * )
81 echo "Unrecognized system!"
82 exit 1;
83 ;;
84 esac
86 export NULL PS FS RM CP MV
87 echo "NULL =${NULL}"
88 echo "PS =${PS}"
89 echo "FS =${FS}"
90 echo "RM =${RM}"
91 echo "CP =${CP}"
92 echo "MV =${MV}"
94 # jtreg -classpathappend:<path>
95 JEMMYPATH=${CPAPPEND}
96 CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
97 echo "CLASSPATH =${CLASSPATH}"
99 # Current directory is scratch directory
100 THIS_DIR=.
101 echo "THIS_DIR=${THIS_DIR}"
103 # Check to ensure the java defined actually works
104 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version
105 if [ $? != 0 ]; then
106 echo "Wrong TESTJAVA or TESTVMOPTS:"
107 echo $TESTJAVA TESTVMOPTS
108 exit 1
109 fi
111 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Xinternalversion > vm_version.out 2>&1
113 VM_TYPE="unknown"
114 grep "Server" vm_version.out > ${NULL}
115 if [ $? = 0 ]
116 then
117 VM_TYPE="server"
118 fi
119 grep "Client" vm_version.out > ${NULL}
120 if [ $? = 0 ]
121 then
122 VM_TYPE="client"
123 fi
125 VM_BITS="32"
126 grep "64-Bit" vm_version.out > ${NULL}
127 if [ $? = 0 ]
128 then
129 VM_BITS="64"
130 fi
132 VM_OS="unknown"
133 grep "solaris" vm_version.out > ${NULL}
134 if [ $? = 0 ]
135 then
136 VM_OS="solaris"
137 fi
138 grep "linux" vm_version.out > ${NULL}
139 if [ $? = 0 ]
140 then
141 VM_OS="linux"
142 fi
143 grep "windows" vm_version.out > ${NULL}
144 if [ $? = 0 ]
145 then
146 VM_OS="windows"
147 fi
148 grep "bsd" vm_version.out > ${NULL}
149 if [ $? = 0 ]
150 then
151 VM_OS="bsd"
152 fi
154 VM_CPU="unknown"
155 grep "sparc" vm_version.out > ${NULL}
156 if [ $? = 0 ]
157 then
158 VM_CPU="sparc"
159 if [ $VM_BITS = "64" ]
160 then
161 VM_CPU="sparcv9"
162 fi
163 fi
164 grep "x86" vm_version.out > ${NULL}
165 if [ $? = 0 ]
166 then
167 VM_CPU="i386"
168 fi
169 grep "amd64" vm_version.out > ${NULL}
170 if [ $? = 0 ]
171 then
172 VM_CPU="amd64"
173 fi
174 grep "arm" vm_version.out > ${NULL}
175 if [ $? = 0 ]
176 then
177 VM_CPU="arm"
178 fi
179 grep "ppc" vm_version.out > ${NULL}
180 if [ $? = 0 ]
181 then
182 VM_CPU="ppc"
183 fi
184 grep "ia64" vm_version.out > ${NULL}
185 if [ $? = 0 ]
186 then
187 VM_CPU="ia64"
188 fi
189 export VM_TYPE VM_BITS VM_OS VM_CPU
190 echo "VM_TYPE=${VM_TYPE}"
191 echo "VM_BITS=${VM_BITS}"
192 echo "VM_OS=${VM_OS}"
193 echo "VM_CPU=${VM_CPU}"