< prev index next >

test/java/rmi/registry/readTest/readTest.sh

Print this page
rev 1541 : 8003890: corelibs test scripts should pass TESTVMOPTS
Reviewed-by: chegar, alanb
Contributed-by: Mark Sheppard <mark.sheppard@oracle.com>
rev 1542 : 7132247: java/rmi/registry/readTest/readTest.sh failing with Cygwin
Reviewed-by: alanb, dmocek, smarks
Contributed-by: Eric Wang <yiming.wang@oracle.com>


   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 7102369 7094468 7100592
  26 # @library ../../testlibrary
  27 # @build TestLibrary
  28 # @summary remove java.rmi.server.codebase property parsing from registyimpl
  29 # @run shell readTest.sh
  30 
  31 OS=`uname -s`
  32 case "$OS" in
  33   SunOS | Linux | Darwin | AIX )
  34     PS=":"
  35     FS="/"
  36     FILEURL="file:"
  37     ;;
  38   Windows* | CYGWIN* )
  39     PS=";"
  40     FS="\\"
  41     FILEURL="file:/"
  42     ;;





  43   * )
  44     echo "Unrecognized system!"
  45     exit 1;
  46     ;;
  47 esac
  48 
  49 TEST_CLASSPATH=.:$TESTCLASSES
  50 cp -r ${TESTSRC}${FS}* .
  51 ${TESTJAVA}${FS}bin${FS}javac testPkg${FS}*java
  52 ${TESTJAVA}${FS}bin${FS}javac -cp $TEST_CLASSPATH readTest.java
  53 
  54 mkdir rmi_tmp
  55 RMIREG_OUT=rmi.out
  56 #start rmiregistry without any local classes on classpath
  57 cd rmi_tmp
  58 ${TESTJAVA}${FS}bin${FS}rmiregistry -J-Djava.rmi.server.useCodebaseOnly=false \
  59     ${TESTTOOLVMOPTS} 64005 > ..${FS}${RMIREG_OUT} 2>&1 &
  60 RMIREG_PID=$!
  61 # allow some time to start
  62 sleep 3
  63 cd ..
  64 








  65 # trailing / after code base is important for rmi codebase property.
  66 ${TESTJAVA}${FS}bin${FS}java -cp $TEST_CLASSPATH -Djava.rmi.server.codebase=${FILEURL}`pwd`/ readTest > OUT.TXT 2>&1 &
  67 TEST_PID=$!
  68 #bulk of testcase - let it run for a while
  69 sleep 5
  70 
  71 #we're done, kill processes first
  72 kill -9 ${RMIREG_PID} ${TEST_PID}
  73 sleep 3
  74 
  75 echo "Test output : "
  76 
  77 cat OUT.TXT
  78 echo "=============="
  79 echo "rmiregistry output  : "
  80 cat ${RMIREG_OUT}
  81 echo "=============="
  82 
  83 grep "Server ready" OUT.TXT
  84 result1=$?
  85 grep "Test passed" OUT.TXT
  86 result2=$?


   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 7102369 7094468 7100592
  26 # @library ../../testlibrary
  27 # @build TestLibrary
  28 # @summary remove java.rmi.server.codebase property parsing from RegistryImpl
  29 # @run shell readTest.sh
  30 
  31 OS=`uname -s`
  32 case "$OS" in
  33   SunOS | Linux | Darwin | AIX )
  34     PS=":"
  35     FS="/"
  36     FILEURL="file:"
  37     ;;
  38   Windows* )
  39     PS=";"
  40     FS="\\"
  41     FILEURL="file:/"
  42     ;;
  43   CYGWIN* )
  44     PS=";"
  45     FS="/"
  46     FILEURL="file:/"
  47     ;;
  48   * )
  49     echo "Unrecognized system!"
  50     exit 1;
  51     ;;
  52 esac
  53 
  54 TEST_CLASSPATH=.$PS$TESTCLASSES
  55 cp -r ${TESTSRC}${FS}* .
  56 ${TESTJAVA}${FS}bin${FS}javac testPkg${FS}*java
  57 ${TESTJAVA}${FS}bin${FS}javac -cp $TEST_CLASSPATH readTest.java
  58 
  59 mkdir rmi_tmp
  60 RMIREG_OUT=rmi.out
  61 #start rmiregistry without any local classes on classpath
  62 cd rmi_tmp
  63 ${TESTJAVA}${FS}bin${FS}rmiregistry -J-Djava.rmi.server.useCodebaseOnly=false \
  64     ${TESTTOOLVMOPTS} 64005 > ..${FS}${RMIREG_OUT} 2>&1 &
  65 RMIREG_PID=$!
  66 # allow some time to start
  67 sleep 3
  68 cd ..
  69 
  70 case "$OS" in
  71   CYGWIN* )
  72     CODEBASE=`cygpath -w $PWD`
  73     ;;
  74   * )
  75     CODEBASE=`pwd`
  76     ;;  
  77 esac
  78 # trailing / after code base is important for rmi codebase property.
  79 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp $TEST_CLASSPATH -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 &
  80 TEST_PID=$!
  81 #bulk of testcase - let it run for a while
  82 sleep 5
  83 
  84 #we're done, kill processes first
  85 kill -9 ${RMIREG_PID} ${TEST_PID}
  86 sleep 3
  87 
  88 echo "Test output : "
  89 
  90 cat OUT.TXT
  91 echo "=============="
  92 echo "rmiregistry output  : "
  93 cat ${RMIREG_OUT}
  94 echo "=============="
  95 
  96 grep "Server ready" OUT.TXT
  97 result1=$?
  98 grep "Test passed" OUT.TXT
  99 result2=$?
< prev index next >