discovery.sh revision 148
#
# Copyright 1999-2002 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# @test
# @bug 4984412 4985113 4908512 4990905 4998007 4998218 5002340 5023882 6370261 6363481
# @run shell ../verifyVariables.sh
# @compile PhantomUpdate.java
# @run shell discovery.sh
# @summary Test consistency of annotation discovery
# @author Joseph D. Darcy
# If the file does not exist, exit with an error
if [ ! -f ${1} ]; then
printf "%s\n" "File ${1} not found."
exit 1
fi
}
case "${OS}" in
SEP=";"
;;
* )
SEP=":"
;;
esac
# Construct path to apt executable
# Construct path to apt executable, no compilation
APTNC="${APT} -nocompile "
printf "%s\n" "APT = ${APT}"
# Construct path to javac executable
JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TOOLSJAR} -d . "
$JAVAC ${TESTSRC}/Dee.java ${TESTSRC}/Dum.java ${TESTSRC}/Touch.java ${TESTSRC}/PhantomTouch.java ${TESTSRC}/Empty.java
RESULT=$?
case "${RESULT}" in
0 )
;;
* )
echo "Compilation failed."
exit 1
esac
echo "Making services directory and copying services information."
rm -f badTouch.jar
cp ${TESTSRC}/servicesPhantomTouch ./META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
# cleanup file to prevent accidental discovery in current directory
# Jar files created; verify right output file is touched
#---------------------------------------------------------
# Test different combinations of classpath, sourcepath, and
# destination directories
#
# Classpath on commandline; no output directories
#
rm -f Empty.class
unset CLASSPATH
echo "Testing case 1"
TestFile "touched"
#
# Class path set through environment variable
#
rm -f Empty.class
unset CLASSPATH
export CLASSPATH
echo "Testing case 2"
TestFile "touched"
#
# No explicit source path
#
rm -f Empty.class
unset CLASSPATH
export CLASSPATH
echo "Testing case 3"
TestFile "touched"
#
# Classpath on commandline; class output directory
#
unset CLASSPATH
echo "Testing case 4"
TestFile "touched"
#
# Classpath on commandline; source output directory
#
rm -f Empty.class
unset CLASSPATH
echo "Testing case 5"
TestFile "touched"
#
# Classpath on commandline; class and source output directory
#
unset CLASSPATH
echo "Testing case 6"
TestFile "touched"
#
# Classpath appended to bootclasspath; no output directories
#
rm -f Empty.class
unset CLASSPATH
echo "Testing case 7"
TestFile "touched"
#
# Classpath in extdirs; no output directories
#
rm -f Empty.class
unset CLASSPATH
echo "Testing case 8"
TestFile "touched"
#
# Classpath in extdirs, take 2; no output directories
#
rm -f Empty.class
unset CLASSPATH
echo "Testing case 9"
TestFile "touched"
#
# Classpath in -endorseddirs; no output directories
#
rm -f Empty.class
unset CLASSPATH
echo "Testing case 10"
TestFile "touched"
#
# Testing apt invocation with no command line options
#
rm -f Empty.class
unset CLASSPATH
export CLASSPATH
${APT}
echo "Testing empty command line"
TestFile "touched"
#
# Verify apt and JSR 269 annotation processors can be run from same
# invocation and both use the output directories
#
unset CLASSPATH
echo "Testing combined apt and JSR 269 processing"
#
# Verify running with badTouch doesn't exit successfully
#
unset CLASSPATH
RESULT=$?
case "${RESULT}" in
0 )
echo "Improper exit zero with bad services information."
exit 1
;;
esac
exit 0;