jdk/test/tools/launcher/MultipleJRE.sh
changeset 27938 7f7f8bf64dd7
parent 17933 b18cda672b79
child 28109 c510e26fcd55
equal deleted inserted replaced
27937:0c9f63e42e91 27938:7f7f8bf64dd7
     3 # @bug 4811102 4953711 4955505 4956301 4991229 4998210 5018605 6387069 6733959
     3 # @bug 4811102 4953711 4955505 4956301 4991229 4998210 5018605 6387069 6733959
     4 # @build PrintVersion
     4 # @build PrintVersion
     5 # @build UglyPrintVersion
     5 # @build UglyPrintVersion
     6 # @build ZipMeUp
     6 # @build ZipMeUp
     7 # @run shell MultipleJRE.sh
     7 # @run shell MultipleJRE.sh
     8 # @summary Verify Multiple JRE version support
     8 # @summary Verify Multiple JRE version support has been removed
     9 # @author Joseph E. Kowalski
     9 # @author Joseph E. Kowalski
    10 
    10 
    11 #
    11 #
    12 # Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
    12 # Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
    13 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   220 #   2)	A long file comment creates a mondo "Central Directory" entry in
   220 #   2)	A long file comment creates a mondo "Central Directory" entry in
   221 #	the zip file. Such a "mondo" entry could also be due to a very
   221 #	the zip file. Such a "mondo" entry could also be due to a very
   222 #	long file name (path) or a long "Ext" entry, but adding the long
   222 #	long file name (path) or a long "Ext" entry, but adding the long
   223 #	comment is the easiest way.
   223 #	comment is the easiest way.
   224 #
   224 #
       
   225 MONDO=" Mondo comment line 00 is designed to take up space - lots and lots of space.  Mondo comment line 01 is designed to take up space - lots and lots of space.  Mondo comment line 02 is designed to take up space - lots and lots of space.  Mondo comment line 03 is designed to take up space - lots and lots of space.  Mondo comment line 04 is designed to take up space - lots and lots of space.  Mondo comment line 05 is designed to take up space - lots and lots of space.  Mondo comment line 06 is designed to take up space - lots and lots of space.  Mondo comment line 07 is designed to take up space - lots and lots of space.  Mondo comment line 08 is designed to take up space - lots and lots of space.  Mondo comment line 09 is designed to take up space - lots and lots of space.  Mondo comment line 0a is designed to take up space - lots and lots of space.  Mondo comment line 0b is designed to take up space - lots and lots of space.  Mondo comment line 0c is designed to take up space - lots and lots of space.  Mondo comment line 0d is designed to take up space - lots and lots of space.  Mondo comment line 0e is designed to take up space - lots and lots of space.  Mondo comment line 0f is designed to take up space - lots and lots of space.  Mondo comment line 10 is designed to take up space - lots and lots of space.  Mondo comment line 11 is designed to take up space - lots and lots of space.  Mondo comment line 12 is designed to take up space - lots and lots of space.  Mondo comment line 13 is designed to take up space - lots and lots of space.  Mondo comment line 14 is designed to take up space - lots and lots of space.  Mondo comment line 15 is designed to take up space - lots and lots of space.  Mondo comment line 16 is designed to take up space - lots and lots of space.  Mondo comment line 17 is designed to take up space - lots and lots of space.  Mondo comment line 18 is designed to take up space - lots and lots of space.  Mondo comment line 19 is designed to take up space - lots and lots of space.  Mondo comment line 1a is designed to take up space - lots and lots of space.  Mondo comment line 1b is designed to take up space - lots and lots of space.  Mondo comment line 1c is designed to take up space - lots and lots of space.  Mondo comment line 1d is designed to take up space - lots and lots of space.  Mondo comment line 1e is designed to take up space - lots and lots of space.  Mondo comment line 1f is designed to take up space - lots and lots of space.  Mondo comment line 20 is designed to take up space - lots and lots of space.  Mondo comment line 21 is designed to take up space - lots and lots of space.  Mondo comment line 22 is designed to take up space - lots and lots of space.  Mondo comment line 23 is designed to take up space - lots and lots of space.  Mondo comment line 24 is designed to take up space - lots and lots of space.  Mondo comment line 25 is designed to take up space - lots and lots of space.  Mondo comment line 26 is designed to take up space - lots and lots of space.  Mondo comment line 27 is designed to take up space - lots and lots of space.  Mondo comment line 28 is designed to take up space - lots and lots of space.  Mondo comment line 29 is designed to take up space - lots and lots of space.  Mondo comment line 2a is designed to take up space - lots and lots of space.  Mondo comment line 2b is designed to take up space - lots and lots of space.  Mondo comment line 2c is designed to take up space - lots and lots of space.  Mondo comment line 2d is designed to take up space - lots and lots of space.  Mondo comment line 2e is designed to take up space - lots and lots of space.  Mondo comment line 2f is designed to take up space - lots and lots of space.  Mondo comment line 30 is designed to take up space - lots and lots of space.  Mondo comment line 31 is designed to take up space - lots and lots of space.  Mondo comment line 32 is designed to take up space - lots and lots of space.  Mondo comment line 33 is designed to take up space - lots and lots of space.  Mondo comment line 34 is designed to take up space - lots and lots of space.  Mondo comment line 35 is designed to take up space - lots and lots of space.  Mondo comment line 36 is designed to take up space - lots and lots of space.  Mondo comment line 37 is designed to take up space - lots and lots of space.  Mondo comment line 38 is designed to take up space - lots and lots of space.  Mondo comment line 39 is designed to take up space - lots and lots of space.  Mondo comment line 3a is designed to take up space - lots and lots of space.  Mondo comment line 3b is designed to take up space - lots and lots of space.  Mondo comment line 3c is designed to take up space - lots and lots of space.  Mondo comment line 3d is designed to take up space - lots and lots of space.  Mondo comment line 3e is designed to take up space - lots and lots of space.  Mondo comment line 3f is designed to take up space - lots and lots of space.  Mondo comment line 40 is designed to take up space - lots and lots of space.  Mondo comment line 41 is designed to take up space - lots and lots of space.  Mondo comment line 42 is designed to take up space - lots and lots of space.  Mondo comment line 43 is designed to take up space - lots and lots of space.  Mondo comment line 44 is designed to take up space - lots and lots of space.  Mondo comment line 45 is designed to take up space - lots and lots of space.  Mondo comment line 46 is designed to take up space - lots and lots of space.  Mondo comment line 47 is designed to take up space - lots and lots of space.  Mondo comment line 48 is designed to take up space - lots and lots of space.  Mondo comment line 49 is designed to take up space - lots and lots of space.  Mondo comment line 4a is designed to take up space - lots and lots of space.  Mondo comment line 4b is designed to take up space - lots and lots of space.  Mondo comment line 4c is designed to take up space - lots and lots of space.  Mondo comment line 4d is designed to take up space - lots and lots of space.  Mondo comment line 4e is designed to take up space - lots and lots of space.  Mondo comment line 4f is designed to take up space - lots and lots of space.  Mondo comment line 50 is designed to take up space - lots and lots of space.  Mondo comment line 51 is designed to take up space - lots and lots of space.  Mondo comment line 52 is designed to take up space - lots and lots of space.  Mondo comment line 53 is designed to take up space - lots and lots of space.  Mondo comment line 54 is designed to take up space - lots and lots of space.  Mondo comment line 55 is designed to take up space - lots and lots of space.  Mondo comment line 56 is designed to take up space - lots and lots of space.  Mondo comment line 57 is designed to take up space - lots and lots of space.  Mondo comment line 58 is designed to take up space - lots and lots of space.  Mondo comment line 59 is designed to take up space - lots and lots of space.  Mondo comment line 5a is designed to take up space - lots and lots of space.  Mondo comment line 5b is designed to take up space - lots and lots of space.  Mondo comment line 5c is designed to take up space - lots and lots of space.  Mondo comment line 5d is designed to take up space - lots and lots of space.  Mondo comment line 5e is designed to take up space - lots and lots of space.  Mondo comment line 5f is designed to take up space - lots and lots of space.  Mondo comment line 60 is designed to take up space - lots and lots of space.  Mondo comment line 61 is designed to take up space - lots and lots of space.  Mondo comment line 62 is designed to take up space - lots and lots of space.  Mondo comment line 63 is designed to take up space - lots and lots of space.  Mondo comment line 64 is designed to take up space - lots and lots of space.  Mondo comment line 65 is designed to take up space - lots and lots of space.  Mondo comment line 66 is designed to take up space - lots and lots of space.  Mondo comment line 67 is designed to take up space - lots and lots of space.  Mondo comment line 68 is designed to take up space - lots and lots of space.  Mondo comment line 69 is designed to take up space - lots and lots of space.  Mondo comment line 6a is designed to take up space - lots and lots of space.  Mondo comment line 6b is designed to take up space - lots and lots of space.  Mondo comment line 6c is designed to take up space - lots and lots of space.  Mondo comment line 6d is designed to take up space - lots and lots of space.  Mondo comment line 6e is designed to take up space - lots and lots of space.  Mondo comment line 6f is designed to take up space - lots and lots of space.  Mondo comment line 70 is designed to take up space - lots and lots of space.  Mondo comment line 71 is designed to take up space - lots and lots of space.  Mondo comment line 72 is designed to take up space - lots and lots of space.  Mondo comment line 73 is designed to take up space - lots and lots of space.  Mondo comment line 74 is designed to take up space - lots and lots of space.  Mondo comment line 75 is designed to take up space - lots and lots of space.  Mondo comment line 76 is designed to take up space - lots and lots of space.  Mondo comment line 77 is designed to take up space - lots and lots of space.  Mondo comment line 78 is designed to take up space - lots and lots of space.  Mondo comment line 79 is designed to take up space - lots and lots of space.  Mondo comment line 7a is designed to take up space - lots and lots of space.  Mondo comment line 7b is designed to take up space - lots and lots of space.  Mondo comment line 7c is designed to take up space - lots and lots of space.  Mondo comment line 7d is designed to take up space - lots and lots of space.  Mondo comment line 7e is designed to take up space - lots and lots of space.  Mondo comment line 7f is designed to take up space - lots and lots of space.  Mondo comment line 80 is designed to take up space - lots and lots of space.  Mondo comment line 81 is designed to take up space - lots and lots of space.  Mondo comment line 82 is designed to take up space - lots and lots of space.  Mondo comment line 83 is designed to take up space - lots and lots of space.  Mondo comment line 84 is designed to take up space - lots and lots of space.  Mondo comment line 85 is designed to take up space - lots and lots of space.  Mondo comment line 86 is designed to take up space - lots and lots of space.  Mondo comment line 87 is designed to take up space - lots and lots of space.  Mondo comment line 88 is designed to take up space - lots and lots of space.  Mondo comment line 89 is designed to take up space - lots and lots of space.  Mondo comment line 8a is designed to take up space - lots and lots of space.  Mondo comment line 8b is designed to take up space - lots and lots of space.  Mondo comment line 8c is designed to take up space - lots and lots of space.  Mondo comment line 8d is designed to take up space - lots and lots of space.  Mondo comment line 8e is designed to take up space - lots and lots of space.  Mondo comment line 8f is designed to take up space - lots and lots of space.  Mondo comment line 90 is designed to take up space - lots and lots of space.  Mondo comment line 91 is designed to take up space - lots and lots of space.  Mondo comment line 92 is designed to take up space - lots and lots of space.  Mondo comment line 93 is designed to take up space - lots and lots of space.  Mondo comment line 94 is designed to take up space - lots and lots of space.  Mondo comment line 95 is designed to take up space - lots and lots of space.  Mondo comment line 96 is designed to take up space - lots and lots of space.  Mondo comment line 97 is designed to take up space - lots and lots of space.  Mondo comment line 98 is designed to take up space - lots and lots of space.  Mondo comment line 99 is designed to take up space - lots and lots of space.  Mondo comment line 9a is designed to take up space - lots and lots of space.  Mondo comment line 9b is designed to take up space - lots and lots of space.  Mondo comment line 9c is designed to take up space - lots and lots of space.  Mondo comment line 9d is designed to take up space - lots and lots of space.  Mondo comment line 9e is designed to take up space - lots and lots of space.  Mondo comment line 9f is designed to take up space - lots and lots of space.  Mondo comment line a0 is designed to take up space - lots and lots of space.  Mondo comment line a1 is designed to take up space - lots and lots of space.  Mondo comment line a2 is designed to take up space - lots and lots of space.  Mondo comment line a3 is designed to take up space - lots and lots of space.  Mondo comment line a4 is designed to take up space - lots and lots of space.  Mondo comment line a5 is designed to take up space - lots and lots of space.  Mondo comment line a6 is designed to take up space - lots and lots of space.  Mondo comment line a7 is designed to take up space - lots and lots of space.  Mondo comment line a8 is designed to take up space - lots and lots of space.  Mondo comment line a9 is designed to take up space - lots and lots of space.  Mondo comment line aa is designed to take up space - lots and lots of space.  Mondo comment line ab is designed to take up space - lots and lots of space.  Mondo comment line ac is designed to take up space - lots and lots of space.  Mondo comment line ad is designed to take up space - lots and lots of space.  Mondo comment line ae is designed to take up space - lots and lots of space.  Mondo comment line af is designed to take up space - lots and lots of space.  Mondo comment line b0 is designed to take up space - lots and lots of space.  Mondo comment line b1 is designed to take up space - lots and lots of space.  Mondo comment line b2 is designed to take up space - lots and lots of space.  Mondo comment line b3 is designed to take up space - lots and lots of space.  Mondo comment line b4 is designed to take up space - lots and lots of space.  Mondo comment line b5 is designed to take up space - lots and lots of space.  Mondo comment line b6 is designed to take up space - lots and lots of space.  Mondo comment line b7 is designed to take up space - lots and lots of space.  Mondo comment line b8 is designed to take up space - lots and lots of space.  Mondo comment line b9 is designed to take up space - lots and lots of space.  Mondo comment line ba is designed to take up space - lots and lots of space.  Mondo comment line bb is designed to take up space - lots and lots of space.  Mondo comment line bc is designed to take up space - lots and lots of space.  Mondo comment line bd is designed to take up space - lots and lots of space.  Mondo comment line be is designed to take up space - lots and lots of space.  Mondo comment line bf is designed to take up space - lots and lots of space.  Mondo comment line c0 is designed to take up space - lots and lots of space.  Mondo comment line c1 is designed to take up space - lots and lots of space.  Mondo comment line c2 is designed to take up space - lots and lots of space.  Mondo comment line c3 is designed to take up space - lots and lots of space.  Mondo comment line c4 is designed to take up space - lots and lots of space.  Mondo comment line c5 is designed to take up space - lots and lots of space.  Mondo comment line c6 is designed to take up space - lots and lots of space.  Mondo comment line c7 is designed to take up space - lots and lots of space.  Mondo comment line c8 is designed to take up space - lots and lots of space.  Mondo comment line c9 is designed to take up space - lots and lots of space.  Mondo comment line ca is designed to take up space - lots and lots of space.  Mondo comment line cb is designed to take up space - lots and lots of space.  Mondo comment line cc is designed to take up space - lots and lots of space.  Mondo comment line cd is designed to take up space - lots and lots of space.  Mondo comment line ce is designed to take up space - lots and lots of space.  Mondo comment line cf is designed to take up space - lots and lots of space.  Mondo comment line d0 is designed to take up space - lots and lots of space.  Mondo comment line d1 is designed to take up space - lots and lots of space.  Mondo comment line d2 is designed to take up space - lots and lots of space.  Mondo comment line d3 is designed to take up space - lots and lots of space.  Mondo comment line d4 is designed to take up space - lots and lots of space.  Mondo comment line d5 is designed to take up space - lots and lots of space.  Mondo comment line d6 is designed to take up space - lots and lots of space.  Mondo comment line d7 is designed to take up space - lots and lots of space.  Mondo comment line d8 is designed to take up space - lots and lots of space.  Mondo comment line d9 is designed to take up space - lots and lots of space.  Mondo comment line da is designed to take up space - lots and lots of space.  Mondo comment line db is designed to take up space - lots and lots of space.  Mondo comment line dc is designed to take up space - lots and lots of space.  Mondo comment line dd is designed to take up space - lots and lots of space.  Mondo comment line de is designed to take up space - lots and lots of space.  Mondo comment line df is designed to take up space - lots and lots of space.  Mondo comment line e0 is designed to take up space - lots and lots of space.  Mondo comment line e1 is designed to take up space - lots and lots of space.  Mondo comment line e2 is designed to take up space - lots and lots of space.  Mondo comment line e3 is designed to take up space - lots and lots of space.  Mondo comment line e4 is designed to take up space - lots and lots of space.  Mondo comment line e5 is designed to take up space - lots and lots of space.  Mondo comment line e6 is designed to take up space - lots and lots of space.  Mondo comment line e7 is designed to take up space - lots and lots of space.  Mondo comment line e8 is designed to take up space - lots and lots of space.  Mondo comment line e9 is designed to take up space - lots and lots of space.  Mondo comment line ea is designed to take up space - lots and lots of space.  Mondo comment line eb is designed to take up space - lots and lots of space.  Mondo comment line ec is designed to take up space - lots and lots of space.  Mondo comment line ed is designed to take up space - lots and lots of space.  Mondo comment line ee is designed to take up space - lots and lots of space.  Mondo comment line ef is designed to take up space - lots and lots of space.  Mondo comment line f0 is designed to take up space - lots and lots of space.  Mondo comment line f1 is designed to take up space - lots and lots of space.  Mondo comment line f2 is designed to take up space - lots and lots of space.  Mondo comment line f3 is designed to take up space - lots and lots of space.  Mondo comment line f4 is designed to take up space - lots and lots of space.  Mondo comment line f5 is designed to take up space - lots and lots of space.  Mondo comment line f6 is designed to take up space - lots and lots of space.  Mondo comment line f7 is designed to take up space - lots and lots of space.  Mondo comment line f8 is designed to take up space - lots and lots of space.  Mondo comment line f9 is designed to take up space - lots and lots of space.  Mondo comment line fa is designed to take up space - lots and lots of space.  Mondo comment line fb is designed to take up space - lots and lots of space.  Mondo comment line fc is designed to take up space - lots and lots of space.  Mondo comment line fd is designed to take up space - lots and lots of space.  Mondo comment line fe is designed to take up space - lots and lots of space.  Mondo comment line ff is designed to take up space - lots and lots of space."
   225 CommentZipFile() {
   226 CommentZipFile() {
   226     file=
   227 	mkdir -p META-INF
   227     tail="is designed to take up space - lots and lots of space."
   228 	echo "Manifest-Version: 1.0" > META-INF/MANIFEST.MF
   228     mv PrintVersion PrintVersion.zip
   229 	echo "Main-Class: PrintVersion" >> META-INF/MANIFEST.MF
   229     /usr/bin/zipnote PrintVersion.zip > zipout
   230 	if [ "$1" != "" ]; then
   230     while read ampersand line; do
   231 	    echo "JRE-Version: $1" >> META-INF/MANIFEST.MF
   231 	if [ "$ampersand" = "@" ]; then
   232 	fi
   232 	    if [ "$line" = "(comment above this line)" ]; then
   233 	cp $TESTCLASSES/PrintVersion.class .
   233 		echo "File Comment Line." >> zipin
   234 
   234 		if [ "$file" = "$1" ]; then
   235 	# The remaining code in CommentZipFile essentially replaces the
   235 		    for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
   236 	#   following code, which added comments to the jar file.
   236 			for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
   237 	#   Unfortunately zipnote has been broken since 3.0 [ 2008 ] and
   237 			    echo "Mondo comment line $i$j $tail" >> zipin
   238 	#   there has been no new [ fixed ] version.  zipnote has probably
   238 			done
   239 	#   always failed, or failed for a long time without causing the
   239 		    done
   240 	#   test to fail.  So no comments were added to the file.
   240 		fi
   241 	#   The comments are added using zip(1) during the creation of the
   241 	    else
   242 	#   zip file.
   242 		file=$line
   243 	#
   243 	    fi
   244 	# NOTE:
   244 	fi
   245 	#   It seems the original intent of this test was to add a very long
   245 	echo "$ampersand $line" >> zipin
   246 	#   comment for one file.  But zip allows a max of 256 characters, so
   246 	if [ "$ampersand" = "@" ]; then
   247 	#   we settle for adding 256-character comments to lots of files.
   247 	    if [ "$line" = "(zip file comment below this line)" ]; then
   248 	#
   248 		echo "Zip File Comment Line number 1" >> zipin
   249 	# $JAR $2cMf PrintVersion PrintVersion.class AfairlyLong*
   249 		echo "Zip File Comment Line number 2" >> zipin
   250 	# $JAR $2umf META-INF/MANIFEST.MF PrintVersion
   250 	    fi
   251 	# /usr/bin/zipnote PrintVersion.zip > zipout
   251 	fi
   252 	# ... code to modify zipout adding comments
   252     done < zipout
   253 	# /usr/bin/zipnote -w PrintVersion.zip < zipin
   253     /usr/bin/zipnote -w PrintVersion.zip < zipin
   254 	# mv PrintVersion.zip PrintVersion
       
   255 	#
       
   256 
       
   257 
       
   258 	for i in 0 1 2 3 4 5 6 7 8 9 ; do
       
   259 		for j in 0 1 2 3 4 5 6 7 8 9 ; do
       
   260 			touch AfairlyLongNameEatsUpDirectorySpaceBetter$i$j
       
   261 		done
       
   262 	done
       
   263 
       
   264         zip -$2c PrintVersion.zip PrintVersion.class AfairlyLong* META-INF/MANIFEST.MF << FINI
       
   265 File Comment Line.
       
   266 File Comment Line.
       
   267 File Comment Line.
       
   268 File Comment Line.
       
   269 File Comment Line.
       
   270 File Comment Line.
       
   271 File Comment Line.
       
   272 File Comment Line.
       
   273 File Comment Line.
       
   274 File Comment Line.
       
   275 File Comment Line.
       
   276 File Comment Line.
       
   277 File Comment Line.
       
   278 File Comment Line.
       
   279 File Comment Line.
       
   280 File Comment Line.
       
   281 File Comment Line.
       
   282 File Comment Line.
       
   283 File Comment Line.
       
   284 File Comment Line.
       
   285 $MONDO
       
   286 File Comment Line.
       
   287 File Comment Line.
       
   288 File Comment Line.
       
   289 FINI
       
   290 
       
   291 	rm -f AfairlyLong*
       
   292 
   254     mv PrintVersion.zip PrintVersion
   293     mv PrintVersion.zip PrintVersion
   255     rm zipout zipin
   294 
   256 }
   295 }
   257 
   296 
   258 #
   297 #
   259 # Attempt to launch a vm using a version specifier and make sure the
   298 # Attempt to launch a vm using a version specifier and make sure the
   260 # resultant launch (probably a "mock vm") is appropriate.
   299 # resultant launch (probably a "mock vm") is appropriate.
   261 #
   300 #
   262 LaunchVM() {
   301 LaunchVM() {
   263 	if [ "$1" != "" ]; then
   302 	if [ "$1" != "" ]; then
   264 		mess="`$JAVA -version:\"$1\" -jar PrintVersion 2>&1`"
   303 		mess="`$JAVA \"$1\" -jar PrintVersion 2>&1`"
   265 	else
   304 		if [ $? -eq 0 ]; then
   266 		mess="`$JAVA -jar PrintVersion 2>&1`"
   305 			echo "Unexpected success of -Version:$1"
   267 	fi
       
   268 	if [ $? -ne 0 ]; then
       
   269 		prefix=`echo "$mess" | cut -d ' ' -f 1-3`
       
   270 		if [ "$prefix" != "Unable to locate" ]; then
       
   271 			echo "$mess"
   306 			echo "$mess"
   272 			exit 1
   307 			exit 1
   273 		fi
   308 		fi
   274 		echo "Unexpected error in attempting to locate $1"
   309 	else
   275 		exit 1
   310 		mess="`$JAVA -jar PrintVersion 2>&1`"
   276 	fi
   311 		if [ $? -ne 0 ]; then
       
   312 			prefix=`echo "$mess" | cut -d ' ' -f 1-3`
       
   313 			if [ "$prefix" != "Unable to locate" ]; then
       
   314 				echo "$mess"
       
   315 				exit 1
       
   316 			fi
       
   317 			echo "Unexpected error in attempting to locate $1"
       
   318 			exit 1
       
   319 		fi
       
   320 
       
   321 	fi
       
   322 
   277 	echo $mess | grep "$2" > /dev/null 2>&1
   323 	echo $mess | grep "$2" > /dev/null 2>&1
   278 	if [ $? != 0 ]; then
   324 	if [ $? != 0 ]; then
   279 	    echo "Launched $mess, expected $2"
   325 	    echo "Launched $mess, expected $1"
   280 	    exit 1
   326 	    exit 1
   281 	fi
   327 	fi
   282 }
   328 }
   283 
   329 
   284 # Tests very long Main-Class attribute in the jar
   330 # Tests very long Main-Class attribute in the jar
   305 }
   351 }
   306 
   352 
   307 #
   353 #
   308 # Main test sequence starts here
   354 # Main test sequence starts here
   309 #
   355 #
       
   356 
   310 RELEASE=`$JAVA -version 2>&1 | head -n 1 | cut -d ' ' -f 3 | \
   357 RELEASE=`$JAVA -version 2>&1 | head -n 1 | cut -d ' ' -f 3 | \
   311   sed -e "s/\"//g"`
   358   sed -e "s/\"//g"`
   312 BASE_RELEASE=`echo $RELEASE | sed -e "s/-.*//g"`
   359 BASE_RELEASE=`echo $RELEASE | sed -e "s/-.*//g"`
   313 
   360 
   314 #
   361 #
   384 	CommentZipFile "AfairlyLongNameEatsUpDirectorySpaceBetter20"
   431 	CommentZipFile "AfairlyLongNameEatsUpDirectorySpaceBetter20"
   385 	LaunchVM "" "${RELEASE}"
   432 	LaunchVM "" "${RELEASE}"
   386 fi
   433 fi
   387 
   434 
   388 #
   435 #
   389 # Throw some syntactically challenged (illegal) version specifiers at
   436 # Now test specification of mJRE
   390 # the interface.  Failure (of the launcher) is success for the test.
   437 #
   391 #
   438 #   In some cases this should result in failure of the command,
   392 TestSyntax "1.2..3"				# Two adjacent separators
   439 #   in some cases, a warning messages, with the command succeeding.
   393 TestSyntax "_1.2.3"				# Begins with a separator
   440 #
   394 TestSyntax "1.2.3-"				# Ends with a separator
   441 
   395 TestSyntax "1.2+.3"				# Embedded modifier
   442 	# Commandline use of "-version:" should fail
   396 TestSyntax "1.2.4+&1.2*&1++"			# Long and invalid
   443 	#   with a message containing "no longer supported"
   397 
   444 	LaunchVM "-version:1.10+" "Error: Specifying an alternate JDK/JRE"
   398 # On windows we see if there is another jre installed, usually
   445 	LaunchVM "-version:prettymuchanything" "Error: Specifying an alternate JDK/JRE"
   399 # there is, then we test using that, otherwise links are created
   446 
   400 # to get through to SelectVersion.
   447 	# Commandline use of "-jre-restrict-search" should now fail
   401 if [ `IsWindows` = "false" ]; then
   448 	LaunchVM "-jre-restrict-search" "\-jre\-no\-restrict\-search are also no longer valid"
   402    TestLongMainClass "mklink"
   449 	# Commandline use of "-jre-no-restrict-search" should now fail
   403 else
   450 	LaunchVM "-jre-no-restrict-search" "\-jre\-no\-restrict\-search are also no longer valid"
   404     $JAVAEXE -version:1.0+
   451 
   405     if [ $? -eq 0 ]; then
   452 
   406         TestLongMainClass "1.0+"
   453 	# mJRE directives to use a specific version should be flagged
   407     else
   454 	#   with a warning, but the jar should be executed with the
   408         printf  "Warning: TestLongMainClass skipped as there is no"
   455 	#   current jre
   409 	printf  "viable MJRE installed.\n"
   456 	CreateFullJar "junk request" ""
   410     fi
   457 	LaunchVM "" "${RELEASE}"
   411 fi
   458         # Going to silently ignore JRE-Version setting in jar file manifest
   412 
   459 	#LaunchVM "" "warning: The jarfile JRE-Version"
   413 #
   460 	
   414 # Because scribbling in the registry can be rather destructive, only a
       
   415 # subset of the tests are run on Windows.
       
   416 #
       
   417 if [ `IsWindows` = "true" ]; then
       
   418     exit 0;
       
   419 fi
       
   420 
       
   421 #
       
   422 # Additional version specifiers containing spaces.  (Sigh, unable to
       
   423 # figure out the glomming on Windows)
       
   424 #
       
   425 TestSyntax "1.2.3_99 1.3.2+ 1.2.4+&1.2*&1++"	# Long and invalid
       
   426 
       
   427 #
       
   428 # Create a mock installation of a number of shell scripts named as though
       
   429 # they were installed JREs.  Then test to see if the launcher can cause
       
   430 # the right shell scripts to be invoked.
       
   431 #
       
   432 # Note, that as a side effect, this test verifies that JAVA_VERSION_PATH
       
   433 # works.
       
   434 #
       
   435 rm -rf jdk
       
   436 JAVA_VERSION_PATH="`pwd`/jdk"
       
   437 export JAVA_VERSION_PATH
       
   438 
       
   439 CreateMockVM 1.10
       
   440 CreateMockVM 1.11.3
       
   441 CreateMockVM 1.11.3_03
       
   442 CreateMockVM 1.11.4
       
   443 CreateMockVM 1.12.3_03
       
   444 CreateMockVM 1.12.3_03-lastweek
       
   445 CreateMockVM 1.13.3_03
       
   446 CreateMockVM 1.13.3_03-lastweek
       
   447 CreateMockVM 1.13.3_03_lastweek
       
   448 CreateMockVM 1.20.0
       
   449 
       
   450 #
       
   451 # Test extracting the version information from the jar file:
       
   452 #
       
   453 #	  Requested		Expected
       
   454 CreateJar "1.10+" ""
       
   455 LaunchVM  ""			"1.20.0"
       
   456 CreateJar "1.11.3_03+&1.11*" ""
       
   457 LaunchVM  ""			"1.11.4"
       
   458 CreateJar "1.12.3_03+&1.12.3*" ""
       
   459 LaunchVM  ""			"1.12.3_03"
       
   460 CreateJar "1.13.3_03+&1.13.3*" ""
       
   461 LaunchVM  ""			"1.13.3_03_lastweek"	# Strange but true
       
   462 
       
   463 #
       
   464 # Test obtaining the version information from the command line (and that
       
   465 # it overrides the manifest).
       
   466 #
       
   467 CreateJar "${BASERELEASE}*" ""
       
   468 LaunchVM  "1.10+"		"1.20.0"
       
   469 LaunchVM  "1.11.3_03+&1.11*"	"1.11.4"
       
   470 LaunchVM  "1.12.3_03+&1.12.3*"	"1.12.3_03"
       
   471 LaunchVM  "1.13.3_03+&1.13.3*"	"1.13.3_03_lastweek"	# Strange but true
       
   472 
       
   473 [ -d jdk ] && rm -rf jdk
       
   474 [ -d META_INF ] && rm -rf META_INF
       
   475 
   461 
   476 exit 0
   462 exit 0
       
   463