Test6842838.sh revision 1659
1659N/A#!/bin/sh -x
1659N/A
1659N/A#
1659N/A# @test @(#)Test6842838.sh
1659N/A# @bug 6842838
1659N/A# @summary Test 6842838 64-bit launcher failure due to corrupt jar
1659N/A# @run shell Test6842838.sh
1659N/A#
1659N/A
1659N/A#
1659N/A# Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
1659N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1659N/A#
1659N/A# This code is free software; you can redistribute it and/or modify it
1659N/A# under the terms of the GNU General Public License version 2 only, as
1659N/A# published by the Free Software Foundation.
1659N/A#
1659N/A# This code is distributed in the hope that it will be useful, but WITHOUT
1659N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1659N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1659N/A# version 2 for more details (a copy is included in the LICENSE file that
1659N/A# accompanied this code).
1659N/A#
1659N/A# You should have received a copy of the GNU General Public License version
1659N/A# 2 along with this work; if not, write to the Free Software Foundation,
1659N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1659N/A#
1659N/A# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
1659N/A# CA 95054 USA or visit www.sun.com if you need additional information or
1659N/A# have any questions.
1659N/A#
1659N/A
1659N/Aif [ "${TESTSRC}" = "" ]
1659N/Athen TESTSRC=.
1659N/Afi
1659N/A
1659N/Aif [ "${TESTJAVA}" = "" ]
1659N/Athen
1659N/A PARENT=`dirname \`which java\``
1659N/A TESTJAVA=`dirname ${PARENT}`
1659N/A echo "TESTJAVA not set, selecting " ${TESTJAVA}
1659N/A echo "If this is incorrect, try setting the variable manually."
1659N/Afi
1659N/A
1659N/Aif [ "${TESTCLASSES}" = "" ]
1659N/Athen
1659N/A echo "TESTCLASSES not set. Test cannot execute. Failed."
1659N/A exit 1
1659N/Afi
1659N/A
1659N/A# set platform-dependent variables
1659N/AOS=`uname -s`
1659N/Acase "$OS" in
1659N/A SunOS )
1659N/A NULL=/dev/null
1659N/A PS=":"
1659N/A FS="/"
1659N/A JAVA_EXE=${TESTJAVA}${FS}bin${FS}sparcv9${FS}java
1659N/A ;;
1659N/A * )
1659N/A echo "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)"
1659N/A exit 0;
1659N/A ;;
1659N/Aesac
1659N/A
1659N/ABADFILE=newbadjar.jar
1659N/A
1659N/A${JAVA_EXE} -version
1659N/Arm -f ${BADFILE}
1659N/A${TESTJAVA}/bin/javac CreateBadJar.java
1659N/A${JAVA_EXE} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF"
1659N/ALD_PRELOAD=/lib/64/libumem.so ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1
1659N/A
1659N/Agrep "Invalid or corrupt jarfile" test.out
1659N/Aexit $?