langtools/test/tools/javac/Paths/MineField.sh
author jjg
Thu, 20 Oct 2016 16:31:42 -0700
changeset 41638 7b8819e22551
parent 38517 51a0187f11f6
permissions -rw-r--r--
8168343: 3 javac tests fail when run on an exploded image Reviewed-by: darcy
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
#
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
     4
# Copyright (c) 2003, 2016, 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
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    28
# @bug 4758537 4809833 8149599
10
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.
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    52
#
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    53
# JDK 9 update:
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    54
#   java: The java launcher does not support any of the following:
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    55
#       * -Xbootclasspath/p: -Xbootclasspath:
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    56
#       * -endorseddirs -Djava.endorsed.dirs
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    57
#       * -extdirs -Djava.ext.dirs
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    58
#       All test cases exercising these features have been removed.
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    59
#   javac: The following features are only supported when compiling
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    60
#       for older releases:
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    61
#       * -Xbootclasspath/p: -Xbootclasspath: -bootclasspath -Xbootclasspath/a:
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    62
#       * -endorseddirs -Djava.endorsed.dirs
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    63
#       * -extdirs -Djava.ext.dirs
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    64
#       All test cases exercising these features have been modified to
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    65
#       use -source 8 -target 8.  In addition, javac test cases involving
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    66
#       use of the runtime properties java.endorsed.dirs and java.extdirs
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    67
#       (by means of -J-Dname=value) have been removed.
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    68
#       Although the primary purpose of the test cases in this file is to
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    69
#       compare javac and java behavior, some tests remain for javac for
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    70
#       which there is no java equivalent. However, the cases remain as useful
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    71
#       test cases for javac handling of the paths involved.
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    72
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
. ${TESTSRC-.}/Util.sh
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
set -u
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
# Prepare the "Minefield"
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
Cleanup() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    Sys rm -rf GooSrc GooJar GooZip GooClass
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
    Sys rm -rf BadSrc BadJar BadZip BadClass
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    Sys rm -rf OneDir *.class Main.java MANIFEST.MF
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
    86
    Sys rm -f java-lang.jar
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
}
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
Cleanup
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
Sys mkdir  GooSrc GooJar GooZip GooClass
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
Sys mkdir  BadSrc BadJar BadZip BadClass
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
echo 'public class Lib {public static void f(){}}' > Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
Sys "$javac" ${TESTTOOLVMOPTS} Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
Sys "$jar" cf GooJar/Lib.jar Lib.class
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
Sys "$jar" cf GooZip/Lib.zip Lib.class
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
Sys mv Lib.class GooClass/.
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
Sys mv Lib.java GooSrc/.
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
CheckFiles GooZip/Lib.zip GooJar/Lib.jar GooSrc/Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
echo 'public class Lib {/* Bad */}' > Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
Sys "$javac" ${TESTTOOLVMOPTS} Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
Sys "$jar" cf BadJar/Lib.jar Lib.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
Sys "$jar" cf BadZip/Lib.zip Lib.class
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
Sys mv Lib.class BadClass/.
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
Sys mv Lib.java BadSrc/.
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
CheckFiles BadZip/Lib.zip BadJar/Lib.jar BadSrc/Lib.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
echo 'public class Main {public static void main(String[] a) {Lib.f();}}' > Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   111
# Create a jar file that is good enough to put on the javac boot class path (i.e. contains java.lang.**)
41638
7b8819e22551 8168343: 3 javac tests fail when run on an exploded image
jjg
parents: 38517
diff changeset
   112
if [ -r ${TESTJAVA}/lib/modules ]; then
7b8819e22551 8168343: 3 javac tests fail when run on an exploded image
jjg
parents: 38517
diff changeset
   113
  Sys "$jimage" extract --dir modules ${TESTJAVA}/lib/modules
7b8819e22551 8168343: 3 javac tests fail when run on an exploded image
jjg
parents: 38517
diff changeset
   114
  Sys "$jar" cf java-lang.jar -C modules/java.base java/lang
7b8819e22551 8168343: 3 javac tests fail when run on an exploded image
jjg
parents: 38517
diff changeset
   115
  Sys rm -rf modules
7b8819e22551 8168343: 3 javac tests fail when run on an exploded image
jjg
parents: 38517
diff changeset
   116
elif [ -d ${TESTJAVA}/modules ]; then
7b8819e22551 8168343: 3 javac tests fail when run on an exploded image
jjg
parents: 38517
diff changeset
   117
  Sys "$jar" cf java-lang.jar -C ${TESTJAVA}/modules/java.base java/lang
7b8819e22551 8168343: 3 javac tests fail when run on an exploded image
jjg
parents: 38517
diff changeset
   118
else
7b8819e22551 8168343: 3 javac tests fail when run on an exploded image
jjg
parents: 38517
diff changeset
   119
  echo 'cannot create java-lang.jar' ; exit 1
7b8819e22551 8168343: 3 javac tests fail when run on an exploded image
jjg
parents: 38517
diff changeset
   120
fi
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   121
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
# Verify that javac class search order is the same as java's
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
#----------------------------------------------------------------
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   125
Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   126
    -Xbootclasspath/p:"GooClass" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   127
    -bootclasspath "java-lang.jar${PS}BadZip/Lib.zip" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   128
    Main.java
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   129
Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   130
    -Xbootclasspath/p:"BadClass${PS}GooClass" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   131
    -bootclasspath "java-lang.jar${PS}GooZip/Lib.zip${PS}BadClass" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   132
    Main.java
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   133
Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   134
    -Xbootclasspath/p:"BadJar/Lib.jar" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   135
    -Xbootclasspath:"java-lang.jar${PS}GooClass" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   136
    Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
#----------------------------------------------------------------
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   139
Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   140
    -bootclasspath "java-lang.jar${PS}GooZip/Lib.zip" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   141
    -Xbootclasspath/p:"BadClass" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   142
    Main.java
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   143
Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   144
    -bootclasspath "java-lang.jar${PS}BadZip/Lib.zip" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   145
    -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   146
    Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
#----------------------------------------------------------------
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   149
Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
    -Xbootclasspath/p:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    -Xbootclasspath/a:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
    Main.java
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   153
Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
    -Xbootclasspath/p:"GooClass${PS}BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
    -Xbootclasspath/a:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
    Main.java
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   157
Success "$java" ${TESTVMOPTS} \
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
    -Xbootclasspath/a:"GooClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
    Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
#----------------------------------------------------------------
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   162
Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   163
    -Xbootclasspath/p:"GooClass" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   164
    -Xbootclasspath:"BadClass${PS}java-lang.jar" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   165
    -Xbootclasspath/a:"GooClass" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   166
    Main.java
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   167
Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   168
    -Xbootclasspath/p:"BadClass" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   169
    -Xbootclasspath:"GooClass${PS}BadClass${PS}java-lang.jar" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   170
    -Xbootclasspath/a:"BadClass" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   171
    Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
#----------------------------------------------------------------
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   174
Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   175
    -endorseddirs "BadClass${PS}GooZip${PS}BadJar" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   176
    -Xbootclasspath:"BadClass${PS}java-lang.jar" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   177
    Main.java
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   178
Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   179
    -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   180
    -Xbootclasspath:"BadClass${PS}java-lang.jar" \
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   181
    Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
#----------------------------------------------------------------
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   184
Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
    -Xbootclasspath/a:"BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
    -extdirs "GooZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
    Main.java
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   188
Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
    -Xbootclasspath/a:"GooClass${PS}BadClass" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
    -extdirs "BadZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
#----------------------------------------------------------------
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   194
Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
    -extdirs "GooClass${PS}BadZip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
    -cp "GooZip/Lib.zip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
    Main.java
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   198
Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    -extdirs "BadClass${PS}GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
    -cp "BadZip/Lib.zip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
    Main.java
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   202
Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} \
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
    -Djava.ext.dirs="GooZip${PS}BadJar" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
    -classpath "BadZip/Lib.zip" \
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
    Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
Failure "$javac" ${TESTTOOLVMOPTS} -classpath "BadClass${PS}GooClass" Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
Success "$javac" ${TESTTOOLVMOPTS} -classpath "GooClass${PS}BadClass" Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
Failure "$java" ${TESTVMOPTS}  -classpath "BadClass${PS}GooClass${PS}." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
Success "$java" ${TESTVMOPTS}  -classpath "GooClass${PS}BadClass${PS}." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
Failure "$javac" ${TESTTOOLVMOPTS} -cp "BadJar/Lib.jar${PS}GooZip/Lib.zip" Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
Success "$javac" ${TESTTOOLVMOPTS} -cp "GooJar/Lib.jar${PS}BadZip/Lib.zip" Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
Failure "$java" ${TESTVMOPTS}  -cp "BadJar/Lib.jar${PS}${PS}GooZip/Lib.zip" Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
Success "$java" ${TESTVMOPTS}  -cp "GooJar/Lib.jar${PS}${PS}BadZip/Lib.zip" Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
Failure env CLASSPATH="BadZip/Lib.zip${PS}GooJar/Lib.jar" "$javac" ${TESTTOOLVMOPTS} Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
Success env CLASSPATH="GooZip/Lib.zip${PS}BadJar/Lib.jar" "$javac" ${TESTTOOLVMOPTS} Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
Failure env CLASSPATH="${PS}BadZip/Lib.zip${PS}GooJar/Lib.jar" "$java" ${TESTVMOPTS} Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
Success env CLASSPATH="${PS}GooZip/Lib.zip${PS}BadJar/Lib.jar" "$java" ${TESTVMOPTS} Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
# Check behavior of empty paths and empty path elements
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
#----------------------------------------------------------------
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
In() { cd "$1"; shift; "$@"; cd ..; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -cp ".." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
In GooClass Failure "$java" ${TESTVMOPTS}  -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
# Unspecified classpath defaults to "."
30071
3564e7eeaead 8079191: remove remaining references to "cp -p" from langtools/test
jjg
parents: 27579
diff changeset
   232
Sys mkdir OneDir; Sys cp Main.java GooClass/Lib.class OneDir/.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
In OneDir Success "$javac" ${TESTTOOLVMOPTS} Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
In OneDir Success "$java" ${TESTVMOPTS}  Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
# Empty classpath elements mean "."
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
In GooClass Success "$javac" ${TESTTOOLVMOPTS} -cp "${PS}.." ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
In GooClass Success "$java" ${TESTVMOPTS}  -cp "${PS}.." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
In GooClass Success "$javac" ${TESTTOOLVMOPTS} -cp "..${PS}" ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
In GooClass Success "$java" ${TESTVMOPTS}  -cp "..${PS}" Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
In GooClass Success "$javac" ${TESTTOOLVMOPTS} -cp "..${PS}${PS}/xyzzy" ../Main.java
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
In GooClass Success "$java" ${TESTVMOPTS}  -cp "..${PS}${PS}/xyzzy" Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
# All other empty path elements are ignored.
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   247
In GooJar Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} -extdirs "" -cp ".." ../Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   249
In GooJar Failure "$javac" -source 8 -targt 8 ${TESTTOOLVMOPTS} -extdirs        "${PS}" -cp ".." ../Main.java
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   250
In GooJar Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} -Djava.ext.dirs="${PS}" -cp ".." ../Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   252
In GooJar Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} -extdirs        "." -cp ".." ../Main.java
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   253
In GooJar Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} -Djava.ext.dirs="." -cp ".." ../Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   255
In GooJar Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS}   -Djava.endorsed.dirs="" -cp ".." ../Main.java
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   256
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   257
In GooJar Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS}   -endorseddirs        "${PS}" -cp ".." ../Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   259
In GooJar Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS}   -Djava.endorsed.dirs="." -cp ".." ../Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   261
In GooClass Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} -Xbootclasspath/p: -cp ".." ../Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   263
In GooClass Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} -Xbootclasspath/p:. -cp ".." ../Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   265
In GooClass Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} -Xbootclasspath:"../java-lang.jar" -cp ".." ../Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   267
In GooClass Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} -Xbootclasspath:"../java-lang.jar${PS}." -cp ".." ../Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   269
In GooClass Failure "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} -Xbootclasspath/a: -cp ".." ../Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
In GooClass Failure "$java" ${TESTVMOPTS}  -Xbootclasspath/a: -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
38517
51a0187f11f6 8149599: Update Minefield test
jjg
parents: 30071
diff changeset
   272
In GooClass Success "$javac" -source 8 -target 8 ${TESTTOOLVMOPTS} -Xbootclasspath/a:. -cp ".." ../Main.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
In GooClass Success "$java" ${TESTVMOPTS}  -Xbootclasspath/a:. -cp ".." Main
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
Cleanup
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
Bottom Line