1 # 2 # Copyright (c) 2004, 2013, 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 # @test 25 # @bug 5023573 5062569 26 # @summary jtreg test ResourceCheckTest.java must be 27 # able to find jconsole.jar 28 # 29 # @run shell ResourceCheckTest.sh 30 31 # Beginning of subroutines: 32 status=1 33 34 #Call this from anywhere to fail the test with an error message 35 # usage: fail "reason why the test failed" 36 fail() 37 { echo "The test failed :-(" 38 echo "$*" 1>&2 39 echo "exit status was $status" 40 exit $status 41 } #end of fail() 42 43 #Call this from anywhere to pass the test with a message 44 # usage: pass "reason why the test passed if applicable" 45 pass() 46 { echo "The test passed!!!" 47 echo "$*" 1>&2 48 exit 0 49 } #end of pass() 50 51 # end of subroutines 52 53 # The beginning of the script proper 54 55 OS=`uname -s` 56 case "$OS" in 57 SunOS | Linux | Darwin | AIX) 58 PATHSEP=":" 59 ;; 60 61 Windows* | CYGWIN*) 62 PATHSEP=";" 63 ;; 64 65 # catch all other OSs 66 * ) 67 echo "Unrecognized system! $OS" 68 fail "Unrecognized system! $OS" 69 ;; 70 esac 71 72 TARGETCLASS="ResourceCheckTest" 73 if [ -z "${TESTJAVA}" ] ; then 74 # TESTJAVA is not set, so the test is running stand-alone. 75 # TESTJAVA holds the path to the root directory of the build of the JDK 76 # to be tested. That is, any java files run explicitly in this shell 77 # should use TESTJAVA in the path to the java interpreter. 78 # So, we'll set this to the JDK spec'd on the command line. If none 79 # is given on the command line, tell the user that and use a default. 80 # THIS IS THE JDK BEING TESTED. 81 if [ -n "$1" ] ; then 82 TESTJAVA=$1 83 else 84 TESTJAVA=$JAVA_HOME 85 fi 86 TESTSRC=. 87 TESTCLASSES=. 88 #Deal with .class files: 89 fi 90 # 91 echo "JDK under test is: $TESTJAVA" 92 # 93 CP="-classpath ${TESTCLASSES}${PATHSEP}${TESTJAVA}/lib/jconsole.jar" 94 # Compile the test class using the classpath we need: 95 # 96 env 97 # 98 set -vx 99 # 100 #Compile. jconsole.jar is required on the classpath. 101 ${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \ 102 "${TESTSRC}"/"${TARGETCLASS}".java 103 # 104 #Run the test class, again with the classpath we need: 105 ${TESTJAVA}/bin/java ${CP} ${TARGETCLASS} 106 status=$? 107 echo "test status was: $status" 108 if [ $status -eq "0" ]; 109 then pass "" 110 111 else fail "unspecified test failure" 112 fi