jdk/test/tools/launcher/MultipleJRE.sh
author simonis
Fri, 17 Jan 2014 21:54:30 +0100
changeset 22602 0d9a07b0d7e9
parent 17933 b18cda672b79
child 27938 7f7f8bf64dd7
permissions -rw-r--r--
8028537: PPC64: Updated the JDK regression tests to run on AIX Reviewed-by: alanb Contributed-by: luchsh@linux.vnet.ibm.com, spoole@linux.vnet.ibm.com, volker.simonis@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17933
b18cda672b79 8014834: shell tests don't begin with #!/bin/sh
emc
parents: 15254
diff changeset
     1
#!/bin/sh
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
# @test MultipleJRE.sh
2598
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
     3
# @bug 4811102 4953711 4955505 4956301 4991229 4998210 5018605 6387069 6733959
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
# @build PrintVersion
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# @build UglyPrintVersion
2598
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
     6
# @build ZipMeUp
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# @run shell MultipleJRE.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# @summary Verify Multiple JRE version support
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# @author Joseph E. Kowalski
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2598
diff changeset
    12
# Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2598
diff changeset
    29
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2598
diff changeset
    30
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2598
diff changeset
    31
# questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
# Verify directory context variables are set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
if [ "${TESTJAVA}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
  echo "TESTJAVA not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    41
if [ "${COMPILEJAVA}" = "" ]; then
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    42
  COMPILEJAVA="${TESTJAVA}"
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    43
fi
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    44
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
if [ "${TESTSRC}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
  echo "TESTSRC not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
if [ "${TESTCLASSES}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
14786
a9f61e0cbe61 8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents: 5506
diff changeset
    57
JAVAEXE="$TESTJAVA/bin/java ${TESTVMOPTS}"
a9f61e0cbe61 8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents: 5506
diff changeset
    58
JAVA="$TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES"
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    59
JAR="$COMPILEJAVA/bin/jar ${TESTTOOLVMOPTS}"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
OS=`uname -s`;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
#
2598
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    63
# Tests whether we are on windows (true) or not.
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    64
#
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    65
IsWindows() {
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    66
    case "$OS" in
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    67
        Windows* | CYGWIN* )
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    68
            printf "true"
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    69
	;;
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    70
	* )
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    71
            printf "false"
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    72
	;;
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    73
    esac
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    74
}
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    75
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
    76
#
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
# Shell routine to test for the proper rejection of syntactically incorrect
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
# version specifications.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
TestSyntax() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
	mess="`$JAVA -version:\"$1\" -version 2>&1`"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
	if [ $? -eq 0 ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
		echo "Invalid version syntax $1 accepted"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
		exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
	prefix="`echo "$mess" | cut -d ' ' -f 1-3`"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
	if [ "$prefix" != "Error: Syntax error" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
		echo "Unexpected error message for invalid syntax $1"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
		exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
# Just as the name says.  We sprinkle these in the appropriate location
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
# in the test file system and they just say who they are pretending to be.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
CreateMockVM() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
	mkdir -p jdk/j2re$1/bin
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
	echo "#!/bin/sh"    > jdk/j2re$1/bin/java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
	echo "echo \"$1\"" >> jdk/j2re$1/bin/java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
	chmod +x jdk/j2re$1/bin/java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
# Constructs the jar file needed by these tests.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
CreateJar() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
	mkdir -p META-INF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
	echo "Manifest-Version: 1.0" > META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
	echo "Main-Class: PrintVersion" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
	if [ "$1" != "" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
		echo "JRE-Version: $1" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
	cp $TESTCLASSES/PrintVersion.class .
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
	$JAR $2cmf META-INF/MANIFEST.MF PrintVersion PrintVersion.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
# Constructs a jar file using zip.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
CreateZippyJar() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
	mkdir -p META-INF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
	echo "Manifest-Version: 1.0" > META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
	echo "Main-Class: PrintVersion" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
	if [ "$1" != "" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
		echo "JRE-Version: $1" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
	cp $TESTCLASSES/PrintVersion.class .
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
	/usr/bin/zip $2 PrintVersion META-INF/MANIFEST.MF PrintVersion.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
# Constructs a jar file with a Main-Class attribute of greater than
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
# 80 characters to validate the continuation line processing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
# Make this just long enough to require two continuation lines.  Longer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
# paths take too much away from the restricted Windows maximum path length.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
# Note: see the variable UGLYCLASS and its check for path length.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
# Make sure that 5018605 remains fixed by including additional sections
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
# in the Manifest which contain the same names as those allowed in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
# main section.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
PACKAGE=reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylongpackagename
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
UGLYCLASS=$TESTCLASSES/$PACKAGE/UglyPrintVersion.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
CreateUglyJar() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
	mkdir -p META-INF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
	echo "Manifest-Version: 1.0" > META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
	echo "Main-Class: $PACKAGE.UglyPrintVersion" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
	if [ "$1" != "" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
		echo "JRE-Version: $1" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
	echo "" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
	echo "Name: NotToBeFound.class" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
	echo "Main-Class: NotToBeFound" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
	mkdir -p $PACKAGE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
	cp $UGLYCLASS $PACKAGE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
	$JAR $2cmf META-INF/MANIFEST.MF PrintVersion \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
	    $PACKAGE/UglyPrintVersion.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
# Constructs a jar file with a fair number of "zip directory" entries and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
# the MANIFEST.MF entry at or near the end of that directory to validate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
# the ability to transverse that directory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
CreateFullJar() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
	mkdir -p META-INF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
	echo "Manifest-Version: 1.0" > META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
	echo "Main-Class: PrintVersion" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
	if [ "$1" != "" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
	    echo "JRE-Version: $1" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
	cp $TESTCLASSES/PrintVersion.class .
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
	for i in 0 1 2 3 4 5 6 7 8 9 ; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
		for j in 0 1 2 3 4 5 6 7 8 9 ; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
			touch AfairlyLongNameEatsUpDirectorySpaceBetter$i$j
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
		done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
	done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
	$JAR $2cMf PrintVersion PrintVersion.class AfairlyLong*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
	$JAR $2umf META-INF/MANIFEST.MF PrintVersion
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
	rm -f AfairlyLong*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
# Creates a jar file with the attributes which caused the failure
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
# described in 4991229.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
# Generate a bunch of CENTAB entries, each of which is 64 bytes long
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
# which practically guarentees we will hit the appropriate power of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
# two buffer (initially 1K).  Note that due to the perversity of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
# zip/jar files, the first entry gets extra stuff so it needs a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
# shorter name to compensate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
CreateAlignedJar() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
	mkdir -p META-INF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
	echo "Manifest-Version: 1.0" > META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
	echo "Main-Class: PrintVersion" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
	if [ "$1" != "" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
	    echo "JRE-Version: $1" >> META-INF/MANIFEST.MF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
	cp $TESTCLASSES/PrintVersion.class .
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
	touch 57BytesSpecial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
	for i in 0 1 2 3 4 5 6 7 8 9 ; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
		for j in 0 1 2 3 4 5 6 7 8 9 ; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
			touch 64BytesPerEntry-$i$j
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
		done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
	done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
	$JAR $2cMf PrintVersion 57* 64* PrintVersion.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
	$JAR $2umf META-INF/MANIFEST.MF PrintVersion
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
	rm -f 57* 64*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
# Adds comments to a jar/zip file.  This serves two purposes:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
#   1)	Make sure zip file comments (both per file and per archive) are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
#	properly processed and ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
#   2)	A long file comment creates a mondo "Central Directory" entry in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
#	the zip file. Such a "mondo" entry could also be due to a very
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
#	long file name (path) or a long "Ext" entry, but adding the long
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
#	comment is the easiest way.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
CommentZipFile() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    file=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    tail="is designed to take up space - lots and lots of space."
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    mv PrintVersion PrintVersion.zip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    /usr/bin/zipnote PrintVersion.zip > zipout
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    while read ampersand line; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
	if [ "$ampersand" = "@" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
	    if [ "$line" = "(comment above this line)" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
		echo "File Comment Line." >> zipin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
		if [ "$file" = "$1" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
		    for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
			for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
			    echo "Mondo comment line $i$j $tail" >> zipin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
			done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
		    done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
		fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
	    else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
		file=$line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
	    fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
	echo "$ampersand $line" >> zipin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
	if [ "$ampersand" = "@" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
	    if [ "$line" = "(zip file comment below this line)" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
		echo "Zip File Comment Line number 1" >> zipin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
		echo "Zip File Comment Line number 2" >> zipin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
	    fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    done < zipout
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    /usr/bin/zipnote -w PrintVersion.zip < zipin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    mv PrintVersion.zip PrintVersion
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    rm zipout zipin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
# Attempt to launch a vm using a version specifier and make sure the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
# resultant launch (probably a "mock vm") is appropriate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
LaunchVM() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
	if [ "$1" != "" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
		mess="`$JAVA -version:\"$1\" -jar PrintVersion 2>&1`"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
	else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
		mess="`$JAVA -jar PrintVersion 2>&1`"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
	if [ $? -ne 0 ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
		prefix=`echo "$mess" | cut -d ' ' -f 1-3`
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
		if [ "$prefix" != "Unable to locate" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
			echo "$mess"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
			exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
		fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
		echo "Unexpected error in attempting to locate $1"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
		exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
	echo $mess | grep "$2" > /dev/null 2>&1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
	if [ $? != 0 ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
	    echo "Launched $mess, expected $2"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
	    exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
2598
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   284
# Tests very long Main-Class attribute in the jar
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   285
TestLongMainClass() {
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   286
    JVER=$1
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   287
    if [ "$JVER" = "mklink" ]; then
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   288
        JVER=XX
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   289
        JDKXX=jdk/j2re$JVER
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   290
        rm -rf jdk
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   291
        mkdir jdk
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   292
        ln -s $TESTJAVA $JDKXX
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   293
        JAVA_VERSION_PATH="`pwd`/jdk"
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   294
        export JAVA_VERSION_PATH
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   295
    fi
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   296
    $JAVAEXE -cp $TESTCLASSES ZipMeUp UglyBetty.jar 4097 
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   297
    message="`$JAVAEXE -version:$JVER -jar UglyBetty.jar 2>&1`"
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   298
    echo $message | grep "Error: main-class: attribute exceeds system limits" > /dev/null 2>&1
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   299
    if [ $? -ne 0 ]; then
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   300
        printf "Long manifest test did not get expected error"
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   301
        exit 1
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   302
    fi
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   303
    unset JAVA_VERSION_PATH
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   304
    rm -rf jdk
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   305
}
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   306
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
# Main test sequence starts here
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
RELEASE=`$JAVA -version 2>&1 | head -n 1 | cut -d ' ' -f 3 | \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
  sed -e "s/\"//g"`
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
BASE_RELEASE=`echo $RELEASE | sed -e "s/-.*//g"`
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
# Make sure that the generic jar/manifest reading code works. Test both
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
# compressed and "stored" jar files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
# The "Ugly" jar (long manifest line) tests are only run if the combination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
# of the file name length restrictions and the length of the cwd allow it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
CreateJar "" ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
LaunchVM "" "${RELEASE}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
CreateJar "" "0"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
LaunchVM "" "${RELEASE}"
2598
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   325
if [ `IsWindows` = "true" ]; then
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   326
    MAXIMUM_PATH=255;
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   327
else
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   328
    MAXIMUM_PATH=1024;
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   329
fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
PATH_LENGTH=`printf "%s" "$UGLYCLASS" | wc -c`
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
if [ ${PATH_LENGTH} -lt ${MAXIMUM_PATH} ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
	CreateUglyJar "" ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
	LaunchVM "" "${RELEASE}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
	CreateUglyJar "" "0"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
	LaunchVM "" "${RELEASE}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    printf "Warning: Skipped UglyJar test, path length exceeded, %d" $MAXIMUM_PATH
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    printf " allowed, the current path is %d\n" $PATH_LENGTH
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
CreateAlignedJar "" ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
LaunchVM "" "${RELEASE}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
CreateFullJar "" ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
LaunchVM "" "${RELEASE}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
# 4998210 shows that some very strange behaviors are semi-supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
# In this case, it's the ability to prepend any kind of stuff to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
# jar file and require that the jar file still work.  Note that this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
# "interface" isn't publically supported and we may choose to break
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
# it in the future, but this test guarantees that we won't break it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
# without informed consent. We take advantage the fact that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
# "FullJar" we just tested is probably the best jar to begin with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
# for this test.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
echo "This is just meaningless bytes to prepend to the jar" > meaningless
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
mv PrintVersion meaningfull
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
cat meaningless meaningfull > PrintVersion
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
LaunchVM "" "${RELEASE}" 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
rm meaningless meaningfull
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
# Officially, one must use "the jar command to create a jar file.  However,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
# all the comments about jar commands **imply** that jar files and zip files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
# are equivalent.  (Note: this isn't true due to the "0xcafe" insertion.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
# On systems which have a command line zip, test the ability to use zip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
# to construct a jar and then use it (6387069).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
if [ -x /usr/bin/zip ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
	CreateZippyJar "" "-q"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
	LaunchVM "" "${RELEASE}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
# jar files shouldn't have comments, but it is possible that somebody added
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
# one by using zip -c, zip -z, zipnote or a similar utility.  On systems
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
# that have "zipnote", verify this functionality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
# This serves a dual purpose of creating a very large "central directory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
# entry" which validates to code to read such entries.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
if [ -x /usr/bin/zipnote ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
	CreateFullJar "" ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
	CommentZipFile "AfairlyLongNameEatsUpDirectorySpaceBetter20"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
	LaunchVM "" "${RELEASE}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
# Throw some syntactically challenged (illegal) version specifiers at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
# the interface.  Failure (of the launcher) is success for the test.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
TestSyntax "1.2..3"				# Two adjacent separators
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
TestSyntax "_1.2.3"				# Begins with a separator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
TestSyntax "1.2.3-"				# Ends with a separator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
TestSyntax "1.2+.3"				# Embedded modifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
TestSyntax "1.2.4+&1.2*&1++"			# Long and invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
2598
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   398
# On windows we see if there is another jre installed, usually
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   399
# there is, then we test using that, otherwise links are created
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   400
# to get through to SelectVersion.
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   401
if [ `IsWindows` = "false" ]; then
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   402
   TestLongMainClass "mklink"
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   403
else
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   404
    $JAVAEXE -version:1.0+
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   405
    if [ $? -eq 0 ]; then
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   406
        TestLongMainClass "1.0+"
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   407
    else
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   408
        printf  "Warning: TestLongMainClass skipped as there is no"
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   409
	printf  "viable MJRE installed.\n"
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   410
    fi
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   411
fi
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   412
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
# Because scribbling in the registry can be rather destructive, only a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
# subset of the tests are run on Windows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
#
2598
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   417
if [ `IsWindows` = "true" ]; then
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   418
    exit 0;
6f980e1d6e31 6733959: Insufficient checks for "Main-Class" manifest entry in JAR files
ksrini
parents: 2
diff changeset
   419
fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
# Additional version specifiers containing spaces.  (Sigh, unable to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
# figure out the glomming on Windows)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
TestSyntax "1.2.3_99 1.3.2+ 1.2.4+&1.2*&1++"	# Long and invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
# Create a mock installation of a number of shell scripts named as though
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
# they were installed JREs.  Then test to see if the launcher can cause
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
# the right shell scripts to be invoked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
# Note, that as a side effect, this test verifies that JAVA_VERSION_PATH
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
# works.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
rm -rf jdk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
JAVA_VERSION_PATH="`pwd`/jdk"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
export JAVA_VERSION_PATH
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
CreateMockVM 1.10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
CreateMockVM 1.11.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
CreateMockVM 1.11.3_03
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
CreateMockVM 1.11.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
CreateMockVM 1.12.3_03
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
CreateMockVM 1.12.3_03-lastweek
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
CreateMockVM 1.13.3_03
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
CreateMockVM 1.13.3_03-lastweek
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
CreateMockVM 1.13.3_03_lastweek
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
CreateMockVM 1.20.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
# Test extracting the version information from the jar file:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
#	  Requested		Expected
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
CreateJar "1.10+" ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
LaunchVM  ""			"1.20.0"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
CreateJar "1.11.3_03+&1.11*" ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
LaunchVM  ""			"1.11.4"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
CreateJar "1.12.3_03+&1.12.3*" ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
LaunchVM  ""			"1.12.3_03"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
CreateJar "1.13.3_03+&1.13.3*" ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
LaunchVM  ""			"1.13.3_03_lastweek"	# Strange but true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
# Test obtaining the version information from the command line (and that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
# it overrides the manifest).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
CreateJar "${BASERELEASE}*" ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
LaunchVM  "1.10+"		"1.20.0"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
LaunchVM  "1.11.3_03+&1.11*"	"1.11.4"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
LaunchVM  "1.12.3_03+&1.12.3*"	"1.12.3_03"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
LaunchVM  "1.13.3_03+&1.13.3*"	"1.13.3_03_lastweek"	# Strange but true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
[ -d jdk ] && rm -rf jdk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
[ -d META_INF ] && rm -rf META_INF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
exit 0