test/tools/apt/Options/options.sh

Thu, 25 Aug 2011 17:18:25 -0700

author
schien
date
Thu, 25 Aug 2011 17:18:25 -0700
changeset 1067
f497fac86cf9
parent 554
9d9f26857129
permissions
-rw-r--r--

Added tag jdk8-b02 for changeset b3c059de2a61

     1 #!/bin/sh
     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 #
    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
    33 OS=`uname -s`;
    34 case "${OS}" in
    35         Windows* | CYGWIN* )
    36                 SEP=";"
    37         ;;
    39 	* )
    40 	SEP=":"
    41 	;;
    42 esac
    44 JARCP=option.jar
    45 SOURCEP=${TESTSRC}
    48 # Construct path to apt executable
    49 APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} -nocompile "
    51 printf "%s\n" "APT = ${APT}"
    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 "
    57 ${JAVAC} ${TESTSRC}/OptionChecker.java
    58 RESULT=$?
    60 case "${RESULT}" in
    61         0  )
    62         ;;
    64         * )
    65         echo "Compilation failed."
    66         exit 1
    67 esac
    70 echo "Making services directory and copying services information."
    71 mkdir -p META-INF/services
    73 cp ${TESTSRC}/servicesOptions META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
    75 ${JAR} cf0 option.jar OptionChecker*.class META-INF
    77 # Jar files created; verify options properly present on both initial
    78 # and recursive apt runs
    80 #---------------------------------------------------------
    82 unset CLASSPATH
    84 printf "%s\n" "-classpath ${JARCP}"     > options
    85 printf "%s\n" "-sourcepath ${SOURCEP}" >> options
    86 printf "%s\n" "${TESTSRC}/Marked.java" >> options
    88 ${APT} @options
    90 RESULT=$?
    91 case "${RESULT}" in
    92         0  )
    93 	echo "Failed to indentify missing options"
    94 	exit 1
    95 	;;	
    97 	* )
    98         ;;
    99 esac
   101 printf "%s\n" "-Afoo -Abar" >> options
   103 ${APT} @options
   105 RESULT=$?
   106 case "${RESULT}" in
   107         0  )
   108 	;;	
   110 	* )
   111 	echo "Options not found properly."
   112 	exit 1
   113         ;;
   114 esac
   116 exit 0;

mercurial