Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/tools/launcher/6842838/Test6842838.sh
38841 views
#1# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3#4# This code is free software; you can redistribute it and/or modify it5# under the terms of the GNU General Public License version 2 only, as6# published by the Free Software Foundation.7#8# This code is distributed in the hope that it will be useful, but WITHOUT9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11# version 2 for more details (a copy is included in the LICENSE file that12# accompanied this code).13#14# You should have received a copy of the GNU General Public License version15# 2 along with this work; if not, write to the Free Software Foundation,16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17#18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19# or visit www.oracle.com if you need additional information or have any20# questions.21#222324# @test Test6842838.sh25# @bug 684283826# @summary Test 6842838 64-bit launcher failure due to corrupt jar27# @compile CreateBadJar.java28# @run shell Test6842838.sh2930set -x3132if [ "${TESTJAVA}" = "" ]; then33PARENT=`dirname \`which java\``34TESTJAVA=`dirname ${PARENT}`35printf "TESTJAVA not set. Test cannot execute. Failed.\n"36fi3738if [ "${TESTCLASSES}" = "" ]; then39printf "TESTCLASSES not set. Test cannot execute. Failed.\n"40exit 141fi4243# set platform-dependent variables44OS=`uname -s`45case "$OS" in46SunOS )47NULL=/dev/null48PS=":"49FS="/"50JAVA_EXE=${TESTJAVA}${FS}bin${FS}java51;;52* )53printf "Only testing on solaris 64-bit (use libumem to reliably catch buffer overrun)\n"54exit 0;55;;56esac5758if [ ! -x ${JAVA_EXE} ]; then59printf "Warning: 64-bit components not installed - skipping test.\n"60exit 061fi6263LIBUMEM=/lib/64/libumem.so64if [ ! -x ${LIBUMEM} ]; then65printf "Warning: libumem not installed - skipping test.\n"66exit 067fi6869BADFILE=newbadjar.jar70${JAVA_EXE} ${TESTVMOPTS} -version71${JAVA_EXE} ${TESTVMOPTS} -cp ${TESTCLASSES} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF"72LD_PRELOAD=${LIBUMEM} ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&17374grep "Invalid or corrupt jarfile" test.out75exit $?767778