Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh
38890 views
1
#
2
# Copyright (c) 1998, 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 4087295 4785472
26
# @summary Enable resolveClass() to accommodate package renaming.
27
# This fix enables one to implement a resolveClass method that maps a
28
# Serialiazable class within a serialization stream to the same class
29
# in a different package within the JVM runtime. See run shell script
30
# for instructions on how to run this test.
31
32
33
if [ "${TESTJAVA}" = "" ]
34
then
35
echo "TESTJAVA not set. Test cannot execute. Failed."
36
exit 1
37
fi
38
39
if [ "${COMPILEJAVA}" = "" ] ; then
40
COMPILEJAVA="${TESTJAVA}"
41
fi
42
43
44
OS=`uname -s`
45
# Need to determine the classpath separator and filepath separator based on the
46
# operating system.
47
case "$OS" in
48
SunOS | Linux | Darwin | AIX )
49
PS=":" ;;
50
Windows* | CYGWIN* )
51
PS=";" ;;
52
* )
53
echo "Unrecognized system!"
54
exit 1 ;;
55
esac
56
57
JAVA=${TESTJAVA}/bin/java
58
JAVAC=${COMPILEJAVA}/bin/javac
59
MKDIR=mkdir
60
RDEL="rm -r"
61
62
if [ -d ${TESTCLASSES}/oclasses ]
63
then
64
${RDEL} ${TESTCLASSES}/oclasses
65
fi
66
if [ -d ${TESTCLASSES}/nclasses ]
67
then
68
${RDEL} ${TESTCLASSES}/nclasses
69
fi
70
if [ -d ${TESTCLASSES}/share ]
71
then
72
${RDEL} ${TESTCLASSES}/share
73
fi
74
if [ -f ${TESTCLASSES}/stream.ser ]
75
then
76
${RDEL} ${TESTCLASSES}/stream.ser
77
fi
78
79
mkdir ${TESTCLASSES}/oclasses
80
mkdir ${TESTCLASSES}/share
81
mkdir ${TESTCLASSES}/nclasses
82
83
# Build sources
84
set -e
85
${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}/share \
86
${TESTSRC}/extension/ExtendedObjectInputStream.java
87
CLASSPATH=${TESTCLASSES}/share; export CLASSPATH;
88
${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}/oclasses \
89
${TESTSRC}/test/SerialDriver.java
90
CLASSPATH=${TESTCLASSES}/share; export CLASSPATH;
91
${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}/nclasses \
92
${TESTSRC}/install/SerialDriver.java
93
94
# Run Case 1. Map test.SerialDriver within stream to install.SerialDriver.
95
CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;
96
${JAVA} ${TESTVMOPTS} test.SerialDriver -s
97
CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;
98
${JAVA} ${TESTVMOPTS} install.SerialDriver -d
99
rm stream.ser
100
101
# Run Case 2. Map install.SerialDriver within stream to test.SerialDriver.
102
CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;
103
${JAVA} ${TESTVMOPTS} install.SerialDriver -s
104
CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;
105
${JAVA} ${TESTVMOPTS} test.SerialDriver -d
106
107