Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatTest.sh
38855 views
1
#!/bin/ksh -p
2
#
3
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
#
6
# This code is free software; you can redistribute it and/or modify it
7
# under the terms of the GNU General Public License version 2 only, as
8
# published by the Free Software Foundation.
9
#
10
# This code is distributed in the hope that it will be useful, but WITHOUT
11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
# version 2 for more details (a copy is included in the LICENSE file that
14
# accompanied this code).
15
#
16
# You should have received a copy of the GNU General Public License version
17
# 2 along with this work; if not, write to the Free Software Foundation,
18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
# or visit www.oracle.com if you need additional information or have any
22
# questions.
23
#
24
25
#
26
# @test
27
# @bug 4929170 7078379
28
# @summary Tests that user-supplied IIOMetadata implementations
29
# loaded by separate classloader is able to load correspnding
30
# IIOMetadataFormat implementations.
31
# @author Andrew Brygin
32
#
33
# @compile UserPluginMetadataFormatTest.java MetadataFormatTest.java MetadataTest.java
34
# @run shell/timeout=60 runMetadataFormatTest.sh
35
36
# Note!!!! JavaCodeForYourTest_CHANGE_THIS.java must be changed or deleted.
37
# If there is any java code which will be executed during the test, it must
38
# be compiled by the line above. If multiple .java files, separate the
39
# files by spaces on that line. See testing page of AWT home page for
40
# pointers to the testharness spec. and FAQ.
41
# Note!!!! Change AppletDeadlock.sh to the name of your test!!!!
42
43
# There are several resources which need to be present before many
44
# shell scripts can run. Following are examples of how to check for
45
# many common ones.
46
#
47
# Note that the shell used is the Korn Shell, KSH
48
#
49
# Also note, it is recommended that make files NOT be used. Rather,
50
# put the individual commands directly into this file. That way,
51
# it is possible to use command line arguments and other shell tech-
52
# niques to find the compiler, etc on different systems. For example,
53
# a different path could be used depending on whether this were a
54
# Solaris or Win32 machine, which is more difficult (if even possible)
55
# in a make file.
56
57
58
# Beginning of subroutines:
59
status=1
60
61
#Call this from anywhere to fail the test with an error message
62
# usage: fail "reason why the test failed"
63
fail()
64
{ echo "The test failed :-("
65
echo "$*" 1>&2
66
exit 1
67
} #end of fail()
68
69
#Call this from anywhere to pass the test with a message
70
# usage: pass "reason why the test passed if applicable"
71
pass()
72
{ echo "The test passed!!!"
73
echo "$*" 1>&2
74
exit 0
75
} #end of pass()
76
77
# end of subroutines
78
79
80
# The beginning of the script proper
81
82
# Checking for proper OS
83
OS=`uname -s`
84
case "$OS" in
85
SunOS )
86
VAR="One value for Sun"
87
DEFAULT_JDK=/none
88
#DEFAULT_JDK=/usr/local/java/jdk1.2/solaris
89
FILESEP="/"
90
;;
91
92
Linux | Darwin | AIX )
93
VAR="A different value for Linux"
94
DEFAULT_JDK=/none
95
#DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386
96
FILESEP="/"
97
;;
98
99
Windows_95 | Windows_98 | Windows_NT | Windows_ME )
100
VAR="A different value for Win32"
101
DEFAULT_JDK=/none
102
#DEFAULT_JDK=/usr/local/java/jdk1.2/win32
103
FILESEP="\\"
104
;;
105
106
CYGWIN* )
107
VAR="A different value for CYGWIN"
108
DEFAULT_JDK=/none
109
FILESEP="/"
110
;;
111
112
# catch all other OSs
113
* )
114
echo "Unrecognized system! $OS"
115
fail "Unrecognized system! $OS"
116
;;
117
esac
118
119
# check that some executable or other file you need is available, abort if not
120
# note that the name of the executable is in the fail string as well.
121
# this is how to check for presence of the compiler, etc.
122
#RESOURCE=`whence SomeProgramOrFileNeeded`
123
#if [ "${RESOURCE}" = "" ] ;
124
# then fail "Need SomeProgramOrFileNeeded to perform the test" ;
125
#fi
126
127
# IT'S FINE TO DELETE THIS IF NOT NEEDED!
128
# check if an environment variable you need is set, give it a default if not
129
#if [ -z "${NEEDED_VAR}" ] ; then
130
# # The var is NOT set, so give it a default
131
# NEEDED_VAR=/some/default/value/such/as/a/path
132
#fi
133
134
# IT'S FINE TO DELETE THIS IF NOT NEEDED!
135
#if [ -z "${NEEDED_LATER_VAR}" ] ; then
136
# # The var is NOT set, so give it a default
137
# # will need it in other scripts called from this one, so export it
138
# NEEDED_LATER_VAR="/a/different/path/note/the/quotes"
139
# export NEEDED_LATER_VAR
140
#fi
141
142
# Want this test to run standalone as well as in the harness, so do the
143
# following to copy the test's directory into the harness's scratch directory
144
# and set all appropriate variables:
145
146
if [ -z "${TESTJAVA}" ] ; then
147
# TESTJAVA is not set, so the test is running stand-alone.
148
# TESTJAVA holds the path to the root directory of the build of the JDK
149
# to be tested. That is, any java files run explicitly in this shell
150
# should use TESTJAVA in the path to the java interpreter.
151
# So, we'll set this to the JDK spec'd on the command line. If none
152
# is given on the command line, tell the user that and use a cheesy
153
# default.
154
# THIS IS THE JDK BEING TESTED.
155
if [ -n "$1" ] ;
156
then TESTJAVA=$1
157
else echo "no JDK specified on command line so using default!"
158
TESTJAVA=$DEFAULT_JDK
159
fi
160
TESTSRC=.
161
TESTCLASSES=.
162
STANDALONE=1;
163
fi
164
echo "JDK under test is: $TESTJAVA"
165
166
#Deal with .class files:
167
if [ -n "${STANDALONE}" ] ;
168
then
169
#if standalone, remind user to cd to dir. containing test before running it
170
echo "Just a reminder: cd to the dir containing this test when running it"
171
# then compile all .java files (if there are any) into .class files
172
if [ -a *.java ] ;
173
then echo "Reminder, this test should be in its own directory with all"
174
echo "supporting files it needs in the directory with it."
175
${TESTJAVA}/bin/javac ./*.java ;
176
fi
177
# else in harness so copy all the class files from where jtreg put them
178
# over to the scratch directory this test is running in.
179
else cp ${TESTCLASSES}/*.class . ;
180
fi
181
182
#if in test harness, then copy the entire directory that the test is in over
183
# to the scratch directory. This catches any support files needed by the test.
184
185
#if [ -z "${STANDALONE}" ] ;
186
# then cp ${TESTSRC}/* .
187
#fi
188
189
#Just before executing anything, make sure it has executable permission!
190
chmod 777 ./*
191
192
############### YOUR TEST CODE HERE!!!!!!! #############
193
194
#All files required for the test should be in the same directory with
195
# this file. If converting a standalone test to run with the harness,
196
# as long as all files are in the same directory and it returns 0 for
197
# pass, you should be able to cut and paste it into here and it will
198
# run with the test harness.
199
200
# This is an example of running something -- test
201
# The stuff below catches the exit status of test then passes or fails
202
# this shell test as appropriate ( 0 status is considered a pass here )
203
#./test # DELETE THIS LINE AND REPLACE WITH YOUR OWN COMMAND!!!
204
205
if [ -d ./test_classes ] ; then
206
rm -rf ./test_calsses
207
fi
208
209
mkdir ./test_classes
210
211
# split application classes and test plugin classes
212
mv ./UserPluginMetadataFormatTest*.class ./test_classes
213
214
$TESTJAVA/bin/java MetadataFormatTest test_classes UserPluginMetadataFormatTest
215
216
############### END YOUR TEST CODE !!!!! ############
217
status=$?
218
219
# pass or fail the test based on status of the command
220
if [ $status -eq "0" ];
221
then pass "Test passed - no stack trace printing"
222
223
else fail "Test failure - stack trace was printed"
224
fi
225
226
#For additional examples of how to write platform independent KSH scripts,
227
# see the jtreg file itself. It is a KSH script for both Solaris and Win32
228
229
230