jdk/test/tools/launcher/6842838/Test6842838.sh
author chegar
Thu, 03 Jan 2013 10:00:55 +0000
changeset 14998 b9a99aac309e
parent 14786 a9f61e0cbe61
child 20201 50cc2d25a60b
permissions -rw-r--r--
8005634: tools/launcher/VersionCheck.java fails version check on jdeps Summary: add jdeps to the list of tools that do not support '-version' Reviewed-by: mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     1
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3867
diff changeset
     2
# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     4
#
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     7
# published by the Free Software Foundation.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     8
#
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    13
# accompanied this code).
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    14
#
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    18
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3867
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3867
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3867
diff changeset
    21
# questions.
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    22
#
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    23
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    24
3867
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    25
# @test Test6842838.sh
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    26
# @bug 6842838
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    27
# @summary Test 6842838 64-bit launcher failure due to corrupt jar
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    28
# @compile CreateBadJar.java
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    29
# @run shell Test6842838.sh
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    30
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    31
set -x
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    32
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    33
if [ "${TESTJAVA}" = "" ]; then
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    34
  PARENT=`dirname \`which java\``
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    35
  TESTJAVA=`dirname ${PARENT}`
3867
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    36
  printf "TESTJAVA not set.  Test cannot execute.  Failed.\n"
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    37
fi
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    38
3867
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    39
if [ "${TESTCLASSES}" = "" ]; then
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    40
  printf "TESTCLASSES not set.  Test cannot execute.  Failed.\n"
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    41
  exit 1
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    42
fi
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    43
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    44
# set platform-dependent variables
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    45
OS=`uname -s`
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    46
case "$OS" in
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    47
  SunOS )
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    48
    NULL=/dev/null
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    49
    PS=":"
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    50
    FS="/"
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    51
    JAVA_EXE=${TESTJAVA}${FS}bin${FS}sparcv9${FS}java
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    52
    ;;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    53
  * )
3867
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    54
    printf "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)\n"
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    55
    exit 0;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    56
    ;;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    57
esac
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    58
3867
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    59
if [ ! -x ${JAVA_EXE} ]; then
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    60
    printf "Warning: sparcv9 components not installed - skipping test.\n"
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    61
    exit 0
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    62
fi
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    63
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    64
LIBUMEM=/lib/64/libumem.so
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    65
if [ ! -x ${LIBUMEM} ]; then
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    66
    printf "Warning: libumem not installed - skipping test.\n"
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    67
    exit 0
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    68
fi
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    69
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    70
BADFILE=newbadjar.jar
14786
a9f61e0cbe61 8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents: 5506
diff changeset
    71
${JAVA_EXE} ${TESTVMOPTS} -version
a9f61e0cbe61 8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents: 5506
diff changeset
    72
${JAVA_EXE} ${TESTVMOPTS} -cp ${TESTCLASSES} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF"
3867
06b378debdbc 6882768: (launcher) test for 6842838 is broken
kevinw
parents: 3848
diff changeset
    73
LD_PRELOAD=${LIBUMEM} ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1
3848
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    74
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    75
grep "Invalid or corrupt jarfile" test.out
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    76
exit $?