#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @summary Test classpath wildcards for javac and java -classpath option.
# @bug 6268383
# @run shell/timeout=600 wcMineField.sh
# To run this test manually, simply do ./wcMineField.sh
#----------------------------------------------------------------
set -u
#----------------------------------------------------------------
# Note that, on Windows only, the launcher also includes another
# kind of command-line wildcard expansion, via setargv.obj
# Therefore, on Windows, -classpath "foo/*" is treated differently
# from -classpath ".${PS}foo/*"
#----------------------------------------------------------------
#----------------------------------------------------------------
# Prepare the "Minefield"
#----------------------------------------------------------------
}
echo 'public class Lib {public static void f(){}}' > Lib.java
echo 'public class Lib2 {public static void g(){}}' > Lib2.java
echo 'public class Lib3 {public static void h(){}}' > Lib3.java
echo 'public class Spe1 {public static void f(){}}' > Spe1.java
echo 'public class Spe2 {public static void f(){}}' > Spe2.java
echo 'public class Spe3 {public static void f(){}}' > Spe3.java
echo 'public class Spe4 {public static void f(){}}' > Spe4.java
CheckFiles "SpeJar/Spe,Comma.jar" "SpeJar/Spe;Semi.jar" "SpeSrc/Spe2.java" "SpeSrc/Spe3.java" "SpeSrc/Spe4.java"
CheckFiles "MixJar/mix.jAr" "MixJar/mix2.JAR" "MixJar/mix3.zip" "MixJar/.hiddenjar.jar"
echo 'public class Main1 {public static void main(String[] a) {Lib2.g();}}' > Main1.java
echo 'public class Main1b {public static void main(String[] a) {Spe1.f();}}' > Main1b.java
echo 'public class Main2 {public static void main(String[] a) {Spe2.f();}}' > Main2.java
echo 'public class Main3 {public static void main(String[] a) {Spe3.f();}}' > Main3.java
echo 'public class Main4 {public static void main(String[] a) {Spe4.f();}}' > Main4.java
echo 'public class Main5 {public static void main(String[] a) {Spe2.f(); Lib.f();}}' > Main5.java
echo 'public class Main6 {public static void main(String[] a) {Lib3.h();}}' > Main6.java
#----------------------------------------------------------------
# Verify expected behaviour with directory named "*"
#----------------------------------------------------------------
printf "Running tests with directory named \"*\"\n"
Sys cp "GooClass/Lib2.class" "StarDir/*/Lib2.class"
Sys rm -f "./Lib.class" "./Lib3.class"
CheckFiles "StarDir/*/Lib.jar" "StarDir/*/Lib2.class" "StarDir/Lib3.jar"
Sys cp Main6.java ./StarDir/.
CPWC_DIR=`pwd`
Sys cd "*"
}
#----------------------------------------------------------------
# Verify the basic jar file works
#----------------------------------------------------------------
#baseline test to verify it works.
#basic test of one jar to be loaded
#in a subdir. First * should not load jars in subdirectories unless specified
#Same with launcher. Should not load jar in subdirectories unless specified
#----------------------------------------------------------------
# Verify the jar files in 2 directories
#----------------------------------------------------------------
#----------------------------------------------------------------
# Verify jar file and class file in same directory.
#----------------------------------------------------------------
#----------------------------------------------------------------
# Verify these odd jar files work explicitly on classpath, kind of
# a baseline. Last one is also a test with * in a jar name.
#----------------------------------------------------------------
#----------------------------------------------------------------
# Verify these odd jar files work with classpath wildcard.
#----------------------------------------------------------------
printf "Running tests with jar file names containing special characters\n"
# Failure "$javac" ${TESTTOOLVMOPTS} -classpath "SpeJar/*" Main1.java
# Success "$java" ${TESTVMOPTS} -classpath "SpeJar/*" Main1
}
#----------------------------------------------------------------
# Verify these jar files with asterisk in jar file name
#----------------------------------------------------------------
printf "Running tests with jar file names containing \"*\"\n"
}
#----------------------------------------------------------------
# Verify these jar files with varying extensions
#----------------------------------------------------------------
# Mixed case extensions should not be loaded.
#upper case, .JAR, extension should be loaded
# zip extensions should not be loaded
# unix "hidden" file
#----------------------------------------------------------------