langtools/test/tools/apt/Discovery/discovery.sh
author never
Mon, 31 Mar 2008 16:22:52 -0700
changeset 254 717d75d80a30
parent 10 06bc494ca11e
child 1484 93e942204a19
permissions -rw-r--r--
6636352: Unit tests for supplementary character support fail with -XX:+AggressiveOpts Summary: incorrect encoding Reviewed-by: kvn, rasbold, sgoldman, jrose
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
#!/bin/sh
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
#
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
# Copyright 1999-2002 Sun Microsystems, Inc.  All Rights Reserved.
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
#
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
# published by the Free Software Foundation.
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
# CA 95054 USA or visit www.sun.com if you need additional information or
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
# have any questions.
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
# @test
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
# @bug 4984412 4985113 4908512 4990905 4998007 4998218 5002340 5023882 6370261 6363481
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
# @run shell ../verifyVariables.sh
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
# @compile PhantomUpdate.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
# @run shell discovery.sh
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
# @summary Test consistency of annotation discovery
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
# @author Joseph D. Darcy
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
# If the file does not exist, exit with an error
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
TestFile() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
	if [ ! -f ${1} ]; then
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
		printf "%s\n" "File ${1} not found."
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
		exit 1
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
	fi
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
}
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
OS=`uname -s`;
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
case "${OS}" in
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
        Windows* | CYGWIN* )
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
                SEP=";"
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
        ;;
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
	* )
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
	SEP=":"
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
	;;
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
esac
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
TOOLSJAR=${TESTJAVA}/lib/tools.jar
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
OLDCP=${CLASSPATH}
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
JARCP=tweedle.jar${SEP}touch.jar${SEP}${TOOLSJAR}
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
SOURCEP=${TESTSRC}
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
FULLCP=${JARCP}${SEP}${SOURCEP}
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
BADCP=tweedle.jar${SEP}badTouch.jar${SEP}${TOOLSJAR}
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
# Construct path to apt executable
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} "
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
# Construct path to apt executable, no compilation
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
APTNC="${APT} -nocompile "
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
printf "%s\n" "APT = ${APT}"
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
# Construct path to javac executable
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TOOLSJAR} -d . "
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
JAR="${TESTJAVA}/bin/jar "
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
$JAVAC ${TESTSRC}/Dee.java ${TESTSRC}/Dum.java ${TESTSRC}/Touch.java ${TESTSRC}/PhantomTouch.java ${TESTSRC}/Empty.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
RESULT=$?
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
case "${RESULT}" in
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
        0  )
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
        ;;
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
        * )
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
        echo "Compilation failed."
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
        exit 1
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
esac
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
mv Empty.class Empty.clazz
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
echo "Making services directory and copying services information."
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
mkdir -p META-INF/services
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
mkdir -p phantom
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
rm -f touch.jar
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
rm -f badTouch.jar
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
cp ${TESTSRC}/servicesTweedle META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
${JAR} cf0 tweedle.jar Dee*.class Dum*.class META-INF
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
rm -f META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
cp ${TESTSRC}/servicesTouch ./META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
${JAR} cf0 touch.jar Touch*.class META-INF
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
rm -f META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
cp ${TESTSRC}/servicesPhantomTouch ./META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
${JAR} cf0 phantom/phantom.jar PhantomTouch*.class META-INF
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
# Jar files created; verify right output file is touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
#---------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
# Test different combinations of classpath, sourcepath, and
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
# destination directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
# Classpath on commandline; no output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
rm -f touched 
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
printf "%s\n" "-classpath ${JARCP}"     > options1
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
printf "%s\n" "-sourcepath ${SOURCEP}" >> options1
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
printf "%s\n" "${TESTSRC}/Touch.java"  >> options1
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
${APTNC} @options1
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
echo "Testing case 1"
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
# Class path set through environment variable
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
CLASSPATH=${JARCP}
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
export CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
printf "%s\n" "-sourcepath ${SOURCEP}" > options2
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
printf "%s\n" "${TESTSRC}/Touch.java" >> options2
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
${APTNC} @options2
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
echo "Testing case 2"
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
# No explicit source path
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
CLASSPATH=${FULLCP}
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
export CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
printf "%s\n" "${TESTSRC}/Touch.java"  > options3
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
${APTNC} @options3
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
echo "Testing case 3"
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
# Classpath on commandline; class output directory
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
rm -Rf classes/Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
printf "%s\n" "-classpath ${JARCP}"     > options4
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
printf "%s\n" "-sourcepath ${SOURCEP}" >> options4
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
printf "%s\n" "-d classes"             >> options4
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
printf "%s\n" "${TESTSRC}/Touch.java"  >> options4
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
${APTNC} @options4
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
echo "Testing case 4"
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
TestFile "classes/Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
# Classpath on commandline; source output directory
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
rm -Rf src
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
printf "%s\n" "-classpath ${JARCP}"     > options5
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
printf "%s\n" "-sourcepath ${SOURCEP}" >> options5
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
printf "%s\n" "-s src"                 >> options5
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
printf "%s\n" "${TESTSRC}/Touch.java"  >> options5
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
${APTNC} @options5
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
echo "Testing case 5"
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
TestFile "src/HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
# Classpath on commandline; class and source output directory
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
rm -Rf src
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
rm -Rf classes
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
printf "%s\n" "-classpath ${JARCP}"     > options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
printf "%s\n" "-sourcepath ${SOURCEP}" >> options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
printf "%s\n" "-d classes"             >> options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
printf "%s\n" "-s src"                 >> options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
printf "%s\n" "${TESTSRC}/Touch.java"  >> options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
${APTNC} @options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
echo "Testing case 6"
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
TestFile "src/HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
TestFile "classes/Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
# Classpath appended to bootclasspath; no output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
printf "%s\n" "-Xbootclasspath/a:${JARCP}" > options7
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
printf "%s\n" "-classpath /dev/null"      >> options7
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
printf "%s\n" "${TESTSRC}/Touch.java"     >> options7
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
${APTNC} @options7
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
echo "Testing case 7"
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
# Classpath in extdirs; no output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
printf "%s\n" "-extdirs ."              > options8
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
printf "%s\n" "-classpath ${TOOLSJAR}" >> options8
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
printf "%s\n" "${TESTSRC}/Touch.java"  >> options8
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
${APTNC} @options8
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
echo "Testing case 8"
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
# Classpath in extdirs, take 2; no output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
printf "%s\n" "-Djava.ext.dirs=."        > options9
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
printf "%s\n" "-classpath ${TOOLSJAR}"  >> options9
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
printf "%s\n" "${TESTSRC}/Touch.java"   >> options9
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
${APTNC} @options9
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
echo "Testing case 9"
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
# Classpath in -endorseddirs; no output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
printf "%s\n" "-endorseddirs ."          > options10
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
printf "%s\n" "-classpath ${TOOLSJAR}"  >> options10
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
printf "%s\n" "${TESTSRC}/Touch.java"   >> options10
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
${APTNC} @options10
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
echo "Testing case 10"
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
# Testing apt invocation with no command line options
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
CLASSPATH=./phantom/phantom.jar
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
export CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
${APT}
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
echo "Testing empty command line"
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
# Verify apt and JSR 269 annotation processors can be run from same
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
# invocation and both use the output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
rm -f src/HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
rm -f src/GoodbyeWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
rm -f classes/HelloWorld.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
rm -f classes/GoodbyeWorld.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
printf "%s\n" "-classpath ./phantom/phantom.jar" > options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
printf "%s\n" "-sourcepath ${SOURCEP}"          >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
printf "%s\n" "-factory PhantomTouch "          >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
printf "%s\n" "-s src"                          >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
printf "%s\n" "-d classes"                      >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
printf "%s\n" "-A"             	                >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
printf "%s\n" "-Afoo"          	                >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
printf "%s\n" "-Abar=baz"      	                >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
printf "%s\n" "-processorpath $TESTCLASSES"     >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
printf "%s\n" "-processor PhantomUpdate"        >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
${APT} @options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
echo "Testing combined apt and JSR 269 processing"
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
TestFile touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
TestFile "src/HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
TestFile "src/GoodbyeWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
TestFile "classes/HelloWorld.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
TestFile "classes/GoodbyeWorld.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
# Verify running with badTouch doesn't exit successfully
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
rm -f ./META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
cp ${TESTSRC}/servicesBadTouch ./META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
${JAR} cf0 badTouch.jar Touch*.class META-INF
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
printf "%s\n" "-classpath ${BADCP}"     > optionsBad
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
printf "%s\n" "-sourcepath ${SOURCEP}" >> optionsBad
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
printf "%s\n" "${TESTSRC}/Touch.java"  >> optionsBad
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
${APTNC} @optionsBad 2> /dev/null
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
RESULT=$?
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
case "${RESULT}" in
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
        0  )
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
	echo "Improper exit zero with bad services information."
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
	exit 1
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
        ;;
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
esac
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
exit 0;