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