Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/tools/jconsole/common.sh
38838 views
#1# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3#4# This code is free software; you can redistribute it and/or modify it5# under the terms of the GNU General Public License version 2 only, as6# published by the Free Software Foundation.7#8# This code is distributed in the hope that it will be useful, but WITHOUT9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11# version 2 for more details (a copy is included in the LICENSE file that12# accompanied this code).13#14# You should have received a copy of the GNU General Public License version15# 2 along with this work; if not, write to the Free Software Foundation,16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17#18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19# or visit www.oracle.com if you need additional information or have any20# questions.21#2223# Beginning of subroutines:24status=12526#Call this from anywhere to fail the test with an error message27# usage: fail "reason why the test failed"28fail()29{ echo "The test failed :-("30echo "$*" 1>&231echo "exit status was $status"32exit $status33} #end of fail()3435#Call this from anywhere to pass the test with a message36# usage: pass "reason why the test passed if applicable"37pass()38{ echo "The test passed!!!"39echo "$*" 1>&240exit 041} #end of pass()4243# end of subroutines4445# The beginning of the script proper4647OS=`uname -s`48case "$OS" in49SunOS | Linux | Darwin | AIX)50PATHSEP=":"51;;5253Windows* | CYGWIN*)54PATHSEP=";"55;;5657# catch all other OSs58* )59echo "Unrecognized system! $OS"60fail "Unrecognized system! $OS"61;;62esac6364TARGETCLASS=$165if [ -z "${TESTJAVA}" ] ; then66# TESTJAVA is not set, so the test is running stand-alone.67# TESTJAVA holds the path to the root directory of the build of the JDK68# to be tested. That is, any java files run explicitly in this shell69# should use TESTJAVA in the path to the java interpreter.70# So, we'll set this to the JDK spec'd on the command line. If none71# is given on the command line, tell the user that and use a default.72# THIS IS THE JDK BEING TESTED.73if [ -n "$1" ] ; then74TESTJAVA=$175else76TESTJAVA=$JAVA_HOME77fi78TESTSRC=.79TESTCLASSES=.80#Deal with .class files:81fi82#83echo "JDK under test is: $TESTJAVA"84#85CP="-classpath ${TESTCLASSES}${PATHSEP}${TESTJAVA}/lib/jconsole.jar"86# Compile the test class using the classpath we need:87#88env89#90set -vx91#92#Compile. jconsole.jar is required on the classpath.93${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \94"${TESTSRC}"/"${TARGETCLASS}".java95#96#Run the test class, again with the classpath we need:97${TESTJAVA}/bin/java ${CP} ${TARGETCLASS}98status=$?99echo "test status was: $status"100if [ $status -eq "0" ];101then pass ""102103else fail "unspecified test failure"104fi105106107