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