langtools/test/tools/apt/Discovery/discovery.sh
author jeff
Wed, 22 Jun 2011 10:10:54 -0700
changeset 9916 c35ecac744a5
parent 5520 86e4b9a9da40
permissions -rw-r--r--
7057046: Add embedded license to THIRD PARTY README Reviewed-by: lana
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
#
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1652
diff changeset
     4
# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
10
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
#
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1652
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1652
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1652
diff changeset
    23
# questions.
10
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
1484
93e942204a19 6760930: empty element on bootclasspath breaks test/tools/apt/Discovery/discovery.sh
jjg
parents: 10
diff changeset
   112
# cleanup file to prevent accidental discovery in current directory
93e942204a19 6760930: empty element on bootclasspath breaks test/tools/apt/Discovery/discovery.sh
jjg
parents: 10
diff changeset
   113
rm -f META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
# Jar files created; verify right output file is touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
#---------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
# Test different combinations of classpath, sourcepath, and
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
# destination directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
# Classpath on commandline; no output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
rm -f touched 
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
printf "%s\n" "-classpath ${JARCP}"     > options1
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
printf "%s\n" "-sourcepath ${SOURCEP}" >> options1
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
printf "%s\n" "${TESTSRC}/Touch.java"  >> options1
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
${APTNC} @options1
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
echo "Testing case 1"
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
# Class path set through environment variable
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
CLASSPATH=${JARCP}
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
export CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
printf "%s\n" "-sourcepath ${SOURCEP}" > options2
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
printf "%s\n" "${TESTSRC}/Touch.java" >> options2
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
${APTNC} @options2
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
echo "Testing case 2"
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
# No explicit source path
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
CLASSPATH=${FULLCP}
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
export CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
printf "%s\n" "${TESTSRC}/Touch.java"  > options3
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
${APTNC} @options3
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
echo "Testing case 3"
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
# Classpath on commandline; class output directory
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
rm -Rf classes/Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
printf "%s\n" "-classpath ${JARCP}"     > options4
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
printf "%s\n" "-sourcepath ${SOURCEP}" >> options4
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
printf "%s\n" "-d classes"             >> options4
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
printf "%s\n" "${TESTSRC}/Touch.java"  >> options4
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
${APTNC} @options4
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
echo "Testing case 4"
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
TestFile "classes/Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
# Classpath on commandline; source output directory
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
rm -Rf src
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
printf "%s\n" "-classpath ${JARCP}"     > options5
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
printf "%s\n" "-sourcepath ${SOURCEP}" >> options5
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
printf "%s\n" "-s src"                 >> options5
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
printf "%s\n" "${TESTSRC}/Touch.java"  >> options5
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
${APTNC} @options5
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
echo "Testing case 5"
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
TestFile "src/HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
# Classpath on commandline; class and source output directory
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
rm -Rf src
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
rm -Rf classes
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
printf "%s\n" "-classpath ${JARCP}"     > options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
printf "%s\n" "-sourcepath ${SOURCEP}" >> options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
printf "%s\n" "-d classes"             >> options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
printf "%s\n" "-s src"                 >> options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
printf "%s\n" "${TESTSRC}/Touch.java"  >> options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
${APTNC} @options6
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
echo "Testing case 6"
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
TestFile "src/HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
TestFile "classes/Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
# Classpath appended to bootclasspath; no output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
printf "%s\n" "-Xbootclasspath/a:${JARCP}" > options7
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
printf "%s\n" "-classpath /dev/null"      >> options7
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
printf "%s\n" "${TESTSRC}/Touch.java"     >> options7
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
${APTNC} @options7
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
echo "Testing case 7"
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
# Classpath in extdirs; no output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
printf "%s\n" "-extdirs ."              > options8
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
printf "%s\n" "-classpath ${TOOLSJAR}" >> options8
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
printf "%s\n" "${TESTSRC}/Touch.java"  >> options8
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
${APTNC} @options8
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
echo "Testing case 8"
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
# Classpath in extdirs, take 2; no output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
printf "%s\n" "-Djava.ext.dirs=."        > options9
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
printf "%s\n" "-classpath ${TOOLSJAR}"  >> options9
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
printf "%s\n" "${TESTSRC}/Touch.java"   >> options9
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
${APTNC} @options9
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
echo "Testing case 9"
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
# Classpath in -endorseddirs; no output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
printf "%s\n" "-endorseddirs ."          > options10
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
printf "%s\n" "-classpath ${TOOLSJAR}"  >> options10
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
printf "%s\n" "${TESTSRC}/Touch.java"   >> options10
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
${APTNC} @options10
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
echo "Testing case 10"
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
TestFile "Empty.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
# Testing apt invocation with no command line options
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
rm -f HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
rm -f Empty.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
CLASSPATH=./phantom/phantom.jar
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
export CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
${APT}
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
echo "Testing empty command line"
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
TestFile "touched"
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
TestFile "HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
# Verify apt and JSR 269 annotation processors can be run from same
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
# invocation and both use the output directories
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
rm -f touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
rm -f src/HelloWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
rm -f src/GoodbyeWorld.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
rm -f classes/HelloWorld.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
rm -f classes/GoodbyeWorld.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
printf "%s\n" "-classpath ./phantom/phantom.jar" > options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
printf "%s\n" "-sourcepath ${SOURCEP}"          >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
printf "%s\n" "-factory PhantomTouch "          >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
printf "%s\n" "-s src"                          >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
printf "%s\n" "-d classes"                      >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
printf "%s\n" "-A"             	                >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
printf "%s\n" "-Afoo"          	                >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
printf "%s\n" "-Abar=baz"      	                >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
printf "%s\n" "-processorpath $TESTCLASSES"     >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
printf "%s\n" "-processor PhantomUpdate"        >> options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
${APT} @options11
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
echo "Testing combined apt and JSR 269 processing"
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
TestFile touched
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
TestFile "src/HelloWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
TestFile "src/GoodbyeWorld.java"
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
TestFile "classes/HelloWorld.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
TestFile "classes/GoodbyeWorld.class"
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
# Verify running with badTouch doesn't exit successfully
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
#
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
rm -f ./META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
cp ${TESTSRC}/servicesBadTouch ./META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
${JAR} cf0 badTouch.jar Touch*.class META-INF
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
unset CLASSPATH
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
printf "%s\n" "-classpath ${BADCP}"     > optionsBad
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
printf "%s\n" "-sourcepath ${SOURCEP}" >> optionsBad
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
printf "%s\n" "${TESTSRC}/Touch.java"  >> optionsBad
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
${APTNC} @optionsBad 2> /dev/null
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
RESULT=$?
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
case "${RESULT}" in
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
        0  )
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
	echo "Improper exit zero with bad services information."
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
	exit 1
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
        ;;
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
esac
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
exit 0;