Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/rmi/registry/readTest/readTest.sh
38828 views
#1# Copyright (c) 2011, 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 7102369 7094468 710059225# @library ../../testlibrary26# @build TestLibrary27# @summary remove java.rmi.server.codebase property parsing from registyimpl28# @run shell readTest.sh2930OS=`uname -s`31VER=`uname -r`32ARGS=""33REGARGS=""3435case "$OS" in36SunOS | Linux | Darwin | AIX )37PS=":"38FS="/"39CHMOD="${FS}bin${FS}chmod"40FILEURL="file:"41;;42Windows* )43PS=";"44FS="\\"45CHMOD="chmod"46FILEURL="file:/"47if [ "$VER" -eq "5" ]; then48ARGS="-Djdk.net.ephemeralPortRange.low=1024 -Djdk.net.ephemeralPortRange.high=65000"49REGARGS="-J-Djdk.net.ephemeralPortRange.low=1024 -J-Djdk.net.ephemeralPortRange.high=65000"50fi51;;52CYGWIN* )53PS=";"54FS="/"55CHMOD="chmod"56FILEURL="file:/"57if [ "$VER" -eq "5" ]; then58ARGS="-Djdk.net.ephemeralPortRange.low=1024 -Djdk.net.ephemeralPortRange.high=65000"59REGARGS="-J-Djdk.net.ephemeralPortRange.low=1024 -J-Djdk.net.ephemeralPortRange.high=65000"60fi61;;62* )63echo "Unrecognized system!"64exit 1;65;;66esac6768TEST_CLASSPATH=.$PS${TESTCLASSPATH:-$TESTCLASSES}69cp -r ${TESTSRC}${FS}* .70${CHMOD} -R u+w *71${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} testPkg${FS}*java72${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -cp $TEST_CLASSPATH readTest.java7374mkdir rmi_tmp75RMIREG_OUT=rmi.out76#start rmiregistry without any local classes on classpath77cd rmi_tmp78# NOTE: This RMI Registry port must match TestLibrary.READTEST_REGISTRY_PORT79${TESTJAVA}${FS}bin${FS}rmiregistry ${REGARGS} -J-Djava.rmi.server.useCodebaseOnly=false \80${TESTTOOLVMOPTS} 60005 > ..${FS}${RMIREG_OUT} 2>&1 &81RMIREG_PID=$!82# allow some time to start83sleep 384cd ..8586case "$OS" in87CYGWIN* )88CODEBASE=`cygpath -w $PWD`89;;90* )91CODEBASE=`pwd`92;;93esac94# trailing / after code base is important for rmi codebase property.95${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp $TEST_CLASSPATH ${ARGS} -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 &96TEST_PID=$!97#bulk of testcase - let it run for a while98sleep 599100#we're done, kill processes first101kill -9 ${RMIREG_PID} ${TEST_PID}102sleep 3103104echo "Test output : "105106cat OUT.TXT107echo "=============="108echo "rmiregistry output : "109cat ${RMIREG_OUT}110echo "=============="111112grep "Server ready" OUT.TXT113result1=$?114grep "Test passed" OUT.TXT115result2=$?116117if [ $result1 -eq 0 -a $result2 -eq 0 ]118then119echo "Passed"120exitCode=0;121else122echo "Failed"123exitCode=1124fi125rm -rf OUT.TXT ${RMIREG_OUT} rmi_tmp126exit ${exitCode}127128129130131