jdk/test/tools/launcher/6842838/Test6842838.sh
author kevinw
Mon, 14 Sep 2009 20:55:08 +0100
changeset 3848 2c2395fb6d85
child 3867 06b378debdbc
permissions -rw-r--r--
6842838: 64-bit failure in handling invalid manifest in launcher. Summary: Don't compare with hard-coded 32-bit -1 when checking zip fields. Reviewed-by: ksrini
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
#!/bin/sh -x
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     2
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     3
#
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     4
# @test @(#)Test6842838.sh
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     5
# @bug 6842838
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     6
# @summary Test 6842838 64-bit launcher failure due to corrupt jar
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
     7
# @run shell Test6842838.sh
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
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    10
#
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    11
# Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    12
# 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
    13
#
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    14
# 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
    15
# 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
    16
# published by the Free Software Foundation.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    17
#
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    18
# 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
    19
# 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
    20
# 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
    21
# 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
    22
# accompanied this code).
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
# 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
    25
# 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
    26
# 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
    27
#
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    28
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    29
# CA 95054 USA or visit www.sun.com if you need additional information or
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    30
# have any questions.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    31
#
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    32
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    33
if [ "${TESTSRC}" = "" ]
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    34
then TESTSRC=.
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    35
fi
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    36
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    37
if [ "${TESTJAVA}" = "" ]
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    38
then
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    39
  PARENT=`dirname \`which java\``
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    40
  TESTJAVA=`dirname ${PARENT}`
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    41
  echo "TESTJAVA not set, selecting " ${TESTJAVA}
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    42
  echo "If this is incorrect, try setting the variable manually."
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    43
fi
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    44
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    45
if [ "${TESTCLASSES}" = "" ]
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    46
then
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    47
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    48
  exit 1
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    49
fi
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    50
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    51
# set platform-dependent variables
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    52
OS=`uname -s`
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    53
case "$OS" in
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    54
  SunOS )
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    55
    NULL=/dev/null
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    56
    PS=":"
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    57
    FS="/"
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    58
    JAVA_EXE=${TESTJAVA}${FS}bin${FS}sparcv9${FS}java
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    59
    ;;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    60
  * )
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    61
    echo "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)"
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    62
    exit 0;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    63
    ;;
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    64
esac
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    65
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    66
BADFILE=newbadjar.jar
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    67
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    68
${JAVA_EXE} -version
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    69
rm -f ${BADFILE}
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    70
${TESTJAVA}/bin/javac CreateBadJar.java
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    71
${JAVA_EXE} CreateBadJar ${BADFILE} "META-INF/MANIFEST.MF"
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    72
LD_PRELOAD=/lib/64/libumem.so ${JAVA_EXE} -jar ${BADFILE} > test.out 2>&1
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    73
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    74
grep "Invalid or corrupt jarfile" test.out
2c2395fb6d85 6842838: 64-bit failure in handling invalid manifest in launcher.
kevinw
parents:
diff changeset
    75
exit $?