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/common/CommonSetup.sh
38839 views
1
#!/bin/sh
2
3
#
4
# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6
#
7
# This code is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License version 2 only, as
9
# published by the Free Software Foundation.
10
#
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
16
#
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
23
# questions.
24
#
25
26
27
# Common setup for tool tests and other tests that use jtools.
28
# Checks that TESTJAVA, TESTSRC, and TESTCLASSES environment variables are set.
29
#
30
# Creates the following constants for use by the caller:
31
# JAVA - java launcher
32
# JHAT - jhat utility
33
# JINFO - jinfo utility
34
# JMAP - jmap utility
35
# JPS - jps utility
36
# JSTACK - jstack utility
37
# JCMD - jcmd utility
38
# HSDB - hsdb utility (gui)
39
# CLHSDB - clhsdb utility (cli)
40
# OS - operating system name
41
# PATTERN_EOL - grep or sed end-of-line pattern
42
# PATTERN_WS - grep or sed whitespace pattern
43
# PS - path separator (";" or ":")
44
#
45
# Sets the following variables:
46
#
47
# isCygwin - true if environment is Cygwin
48
# isMKS - true if environment is MKS
49
# isLinux - true if OS is Linux
50
# isSolaris - true if OS is Solaris
51
# isWindows - true if OS is Windows
52
# isMacos - true if OS is Macos X
53
# isAIX - true if OS is AIX
54
55
56
if [ -z "${TESTJAVA}" ]; then
57
echo "ERROR: TESTJAVA not set. Test cannot execute. Failed."
58
exit 1
59
fi
60
61
if [ -z "${TESTSRC}" ]; then
62
echo "ERROR: TESTSRC not set. Test cannot execute. Failed."
63
exit 1
64
fi
65
66
if [ -z "${TESTCLASSES}" ]; then
67
echo "ERROR: TESTCLASSES not set. Test cannot execute. Failed."
68
exit 1
69
fi
70
71
# only enable these after checking the expected incoming env variables
72
set -eu
73
74
JAVA="${TESTJAVA}/bin/java"
75
JHAT="${TESTJAVA}/bin/jhat"
76
JINFO="${TESTJAVA}/bin/jinfo"
77
JMAP="${TESTJAVA}/bin/jmap"
78
JPS="${TESTJAVA}/bin/jps"
79
JSTACK="${TESTJAVA}/bin/jstack"
80
JCMD="${TESTJAVA}/bin/jcmd"
81
HSDB="${TESTJAVA}/bin/hsdb"
82
CLHSDB="${TESTJAVA}/bin/clhsdb"
83
84
isCygwin=false
85
isMKS=false
86
isLinux=false
87
isSolaris=false
88
isUnknownOS=false
89
isWindows=false
90
isMacos=false
91
isAIX=false
92
93
OS=`uname -s`
94
95
# start with some UNIX like defaults
96
PATTERN_EOL='$'
97
# blank and tab
98
PATTERN_WS='[ ]'
99
PS=":"
100
101
case "$OS" in
102
CYGWIN* )
103
OS="Windows"
104
PATTERN_EOL='[
105
]*$'
106
# blank and tab
107
PATTERN_WS='[ \t]'
108
isCygwin=true
109
isWindows=true
110
;;
111
Linux )
112
OS="Linux"
113
isLinux=true
114
;;
115
Darwin )
116
OS="Mac OS X"
117
isMacos=true
118
;;
119
SunOS )
120
OS="Solaris"
121
isSolaris=true
122
;;
123
AIX )
124
OS="AIX"
125
isAIX=true
126
;;
127
Windows* )
128
OS="Windows"
129
PATTERN_EOL='[
130
]*$'
131
PS=";"
132
isWindows=true
133
;;
134
* )
135
isUnknownOS=true
136
;;
137
esac
138
139