jdk/test/tools/launcher/6842838/Test6842838.sh
changeset 3848 2c2395fb6d85
child 3867 06b378debdbc
equal deleted inserted replaced
3847:821abab95d38 3848:2c2395fb6d85
       
     1 #!/bin/sh -x
       
     2 
       
     3 #
       
     4 # @test @(#)Test6842838.sh
       
     5 # @bug 6842838
       
     6 # @summary Test 6842838 64-bit launcher failure due to corrupt jar
       
     7 # @run shell Test6842838.sh
       
     8 #
       
     9 
       
    10 #
       
    11 # Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
       
    12 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
    13 #
       
    14 # This code is free software; you can redistribute it and/or modify it
       
    15 # under the terms of the GNU General Public License version 2 only, as
       
    16 # published by the Free Software Foundation.
       
    17 #
       
    18 # This code is distributed in the hope that it will be useful, but WITHOUT
       
    19 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    20 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    21 # version 2 for more details (a copy is included in the LICENSE file that
       
    22 # accompanied this code).
       
    23 #
       
    24 # You should have received a copy of the GNU General Public License version
       
    25 # 2 along with this work; if not, write to the Free Software Foundation,
       
    26 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    27 #
       
    28 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    29 # CA 95054 USA or visit www.sun.com if you need additional information or
       
    30 # have any questions.
       
    31 #
       
    32 
       
    33 if [ "${TESTSRC}" = "" ]
       
    34 then TESTSRC=.
       
    35 fi
       
    36 
       
    37 if [ "${TESTJAVA}" = "" ]
       
    38 then
       
    39   PARENT=`dirname \`which java\``
       
    40   TESTJAVA=`dirname ${PARENT}`
       
    41   echo "TESTJAVA not set, selecting " ${TESTJAVA}
       
    42   echo "If this is incorrect, try setting the variable manually."
       
    43 fi
       
    44 
       
    45 if [ "${TESTCLASSES}" = "" ]
       
    46 then
       
    47   echo "TESTCLASSES not set.  Test cannot execute.  Failed."
       
    48   exit 1
       
    49 fi
       
    50 
       
    51 # set platform-dependent variables
       
    52 OS=`uname -s`
       
    53 case "$OS" in
       
    54   SunOS )
       
    55     NULL=/dev/null
       
    56     PS=":"
       
    57     FS="/"
       
    58     JAVA_EXE=${TESTJAVA}${FS}bin${FS}sparcv9${FS}java
       
    59     ;;
       
    60   * )
       
    61     echo "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)"
       
    62     exit 0;
       
    63     ;;
       
    64 esac
       
    65 
       
    66 BADFILE=newbadjar.jar
       
    67 
       
    68 ${JAVA_EXE} -version
       
    69 rm -f ${BADFILE}
       
    70 ${TESTJAVA}/bin/javac CreateBadJar.java
       
    71 ${JAVA_EXE} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF"
       
    72 LD_PRELOAD=/lib/64/libumem.so ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1
       
    73 
       
    74 grep "Invalid or corrupt jarfile" test.out
       
    75 exit $?