jdk/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh
author mfang
Wed, 17 Aug 2011 14:18:26 -0700
changeset 10294 8fcdae2a7ec7
parent 5506 202f599c92aa
child 14307 2378cc5c46cc
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
434
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
     1
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 434
diff changeset
     2
# Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
434
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
     4
#
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 434
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
434
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 434
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
434
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    10
#
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    15
# accompanied this code).
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    16
#
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    20
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 434
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 434
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 434
diff changeset
    23
# questions.
434
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    24
#
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    25
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    26
#!/bin/ksh -p
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    27
#
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    28
#   @test    IOExceptionIfEncodedURLTest.sh
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    29
#   @bug     6193279 6619458
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    30
#   @summary REGRESSION: AppletViewer throws IOException when path is encoded URL
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    31
#   @author  Dmitry Cherepanov: area=appletviewer
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    32
#   @run compile IOExceptionIfEncodedURLTest.java
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    33
#   @run main IOExceptionIfEncodedURLTest
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    34
#   @run shell IOExceptionIfEncodedURLTest.sh
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    35
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    36
# Beginning of subroutines:
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    37
status=1
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    38
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    39
#Call this from anywhere to fail the test with an error message
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    40
# usage: fail "reason why the test failed"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    41
fail() 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    42
 { echo "The test failed :-("
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    43
   echo "$*" 1>&2
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    44
   echo "exit status was $status"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    45
   exit $status
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    46
 } #end of fail()
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    47
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    48
#Call this from anywhere to pass the test with a message
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    49
# usage: pass "reason why the test passed if applicable"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    50
pass() 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    51
 { echo "The test passed!!!"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    52
   echo "$*" 1>&2
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    53
   exit 0
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    54
 } #end of pass()
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    55
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    56
#Call this to run the test with a file name
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    57
test()
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    58
 {
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    59
   ${TESTJAVA}${FILESEP}bin${FILESEP}appletviewer -Xnosecurity ${URL} > err 2>&1 &
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    60
   APPLET_ID=$!
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    61
   sleep 15
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    62
   kill -9 $APPLET_ID
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    63
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    64
   # these exceptions will be thrown if the test fails
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    65
   cat err | grep "I/O exception while reading"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    66
   exception=$?
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    67
   if [ $exception = "0" ];
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    68
       then fail "test failed for "${URL}", see err file and CRs #6193279,6329251,6376334"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    69
   fi
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    70
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    71
   cat err | grep "java.lang.ClassNotFoundException"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    72
   exception=$?
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    73
   if [ $exception = "0" ];
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    74
       then fail "test failed for "${URL}", see err file and CRs #6193279,6329251,6376334"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    75
   fi
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    76
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    77
   # the applet will log the same message
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    78
   cat err | grep "the appletviewer started"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    79
   started=$?
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    80
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    81
   echo $started | grep "2"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    82
   if [ $? = 0 ] ;
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    83
       then fail "test failed for "${URL}": syntax errors or inaccessible files"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    84
   fi
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    85
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    86
   if [ $started = "0" ];
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    87
       then echo "the test passed for "${URL}
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    88
       else fail "test failed for "${URL}": the appletviewer behaviour is unexpected: "$started", see err file"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    89
   fi
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    90
 }
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    91
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    92
# end of subroutines
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    93
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    94
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    95
# The beginning of the script proper
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    96
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    97
# Checking for proper OS
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    98
OS=`uname -s`
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
    99
case "$OS" in
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   100
   SunOS )
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   101
      VAR="One value for Sun"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   102
      DEFAULT_JDK=/usr/local/java/jdk1.2.1/solaris
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   103
      FILESEP="/"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   104
      ;;
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   105
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   106
   Linux )
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   107
      VAR="A different value for Linux"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   108
      DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   109
      FILESEP="/"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   110
      ;;
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   111
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   112
   Windows_95 | Windows_98 | Windows_NT | Windows_ME | CYGWIN_NT-5.1)
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   113
      VAR="A different value for Win32"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   114
      DEFAULT_JDK=/usr/local/java/jdk1.2.1/win32
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   115
      FILESEP="\\"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   116
      ;;
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   117
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   118
   # catch all other OSs
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   119
   * )
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   120
      echo "Unrecognized system!  $OS"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   121
      fail "Unrecognized system!  $OS"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   122
      ;;
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   123
esac
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   124
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   125
# 6438730: Only a minimal set of env variables are set for shell tests.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   126
# To guarantee that env variable holds correct value we need to set it ourselves.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   127
if [ -z "${PWD}" ] ; then
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   128
    PWD=`pwd`
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   129
fi
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   130
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   131
# check that some executable or other file you need is available, abort if not
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   132
#  note that the name of the executable is in the fail string as well.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   133
# this is how to check for presence of the compiler, etc.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   134
#RESOURCE=`whence SomeProgramOrFileNeeded`
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   135
#if [ "${RESOURCE}" = "" ] ; 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   136
#   then fail "Need SomeProgramOrFileNeeded to perform the test" ; 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   137
#fi
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   138
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   139
# Want this test to run standalone as well as in the harness, so do the 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   140
#  following to copy the test's directory into the harness's scratch directory 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   141
#  and set all appropriate variables:
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   142
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   143
if [ -z "${TESTJAVA}" ] ; then
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   144
   # TESTJAVA is not set, so the test is running stand-alone.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   145
   # TESTJAVA holds the path to the root directory of the build of the JDK
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   146
   # to be tested.  That is, any java files run explicitly in this shell
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   147
   # should use TESTJAVA in the path to the java interpreter.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   148
   # So, we'll set this to the JDK spec'd on the command line.  If none
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   149
   # is given on the command line, tell the user that and use a cheesy
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   150
   # default.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   151
   # THIS IS THE JDK BEING TESTED.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   152
   if [ -n "$1" ] ;
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   153
      then TESTJAVA=$1
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   154
      else echo "no JDK specified on command line so using default!"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   155
	 TESTJAVA=$DEFAULT_JDK
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   156
   fi
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   157
   TESTSRC=.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   158
   TESTCLASSES=.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   159
   STANDALONE=1;
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   160
fi
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   161
echo "JDK under test is: $TESTJAVA"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   162
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   163
#Deal with .class files:
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   164
if [ -n "${STANDALONE}" ] ; 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   165
   then 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   166
   #if standalone, remind user to cd to dir. containing test before running it
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   167
   echo "Just a reminder: cd to the dir containing this test when running it"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   168
   # then compile all .java files (if there are any) into .class files
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   169
   if [ -a *.java ] ; 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   170
      then echo "Reminder, this test should be in its own directory with all"
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   171
      echo "supporting files it needs in the directory with it."
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   172
      ${TESTJAVA}/bin/javac ./*.java ; 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   173
   fi
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   174
   # else in harness so copy all the class files from where jtreg put them
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   175
   # over to the scratch directory this test is running in. 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   176
   else cp ${TESTCLASSES}/*.class . ;
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   177
fi
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   178
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   179
#if in test harness, then copy the entire directory that the test is in over 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   180
# to the scratch directory.  This catches any support files needed by the test.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   181
#if [ -z "${STANDALONE}" ] ; 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   182
#   then cp ${TESTSRC}/* . 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   183
#fi
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   184
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   185
#Just before executing anything, make sure it has executable permission!
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   186
chmod 777 ./*
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   187
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   188
###############  YOUR TEST CODE HERE!!!!!!!  #############
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   189
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   190
#All files required for the test should be in the same directory with
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   191
# this file.  If converting a standalone test to run with the harness,
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   192
# as long as all files are in the same directory and it returns 0 for
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   193
# pass, you should be able to cut and paste it into here and it will
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   194
# run with the test harness.
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   195
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   196
# This is an example of running something -- test
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   197
# The stuff below catches the exit status of test then passes or fails
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   198
# this shell test as appropriate ( 0 status is considered a pass here )
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   199
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   200
# The test verifies that appletviewer correctly works with the different
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   201
# names of the files, including relative and absolute paths 
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   202
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   203
# 6619458: exclude left brace from the name of the files managed by the VCS
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   204
NAME='test.html'
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   205
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   206
ENCODED='te%7Bst.html'
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   207
UNENCODED='te{st.html'
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   208
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   209
# Copy needed files into the harness's scratch directory
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   210
# or create a copy with the required name if the test is
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   211
# running as stand-alone
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   212
cp ${TESTSRC}${FILESEP}${NAME} ${UNENCODED}
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   213
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   214
# the encoded name, the path is absolute
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   215
URL="file:"${PWD}${FILESEP}${ENCODED}
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   216
test
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   217
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   218
# the encoded name, the path is relative
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   219
URL="file:"${ENCODED}
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   220
test
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   221
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   222
# the unencoded name, the path is absolute
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   223
URL="file:"${PWD}${FILESEP}${UNENCODED}
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   224
test
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   225
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   226
# the unencoded name, the path is relative
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   227
URL="file:"${UNENCODED}
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   228
test
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   229
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   230
# pick up our toys from the scratch directory
acc4487b3f1b 6619458: testcase depends on a file with the name te{st.html
dcherepanov
parents:
diff changeset
   231
rm ${UNENCODED}