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/rmi/rmic/manifestClassPath/Util.sh
38855 views
1
#
2
# Copyright (c) 2007, 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
# Utilities for shell tests
25
#
26
27
: ${TESTSRC=.} ${TESTCLASSES=.}
28
java="${TESTJAVA+${TESTJAVA}/bin/}java"
29
javac="${TESTJAVA+${TESTJAVA}/bin/}javac"
30
jar="${TESTJAVA+${TESTJAVA}/bin/}jar"
31
rmic="${TESTJAVA+${TESTJAVA}/bin/}rmic"
32
33
case `uname -s` in
34
Windows*|CYGWIN*)
35
WindowsOnly() { "$@"; }
36
UnixOnly() { :; }
37
PS=";" ;;
38
*)
39
UnixOnly() { "$@"; }
40
WindowsOnly() { :; }
41
PS=":";;
42
esac
43
44
failed=""
45
Fail() { echo "FAIL: $1"; failed="${failed}."; }
46
47
Die() { printf "%s\n" "$*"; exit 1; }
48
49
Sys() {
50
printf "%s\n" "$*"; "$@"; rc="$?";
51
test "$rc" -eq 0 || Die "Command \"$*\" failed with exitValue $rc";
52
}
53
54
CheckFiles() {
55
for f in "$@"; do test -r "$f" || Die "File $f not found"; done
56
}
57
58
Report() {
59
test "$#" != 2 && Die "Usage: Report success|failure rc"
60
61
if test "$1" = "success" -a "$2" = 0; then
62
echo "PASS: succeeded as expected"
63
elif test "$1" = "failure" -a "$2" != 0; then
64
echo "PASS: failed as expected"
65
elif test "$1" = "success" -a "$2" != 0; then
66
Fail "test failed unexpectedly"
67
elif test "$1" = "failure" -a "$2" = 0; then
68
Fail "test succeeded unexpectedly"
69
else
70
Die "Usage: Report success|failure rc"
71
fi
72
}
73
74
MkManifestWithClassPath() {
75
(echo "Manifest-Version: 1.0"; echo "Class-Path: $*") > MANIFEST.MF
76
}
77
78
HorizontalRule() {
79
echo "-----------------------------------------------------------------"
80
}
81
82
Test() {
83
HorizontalRule
84
expectedResult="$1"; shift
85
printf "%s\n" "$*"
86
"$@"
87
Report "$expectedResult" "$?"
88
}
89
90
Failure() { Test failure "$@"; }
91
Success() { Test success "$@"; }
92
93
Bottom() {
94
test "$#" = 1 -a "$1" = "Line" || Die "Usage: Bottom Line"
95
96
if test -n "$failed"; then
97
count=`printf "%s" "$failed" | wc -c | tr -d ' '`
98
echo "FAIL: $count tests failed"
99
exit 1
100
else
101
echo "PASS: all tests gave expected results"
102
exit 0
103
fi
104
}
105
106
BadJarFile() {
107
for jarfilename in "$@"; do pwd > "$jarfilename"; done
108
}
109
110
#----------------------------------------------------------------
111
# Usage: BCP=`DefaultBootClassPath`
112
# Returns default bootclasspath, discarding non-existent entries
113
#----------------------------------------------------------------
114
DefaultBootClassPath() {
115
echo 'public class B {public static void main(String[] a) {
116
System.out.println(System.getProperty("sun.boot.class.path"));}}' > B.java
117
"$javac" B.java
118
_BCP_=""
119
for elt in `"$java" B | tr "${PS}" " "`; do
120
test -r "$elt" -a -n "$elt" && _BCP_="${_BCP_:+${_BCP_}${PS}}${elt}"
121
done
122
rm -f B.java B.class
123
printf "%s" "$_BCP_" # Don't use echo -- unsafe on Windows
124
}
125
126
#----------------------------------------------------------------
127
# Foil message localization
128
#----------------------------------------------------------------
129
DiagnosticsInEnglishPlease() {
130
LANG="C" LC_ALL="C" LC_MESSAGES="C"; export LANG LC_ALL LC_MESSAGES
131
}
132
133