Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh
38890 views
#1# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3#4# This code is free software; you can redistribute it and/or modify it5# under the terms of the GNU General Public License version 2 only, as6# published by the Free Software Foundation.7#8# This code is distributed in the hope that it will be useful, but WITHOUT9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11# version 2 for more details (a copy is included in the LICENSE file that12# accompanied this code).13#14# You should have received a copy of the GNU General Public License version15# 2 along with this work; if not, write to the Free Software Foundation,16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17#18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19# or visit www.oracle.com if you need additional information or have any20# questions.21#2223# @test24# @bug 4087295 478547225# @summary Enable resolveClass() to accommodate package renaming.26# This fix enables one to implement a resolveClass method that maps a27# Serialiazable class within a serialization stream to the same class28# in a different package within the JVM runtime. See run shell script29# for instructions on how to run this test.303132if [ "${TESTJAVA}" = "" ]33then34echo "TESTJAVA not set. Test cannot execute. Failed."35exit 136fi3738if [ "${COMPILEJAVA}" = "" ] ; then39COMPILEJAVA="${TESTJAVA}"40fi414243OS=`uname -s`44# Need to determine the classpath separator and filepath separator based on the45# operating system.46case "$OS" in47SunOS | Linux | Darwin | AIX )48PS=":" ;;49Windows* | CYGWIN* )50PS=";" ;;51* )52echo "Unrecognized system!"53exit 1 ;;54esac5556JAVA=${TESTJAVA}/bin/java57JAVAC=${COMPILEJAVA}/bin/javac58MKDIR=mkdir59RDEL="rm -r"6061if [ -d ${TESTCLASSES}/oclasses ]62then63${RDEL} ${TESTCLASSES}/oclasses64fi65if [ -d ${TESTCLASSES}/nclasses ]66then67${RDEL} ${TESTCLASSES}/nclasses68fi69if [ -d ${TESTCLASSES}/share ]70then71${RDEL} ${TESTCLASSES}/share72fi73if [ -f ${TESTCLASSES}/stream.ser ]74then75${RDEL} ${TESTCLASSES}/stream.ser76fi7778mkdir ${TESTCLASSES}/oclasses79mkdir ${TESTCLASSES}/share80mkdir ${TESTCLASSES}/nclasses8182# Build sources83set -e84${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}/share \85${TESTSRC}/extension/ExtendedObjectInputStream.java86CLASSPATH=${TESTCLASSES}/share; export CLASSPATH;87${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}/oclasses \88${TESTSRC}/test/SerialDriver.java89CLASSPATH=${TESTCLASSES}/share; export CLASSPATH;90${JAVAC} ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}/nclasses \91${TESTSRC}/install/SerialDriver.java9293# Run Case 1. Map test.SerialDriver within stream to install.SerialDriver.94CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;95${JAVA} ${TESTVMOPTS} test.SerialDriver -s96CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;97${JAVA} ${TESTVMOPTS} install.SerialDriver -d98rm stream.ser99100# Run Case 2. Map install.SerialDriver within stream to test.SerialDriver.101CLASSPATH="${TESTCLASSES}/nclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;102${JAVA} ${TESTVMOPTS} install.SerialDriver -s103CLASSPATH="${TESTCLASSES}/oclasses${PS}${TESTCLASSES}/share"; export CLASSPATH;104${JAVA} ${TESTVMOPTS} test.SerialDriver -d105106107