Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/test_env.sh
32278 views
#!/bin/sh1#2# Copyright (c) 2013, 2015, 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 it6# under the terms of the GNU General Public License version 2 only, as7# published by the Free Software Foundation.8#9# This code is distributed in the hope that it will be useful, but WITHOUT10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12# version 2 for more details (a copy is included in the LICENSE file that13# accompanied this code).14#15# You should have received a copy of the GNU General Public License version16# 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 USA20# or visit www.oracle.com if you need additional information or have any21# questions.22#2324#25# This Environment script was written to capture typically used environment26# setup for a given shell test.27#2829# TESTJAVA can be a JDK or JRE. If JRE you need to set COMPILEJAVA30if [ "${TESTJAVA}" = "" ]31then32echo "TESTJAVA not set. Test cannot execute. Failed."33exit 134fi35echo "TESTJAVA=${TESTJAVA}"3637# COMPILEJAVA requires a JDK, some shell test use javac,jar,etc38if [ "${COMPILEJAVA}" = "" ]39then40echo "COMPILEJAVA not set. Using TESTJAVA as default"41COMPILEJAVA=${TESTJAVA}42fi43echo "COMPILEJAVA=${COMPILEJAVA}"4445if [ "${TESTCLASSES}" = "" ]46then47echo "TESTCLASES not set. Using "." as default"48TESTCLASSES=.49fi50echo "TESTCLASSES=${TESTCLASSES}"5152# set platform-dependent variables53OS=`uname -s`54case "$OS" in55AIX | Darwin | Linux | SunOS )56NULL=/dev/null57PS=":"58FS="/"59RM=/bin/rm60CP=/bin/cp61MV=/bin/mv62;;63Windows_* )64NULL=NUL65PS=";"66FS="\\"67RM=rm68CP=cp69MV=mv70;;71CYGWIN_* )72NULL=/dev/null73PS=";"74FS="/"75RM=rm76CP=cp77MV=mv78;;79* )80echo "Unrecognized system!"81exit 1;82;;83esac8485export NULL PS FS RM CP MV86echo "NULL =${NULL}"87echo "PS =${PS}"88echo "FS =${FS}"89echo "RM =${RM}"90echo "CP =${CP}"91echo "MV =${MV}"9293# jtreg -classpathappend:<path>94JEMMYPATH=${CPAPPEND}95CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH96echo "CLASSPATH =${CLASSPATH}"9798# Current directory is scratch directory99THIS_DIR=.100echo "THIS_DIR=${THIS_DIR}"101102# Check to ensure the java defined actually works103${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version104if [ $? != 0 ]; then105echo "Wrong TESTJAVA or TESTVMOPTS:"106echo $TESTJAVA TESTVMOPTS107exit 1108fi109110${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Xinternalversion > vm_version.out 2>&1111112VM_TYPE="unknown"113grep "Server" vm_version.out > ${NULL}114if [ $? = 0 ]115then116VM_TYPE="server"117fi118grep "Client" vm_version.out > ${NULL}119if [ $? = 0 ]120then121VM_TYPE="client"122fi123124VM_BITS="32"125grep "64-Bit" vm_version.out > ${NULL}126if [ $? = 0 ]127then128VM_BITS="64"129fi130131VM_OS="unknown"132grep "aix" vm_version.out > ${NULL}133if [ $? = 0 ]134then135VM_OS="aix"136fi137grep "bsd" vm_version.out > ${NULL}138if [ $? = 0 ]139then140VM_OS="bsd"141fi142grep "linux" vm_version.out > ${NULL}143if [ $? = 0 ]144then145VM_OS="linux"146fi147grep "solaris" vm_version.out > ${NULL}148if [ $? = 0 ]149then150VM_OS="solaris"151fi152grep "windows" vm_version.out > ${NULL}153if [ $? = 0 ]154then155VM_OS="windows"156fi157158VM_CPU="unknown"159grep "sparc" vm_version.out > ${NULL}160if [ $? = 0 ]161then162VM_CPU="sparc"163if [ $VM_BITS = "64" ]164then165VM_CPU="sparcv9"166fi167fi168grep "x86" vm_version.out > ${NULL}169if [ $? = 0 ]170then171VM_CPU="i386"172fi173grep "amd64" vm_version.out > ${NULL}174if [ $? = 0 ]175then176VM_CPU="amd64"177fi178grep "arm" vm_version.out > ${NULL}179if [ $? = 0 ]180then181VM_CPU="arm"182fi183grep "ppc" vm_version.out > ${NULL}184if [ $? = 0 ]185then186VM_CPU="ppc"187if [ $VM_BITS = "64" ]188then189VM_CPU="ppc64"190grep "ppc64le" vm_version.out > ${NULL}191if [ $? = 0 ]192then193VM_CPU="ppc64le"194fi195fi196fi197grep "ia64" vm_version.out > ${NULL}198if [ $? = 0 ]199then200VM_CPU="ia64"201fi202grep "aarch64" vm_version.out > ${NULL}203if [ $? = 0 ]204then205VM_CPU="aarch64"206fi207export VM_TYPE VM_BITS VM_OS VM_CPU208echo "VM_TYPE=${VM_TYPE}"209echo "VM_BITS=${VM_BITS}"210echo "VM_OS=${VM_OS}"211echo "VM_CPU=${VM_CPU}"212213214