langtools/test/tools/apt/Misc/misc.sh
changeset 11914 d1311b0c757f
parent 11913 be61e1597cc6
parent 11872 c51754cddc03
child 11915 33f703959597
child 11986 6f383069eb6d
equal deleted inserted replaced
11913:be61e1597cc6 11914:d1311b0c757f
     1 #!/bin/sh
       
     2 
       
     3 #
       
     4 # Copyright (c) 2004, 2007, 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 # @test
       
    27 # @bug 5007250
       
    28 # @run shell ../verifyVariables.sh
       
    29 # @run shell misc.sh
       
    30 # @summary Miscelleneous tests
       
    31 # @author Joseph D. Darcy
       
    32 
       
    33 OS=`uname -s`;
       
    34 case "${OS}" in
       
    35         Windows* | CYGWIN* )
       
    36                 SEP=";"
       
    37         ;;
       
    38 
       
    39 	* )
       
    40 	SEP=":"
       
    41 	;;
       
    42 esac
       
    43 
       
    44 JARCP=misc.jar
       
    45 SOURCEP=${TESTSRC}
       
    46 
       
    47 # Construct path to apt executable
       
    48 APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} -nocompile "
       
    49 
       
    50 printf "%s\n" "APT = ${APT}"
       
    51 
       
    52 # Construct path to javac executable
       
    53 JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . "
       
    54 JAR="${TESTJAVA}/bin/jar "
       
    55 
       
    56 ${JAVAC} ${TESTSRC}/Misc.java ${TESTSRC}/Marked.java 
       
    57 RESULT=$?
       
    58 
       
    59 case "${RESULT}" in
       
    60         0  )
       
    61         ;;
       
    62 
       
    63         * )
       
    64         echo "Compilation failed."
       
    65         exit 1
       
    66 esac
       
    67 
       
    68 
       
    69 echo "Making services directory and copying services information."
       
    70 mkdir -p META-INF/services
       
    71 
       
    72 cp ${TESTSRC}/servicesMisc META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
       
    73 
       
    74 ${JAR} cf0 misc.jar Misc*.class META-INF
       
    75 
       
    76 # Jar files created; verify options properly present on both initial
       
    77 # and recursive apt runs
       
    78 
       
    79 #---------------------------------------------------------
       
    80 
       
    81 unset CLASSPATH
       
    82 
       
    83 printf "%s\n" "-classpath ${JARCP}"     > options
       
    84 printf "%s\n" "-sourcepath ${SOURCEP}" >> options
       
    85 printf "%s\n" "${TESTSRC}/Marked.java" >> options
       
    86 
       
    87 ${APT} @options
       
    88 
       
    89 RESULT=$?
       
    90 case "${RESULT}" in
       
    91         0  )
       
    92 	;;	
       
    93 	
       
    94 	* )
       
    95 	echo "Problem with result"
       
    96 	exit 1
       
    97         ;;
       
    98 esac
       
    99 
       
   100 exit 0;