langtools/test/tools/javac/Paths/MineField.sh
author mikejwre
Wed, 09 Jun 2010 18:56:41 -0700
changeset 5634 895b66935810
parent 5520 86e4b9a9da40
child 27579 d1a63c99cdd5
permissions -rw-r--r--
Merge
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: 10
diff changeset
     4
# Copyright (c) 2003, 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: 10
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
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
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
# @test
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
# @bug 4758537 4809833
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
# @summary Test that javac and java find files in similar ways
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
# @author Martin Buchholz
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
# @run shell/timeout=600 MineField.sh
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
# To run this test manually, simply do ./MineField.sh
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
# The search order for classes used by both java and javac is:
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
# -Xbootclasspath/p:<path>
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
# -endorseddirs <dirs> or -Djava.endorsed.dirs=<dirs> (search for jar/zip only)
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
# -bootclasspath <path> or -Xbootclasspath:<path>
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
# -Xbootclasspath/a:<path>
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
# -extdirs <dirs> or -Djava.ext.dirs=<dirs> (search for jar/zip only)
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
# -classpath <path>, -cp <path>, env CLASSPATH=<path>
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
# Peculiarities of the class file search:
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
# - Empty elements of the (user) classpath default to ".",
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
#   while empty elements of other paths are ignored.
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
# - Only for the user classpath is an empty string value equivalent to "."
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
# - Specifying a bootclasspath on the command line obliterates any
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
#   previous -Xbootclasspath/p: or -Xbootclasspath/a: command line flags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
. ${TESTSRC-.}/Util.sh
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
set -u
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
BCP=`DefaultBootClassPath`
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
# Prepare the "Minefield"
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
Cleanup() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    Sys rm -rf GooSrc GooJar GooZip GooClass
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
    Sys rm -rf BadSrc BadJar BadZip BadClass
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    Sys rm -rf OneDir *.class Main.java MANIFEST.MF
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
}
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
Cleanup
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
Sys mkdir  GooSrc GooJar GooZip GooClass
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
Sys mkdir  BadSrc BadJar BadZip BadClass
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
echo 'public class Lib {public static void f(){}}' > Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
Sys "$javac" ${TESTTOOLVMOPTS} Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
Sys "$jar" cf GooJar/Lib.jar Lib.class
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
Sys "$jar" cf GooZip/Lib.zip Lib.class
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
Sys mv Lib.class GooClass/.
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
Sys mv Lib.java GooSrc/.
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
CheckFiles GooZip/Lib.zip GooJar/Lib.jar GooSrc/Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
echo 'public class Lib {/* Bad */}' > Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
Sys "$javac" ${TESTTOOLVMOPTS} Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
Sys "$jar" cf BadJar/Lib.jar Lib.class
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
Sys "$jar" cf BadZip/Lib.zip Lib.class
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
Sys mv Lib.class BadClass/.
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
Sys mv Lib.java BadSrc/.
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
CheckFiles BadZip/Lib.zip BadJar/Lib.jar BadSrc/Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
echo 'public class Main {public static void main(String[] a) {Lib.f();}}' > Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
# Verify that javac class search order is the same as java's
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
Failure "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    -Xbootclasspath/p:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
    -J-Djava.endorsed.dirs="GooJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
    -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    -J-Djava.endorsed.dirs="BadJar${PS}GooZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
Failure "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
    -Xbootclasspath/p:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    -Djava.endorsed.dirs="GooJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
Success "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
    -Djava.endorsed.dirs="BadJar${PS}GooZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
Failure "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    -Xbootclasspath/p:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    -bootclasspath "$BCP${PS}BadZip/Lib.zip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    -Xbootclasspath/p:"BadClass${PS}GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
    -bootclasspath "$BCP${PS}GooZip/Lib.zip${PS}BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
    -Xbootclasspath/p:"BadJar/Lib.jar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
    -Xbootclasspath:"$BCP${PS}GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
Failure "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
    -Xbootclasspath/p:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
    -Xbootclasspath:"$BCP${PS}BadZip/Lib.zip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
Success "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    -Xbootclasspath/p:"BadClass${PS}GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
    -Xbootclasspath:"$BCP${PS}GooZip/Lib.zip${PS}BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
Failure "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    -bootclasspath "$BCP${PS}GooZip/Lib.zip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
    -Xbootclasspath/p:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
    -bootclasspath "$BCP${PS}BadZip/Lib.zip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
    -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
Failure "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
    -Xbootclasspath:"$BCP${PS}GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
    -Xbootclasspath/p:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
Success "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
    -Xbootclasspath:"$BCP${PS}BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
Failure "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
    -Xbootclasspath/p:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
    -Xbootclasspath/a:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
    -Xbootclasspath/p:"GooClass${PS}BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
    -Xbootclasspath/a:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
Failure "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
    -Xbootclasspath/p:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
    -Xbootclasspath/a:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
Success "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
    -Xbootclasspath/p:"GooClass${PS}BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
    -Xbootclasspath/a:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
Failure "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
    -Xbootclasspath/p:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
    -J-Djava.endorsed.dirs="BadZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
    -bootclasspath "GooClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
    -Xbootclasspath/p:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
    -J-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
    -bootclasspath "BadClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
Failure "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
    -Xbootclasspath/p:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
    -Djava.endorsed.dirs="BadZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
    -Xbootclasspath:"GooClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
Success "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
    -Xbootclasspath/p:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
    -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    -Xbootclasspath:"BadClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
Failure "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
    -Xbootclasspath/p:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
    -Xbootclasspath:"BadClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
    -Xbootclasspath/a:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
    -Xbootclasspath/p:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    -Xbootclasspath:"GooClass${PS}BadClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
    -Xbootclasspath/a:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
Failure "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
    -Xbootclasspath/p:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
    -Xbootclasspath:"BadClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
    -Xbootclasspath/a:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
Success "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
    -Xbootclasspath/p:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
    -Xbootclasspath:"GooClass${PS}BadClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
    -Xbootclasspath/a:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
Failure "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
    -J-Djava.endorsed.dirs="BadZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
    -Xbootclasspath:"GooClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
    -endorseddirs "BadClass${PS}GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
    -Xbootclasspath:"BadClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
    -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
    -Xbootclasspath:"BadClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
    -J-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
    -Xbootclasspath:"BadClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
Failure "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
    -Djava.endorsed.dirs="BadZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
    -Xbootclasspath:"GooClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
Success "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
    -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
    -Xbootclasspath:"BadClass${PS}$BCP" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
Failure "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
    -Xbootclasspath/a:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
    -extdirs "GooZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
    -Xbootclasspath/a:"GooClass${PS}BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
    -extdirs "BadZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
Failure "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
    -Xbootclasspath/a:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
    -Djava.ext.dirs="GooZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
Success "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
    -Xbootclasspath/a:"GooClass${PS}BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
    -Djava.ext.dirs="BadZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
Failure "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
    -bootclasspath "$BCP${PS}BadJar/Lib.jar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
    -J-Djava.ext.dir="GooJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
    -bootclasspath "$BCP${PS}GooJar/Lib.jar${PS}BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
    -J-Djava.ext.dir="BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
Failure "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
    -Xbootclasspath:"$BCP${PS}BadJar/Lib.jar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
    -Djava.ext.dirs="GooJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
Success "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
    -Xbootclasspath:"$BCP${PS}GooJar/Lib.jar${PS}BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
    -Djava.ext.dirs="BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
Failure "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
    -extdirs "GooClass${PS}BadZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
    -cp "GooZip/Lib.zip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
    -extdirs "BadClass${PS}GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
    -cp "BadZip/Lib.zip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
    -Djava.ext.dirs="GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
    -classpath "BadZip/Lib.zip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
Success "$javac" ${TESTTOOLVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
    -J-Djava.ext.dirs="GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
    -classpath "BadZip/Lib.zip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
Failure "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
    -Djava.ext.dirs="GooClass${PS}BadZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
    -cp "GooZip/Lib.zip${PS}." \
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
Success "$java" ${TESTVMOPTS} \
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
    -Djava.ext.dirs="GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
    -cp "BadZip/Lib.zip${PS}." \
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
Failure "$javac" ${TESTTOOLVMOPTS} -classpath "BadClass${PS}GooClass" Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
Success "$javac" ${TESTTOOLVMOPTS} -classpath "GooClass${PS}BadClass" Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
Failure "$java" ${TESTVMOPTS}  -classpath "BadClass${PS}GooClass${PS}." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
Success "$java" ${TESTVMOPTS}  -classpath "GooClass${PS}BadClass${PS}." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
Failure "$javac" ${TESTTOOLVMOPTS} -cp "BadJar/Lib.jar${PS}GooZip/Lib.zip" Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
Success "$javac" ${TESTTOOLVMOPTS} -cp "GooJar/Lib.jar${PS}BadZip/Lib.zip" Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
Failure "$java" ${TESTVMOPTS}  -cp "BadJar/Lib.jar${PS}${PS}GooZip/Lib.zip" Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
Success "$java" ${TESTVMOPTS}  -cp "GooJar/Lib.jar${PS}${PS}BadZip/Lib.zip" Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
Failure env CLASSPATH="BadZip/Lib.zip${PS}GooJar/Lib.jar" "$javac" ${TESTTOOLVMOPTS} Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
Success env CLASSPATH="GooZip/Lib.zip${PS}BadJar/Lib.jar" "$javac" ${TESTTOOLVMOPTS} Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
Failure env CLASSPATH="${PS}BadZip/Lib.zip${PS}GooJar/Lib.jar" "$java" ${TESTVMOPTS} Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
Success env CLASSPATH="${PS}GooZip/Lib.zip${PS}BadJar/Lib.jar" "$java" ${TESTVMOPTS} Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
# Check behavior of empty paths and empty path elements
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
In() { cd "$1"; shift; "$@"; cd ..; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
In GooClass Failure "$java" ${TESTVMOPTS}  -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
# Unspecified classpath defaults to "."
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
Sys mkdir OneDir; Sys cp -p Main.java GooClass/Lib.class OneDir/.
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
In OneDir Success "$javac" ${TESTTOOLVMOPTS} Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
In OneDir Success "$java" ${TESTVMOPTS}  Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
# Empty classpath elements mean "."
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
In GooClass Success "$javac" ${TESTTOOLVMOPTS} -cp "${PS}.." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
In GooClass Success "$java" ${TESTVMOPTS}  -cp "${PS}.." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
In GooClass Success "$javac" ${TESTTOOLVMOPTS} -cp "..${PS}" ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
In GooClass Success "$java" ${TESTVMOPTS}  -cp "..${PS}" Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
In GooClass Success "$javac" ${TESTTOOLVMOPTS} -cp "..${PS}${PS}/xyzzy" ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
In GooClass Success "$java" ${TESTVMOPTS}  -cp "..${PS}${PS}/xyzzy" Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
# All other empty path elements are ignored.
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -extdirs "" -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
In GooJar Failure "$java" ${TESTVMOPTS} -Djava.ext.dirs="" -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -extdirs        "${PS}" -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -Djava.ext.dirs="${PS}" -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
In GooJar Failure "$java" ${TESTVMOPTS}  -Djava.ext.dirs="${PS}" -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
In GooJar Success "$javac" ${TESTTOOLVMOPTS} -extdirs        "." -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
In GooJar Success "$javac" ${TESTTOOLVMOPTS} -Djava.ext.dirs="." -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
In GooJar Success "$java" ${TESTVMOPTS}  -Djava.ext.dirs="." -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="" -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
In GooJar Failure "$javac" ${TESTTOOLVMOPTS}   -Djava.endorsed.dirs="" -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
In GooJar Failure "$java" ${TESTVMOPTS}    -Djava.endorsed.dirs="" -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="${PS}" -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
In GooJar Failure "$javac" ${TESTTOOLVMOPTS}   -endorseddirs        "${PS}" -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
In GooJar Failure "$java" ${TESTVMOPTS}    -Djava.endorsed.dirs="${PS}" -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
In GooJar Success "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="." -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
In GooJar Success "$javac" ${TESTTOOLVMOPTS}   -Djava.endorsed.dirs="." -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
In GooJar Success "$java" ${TESTVMOPTS}    -Djava.endorsed.dirs="." -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath/p: -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
In GooClass Failure "$java" ${TESTVMOPTS}  -Xbootclasspath/p: -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
In GooClass Success "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath/p:. -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
In GooClass Success "$java" ${TESTVMOPTS}  -Xbootclasspath/p:. -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath:"$BCP" -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
In GooClass Failure "$java" ${TESTVMOPTS}  -Xbootclasspath:"$BCP" -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
In GooClass Success "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath:"$BCP${PS}." -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
In GooClass Success "$java" ${TESTVMOPTS}  -Xbootclasspath:"$BCP${PS}." -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath/a: -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
In GooClass Failure "$java" ${TESTVMOPTS}  -Xbootclasspath/a: -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
In GooClass Success "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath/a:. -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
In GooClass Success "$java" ${TESTVMOPTS}  -Xbootclasspath/a:. -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
Cleanup
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
Bottom Line