1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/apt/Options/options.sh Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,116 @@ 1.4 +#!/bin/sh 1.5 + 1.6 +# 1.7 +# Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved. 1.8 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.9 +# 1.10 +# This code is free software; you can redistribute it and/or modify it 1.11 +# under the terms of the GNU General Public License version 2 only, as 1.12 +# published by the Free Software Foundation. 1.13 +# 1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 +# version 2 for more details (a copy is included in the LICENSE file that 1.18 +# accompanied this code). 1.19 +# 1.20 +# You should have received a copy of the GNU General Public License version 1.21 +# 2 along with this work; if not, write to the Free Software Foundation, 1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 +# 1.24 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 +# CA 95054 USA or visit www.sun.com if you need additional information or 1.26 +# have any questions. 1.27 +# 1.28 + 1.29 +# @test 1.30 +# @bug 4993950 4993277 1.31 +# @run shell ../verifyVariables.sh 1.32 +# @run shell options.sh 1.33 +# @summary Test availabilty of command line options in processors 1.34 +# @author Joseph D. Darcy 1.35 + 1.36 +OS=`uname -s`; 1.37 +case "${OS}" in 1.38 + Windows* | CYGWIN* ) 1.39 + SEP=";" 1.40 + ;; 1.41 + 1.42 + * ) 1.43 + SEP=":" 1.44 + ;; 1.45 +esac 1.46 + 1.47 +JARCP=option.jar 1.48 +SOURCEP=${TESTSRC} 1.49 + 1.50 + 1.51 +# Construct path to apt executable 1.52 +APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} -nocompile " 1.53 + 1.54 +printf "%s\n" "APT = ${APT}" 1.55 + 1.56 +# Construct path to javac executable 1.57 +JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . " 1.58 +JAR="${TESTJAVA}/bin/jar " 1.59 + 1.60 +${JAVAC} ${TESTSRC}/OptionChecker.java 1.61 +RESULT=$? 1.62 + 1.63 +case "${RESULT}" in 1.64 + 0 ) 1.65 + ;; 1.66 + 1.67 + * ) 1.68 + echo "Compilation failed." 1.69 + exit 1 1.70 +esac 1.71 + 1.72 + 1.73 +echo "Making services directory and copying services information." 1.74 +mkdir -p META-INF/services 1.75 + 1.76 +cp ${TESTSRC}/servicesOptions META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory 1.77 + 1.78 +${JAR} cf0 option.jar OptionChecker*.class META-INF 1.79 + 1.80 +# Jar files created; verify options properly present on both initial 1.81 +# and recursive apt runs 1.82 + 1.83 +#--------------------------------------------------------- 1.84 + 1.85 +unset CLASSPATH 1.86 + 1.87 +printf "%s\n" "-classpath ${JARCP}" > options 1.88 +printf "%s\n" "-sourcepath ${SOURCEP}" >> options 1.89 +printf "%s\n" "${TESTSRC}/Marked.java" >> options 1.90 + 1.91 +${APT} @options 1.92 + 1.93 +RESULT=$? 1.94 +case "${RESULT}" in 1.95 + 0 ) 1.96 + echo "Failed to indentify missing options" 1.97 + exit 1 1.98 + ;; 1.99 + 1.100 + * ) 1.101 + ;; 1.102 +esac 1.103 + 1.104 +printf "%s\n" "-Afoo -Abar" >> options 1.105 + 1.106 +${APT} @options 1.107 + 1.108 +RESULT=$? 1.109 +case "${RESULT}" in 1.110 + 0 ) 1.111 + ;; 1.112 + 1.113 + * ) 1.114 + echo "Options not found properly." 1.115 + exit 1 1.116 + ;; 1.117 +esac 1.118 + 1.119 +exit 0;