jdk/test/sun/tools/jcmd/jcmd-big-script.sh
author dbuck
Fri, 30 Mar 2012 10:18:04 -0700
changeset 12390 b77511960916
permissions -rw-r--r--
7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue) Summary: Changed so that jcmd breaks input into individual lines and sends each one to the jvm separately. Reviewed-by: dcubed, sla
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12390
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
     1
#!/bin/sh
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
     2
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
     3
#
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
     4
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
     6
#
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
     9
# published by the Free Software Foundation.
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    10
#
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    15
# accompanied this code).
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    16
#
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    20
#
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    23
# questions.
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    24
#
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    25
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    26
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    27
# @test
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    28
# @bug 7154822
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    29
# @summary test if we can send a file over 1024 bytes large via jcmd -f
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    30
# @author David Buck
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    31
#
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    32
# @library ../common
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    33
# @build SimpleApplication ShutdownSimpleApplication
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    34
# @run shell jcmd-big-script.sh
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    35
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    36
. ${TESTSRC}/../common/CommonSetup.sh
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    37
. ${TESTSRC}/../common/ApplicationSetup.sh
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    38
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    39
# Start application and use PORTFILE for coordination
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    40
PORTFILE="${TESTCLASSES}"/shutdown.port
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    41
startApplication SimpleApplication "${PORTFILE}"
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    42
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    43
failed=0;
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    44
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    45
# -f <script>
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    46
rm -f jcmd.out 2>/dev/null
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    47
set +e # even if jcmd fails, we do not want abort the script yet.
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    48
${JCMD} -J-XX:+UsePerfData $appJavaPid -f ${TESTSRC}/dcmd-big-script.txt > jcmd.out 2>&1
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    49
status="$?"
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    50
set -e
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    51
if [ "$status" != 0 ]; then
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    52
  echo "jcmd command returned non-zero exit code (status=$status). Failed."
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    53
  failed=1;
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    54
fi
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    55
cat jcmd.out
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    56
set +e # if the test passes, grep will "fail" with an exit code of 1
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    57
grep Exception jcmd.out > /dev/null 2>&1
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    58
status="$?"
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    59
set -e
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    60
if [ "$status" = 0 ]; then
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    61
  echo "Output of \"jcmd [pid] -f dcmd-big-script.txt\" contains string \"Exception\". Failed."
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    62
  failed=1;
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    63
fi
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    64
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    65
# clean up
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    66
rm -f jcmd.out 2>/dev/null
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    67
stopApplication "${PORTFILE}"
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    68
waitForApplication
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    69
b77511960916 7154822: forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)
dbuck
parents:
diff changeset
    70
exit $failed