langtools/test/tools/apt/Options/options.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 4993950 4993277
       
    28 # @run shell ../verifyVariables.sh
       
    29 # @run shell options.sh
       
    30 # @summary Test availabilty of command line options in processors
       
    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=option.jar
       
    45 SOURCEP=${TESTSRC}
       
    46 
       
    47 
       
    48 # Construct path to apt executable
       
    49 APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} -nocompile "
       
    50 
       
    51 printf "%s\n" "APT = ${APT}"
       
    52 
       
    53 # Construct path to javac executable
       
    54 JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . "
       
    55 JAR="${TESTJAVA}/bin/jar "
       
    56 
       
    57 ${JAVAC} ${TESTSRC}/OptionChecker.java
       
    58 RESULT=$?
       
    59 
       
    60 case "${RESULT}" in
       
    61         0  )
       
    62         ;;
       
    63 
       
    64         * )
       
    65         echo "Compilation failed."
       
    66         exit 1
       
    67 esac
       
    68 
       
    69 
       
    70 echo "Making services directory and copying services information."
       
    71 mkdir -p META-INF/services
       
    72 
       
    73 cp ${TESTSRC}/servicesOptions META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
       
    74 
       
    75 ${JAR} cf0 option.jar OptionChecker*.class META-INF
       
    76 
       
    77 # Jar files created; verify options properly present on both initial
       
    78 # and recursive apt runs
       
    79 
       
    80 #---------------------------------------------------------
       
    81 
       
    82 unset CLASSPATH
       
    83 
       
    84 printf "%s\n" "-classpath ${JARCP}"     > options
       
    85 printf "%s\n" "-sourcepath ${SOURCEP}" >> options
       
    86 printf "%s\n" "${TESTSRC}/Marked.java" >> options
       
    87 
       
    88 ${APT} @options
       
    89 
       
    90 RESULT=$?
       
    91 case "${RESULT}" in
       
    92         0  )
       
    93 	echo "Failed to indentify missing options"
       
    94 	exit 1
       
    95 	;;	
       
    96 	
       
    97 	* )
       
    98         ;;
       
    99 esac
       
   100 
       
   101 printf "%s\n" "-Afoo -Abar" >> options
       
   102 
       
   103 ${APT} @options
       
   104 
       
   105 RESULT=$?
       
   106 case "${RESULT}" in
       
   107         0  )
       
   108 	;;	
       
   109 	
       
   110 	* )
       
   111 	echo "Options not found properly."
       
   112 	exit 1
       
   113         ;;
       
   114 esac
       
   115 
       
   116 exit 0;