langtools/test/tools/javac/ExtDirs/ExtDirs.sh
changeset 16343 25aa1128728a
parent 15896 e41d716405b2
parent 16342 28d6ae9ed67c
child 16344 db9ac0924815
equal deleted inserted replaced
15896:e41d716405b2 16343:25aa1128728a
     1 #!/bin/sh
       
     2 
       
     3 #
       
     4 # Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
       
     5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     6 #
       
     7 # This code is free software; you can redistribute it and/or modify it
       
     8 # under the terms of the GNU General Public License version 2 only, as
       
     9 # published by the Free Software Foundation.
       
    10 #
       
    11 # This code is distributed in the hope that it will be useful, but WITHOUT
       
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14 # version 2 for more details (a copy is included in the LICENSE file that
       
    15 # accompanied this code).
       
    16 #
       
    17 # You should have received a copy of the GNU General Public License version
       
    18 # 2 along with this work; if not, write to the Free Software Foundation,
       
    19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20 #
       
    21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22 # or visit www.oracle.com if you need additional information or have any
       
    23 # questions.
       
    24 #
       
    25 
       
    26 
       
    27 # @test
       
    28 # @bug 4204897 4256097 4785453 4863609
       
    29 # @summary Test that '.jar' files in -extdirs are found.
       
    30 # @author maddox
       
    31 #
       
    32 # @run shell/timeout=180 ExtDirs.sh
       
    33 
       
    34 if [ "${TESTSRC}" = "" ]
       
    35 then
       
    36   echo "TESTSRC not set.  Test cannot execute.  Failed."
       
    37   exit 1
       
    38 fi
       
    39 echo "TESTSRC=${TESTSRC}"
       
    40 if [ "${TESTJAVA}" = "" ]
       
    41 then
       
    42   echo "TESTJAVA not set.  Test cannot execute.  Failed."
       
    43   exit 1
       
    44 fi
       
    45 echo "TESTJAVA=${TESTJAVA}"
       
    46 if [ "${TESTCLASSES}" = "" ]
       
    47 then
       
    48   echo "TESTCLASSES not set.  Test cannot execute.  Failed."
       
    49   exit 1
       
    50 fi
       
    51 echo "TESTCLASSES=${TESTCLASSES}"
       
    52 echo "CLASSPATH=${CLASSPATH}"
       
    53 
       
    54 # set platform-dependent variables
       
    55 OS=`uname -s`
       
    56 case "$OS" in
       
    57   SunOS | Linux | Darwin )
       
    58     PS=":"
       
    59     FS="/"
       
    60     ;;
       
    61   CYGWIN* )
       
    62     PS=";" # native PS, not Cygwin PS
       
    63     FS="/"
       
    64     ;;
       
    65   Windows* )
       
    66     PS=";"
       
    67     FS="\\"
       
    68     ;;
       
    69   * )
       
    70     echo "Unrecognized system!"
       
    71     exit 1;
       
    72     ;;
       
    73 esac
       
    74 
       
    75 fail() {
       
    76 	echo 'FAIL: unexpected result encountered'
       
    77         exit 1
       
    78 }
       
    79 
       
    80 javac="${TESTJAVA}${FS}bin${FS}javac"
       
    81 
       
    82 for i in 1 2 3; do
       
    83     if test ! -d ext${i}; then mkdir ext${i}; fi
       
    84     cp ${TESTSRC}${FS}ext${i}${FS}*.jar ext${i}
       
    85 done
       
    86 
       
    87 echo "Test 1"
       
    88 "$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1 "${TESTSRC}${FS}ExtDirTest_1.java"
       
    89 if [ $? -ne 0 ] ; then fail ; fi
       
    90 
       
    91 echo "Test 2"
       
    92 "$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1${PS}ext2 "${TESTSRC}${FS}ExtDirTest_2.java"
       
    93 if [ $? -ne 0 ] ; then fail ; fi
       
    94 
       
    95 echo "Test 3"
       
    96 "$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext3 "${TESTSRC}${FS}ExtDirTest_3.java"
       
    97 if [ $? -ne 0 ] ; then fail ; fi
       
    98 
       
    99 echo PASS: all tests gave expected results
       
   100 exit 0