jdk/test/sun/tools/common/CommonTests.sh
author stefank
Mon, 25 Aug 2014 09:10:13 +0200
changeset 26314 f8bc1966fb30
parent 6120 4979c5d548f8
permissions -rw-r--r--
8055416: Several vm/gc/heap/summary "After GC" events emitted for the same GC ID Reviewed-by: brutisso, ehelin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6120
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
     1
#!/bin/sh
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
     2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
     3
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
     4
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
     6
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
     9
# published by the Free Software Foundation.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    10
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    15
# accompanied this code).
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    16
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    20
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    23
# questions.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    24
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    25
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    26
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    27
# @test
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    28
# @bug 6964018
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    29
# @summary Unit test for common tools infrastructure.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    30
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    31
# @build SimpleApplication SleeperApplication ShutdownSimpleApplication
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    32
# @run shell CommonTests.sh
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    33
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    34
. ${TESTSRC}/CommonSetup.sh
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    35
. ${TESTSRC}/ApplicationSetup.sh
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    36
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    37
# hope for the best:
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    38
status=0
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    39
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    40
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    41
# Test program path constants from CommonSetup.sh:
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    42
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    43
for name in JAVA JHAT JINFO JMAP JPS JSTACK; do
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    44
    eval value=$`echo $name`
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    45
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    46
    echo "INFO: $name=$value"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    47
    if [ -x "$value" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    48
        echo "INFO: '$value' is executable."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    49
    else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    50
        echo "ERROR: '$value' is not executable." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    51
        status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    52
    fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    53
done
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    54
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    55
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    56
# Display flag values from CommonSetup.sh:
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    57
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    58
for name in isCygwin isMKS isLinux isSolaris isUnknownOS isWindows; do
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    59
    eval value=$`echo $name`
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    60
    echo "INFO: flag $name=$value"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    61
done
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    62
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    63
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    64
# Test OS constant from CommonSetup.sh:
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    65
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    66
if [ -z "$OS" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    67
    echo "ERROR: OS constant cannot be empty." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    68
    status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    69
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    70
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    71
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    72
# Display the PATTERN_EOL value:
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    73
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    74
echo "INFO: PATTERN_EOL="`echo "$PATTERN_EOL" | od -c`
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    75
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    76
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    77
# Test PATTERN_EOL with 'grep' for a regular line.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    78
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    79
TESTOUT="${TESTCLASSES}/testout.grep_reg_line_eol"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    80
set +e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    81
echo 'regular line' | grep "line${PATTERN_EOL}" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    82
set -e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    83
if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    84
    echo "INFO: PATTERN_EOL works for regular line with grep."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    85
else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    86
    echo "ERROR: PATTERN_EOL does not work for regular line with grep." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    87
    status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    88
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    89
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    90
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    91
if $isWindows; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    92
    # Test PATTERN_EOL with 'grep' for a CR line.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    93
    #
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    94
    TESTOUT="${TESTCLASSES}/testout.grep_cr_line_eol"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    95
    set +e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    96
    echo 'CR line
' | grep "line${PATTERN_EOL}" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    97
    set -e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    98
    if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
    99
        echo "INFO: PATTERN_EOL works for CR line with grep."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   100
    else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   101
        echo "ERROR: PATTERN_EOL does not work for CR line with grep." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   102
        status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   103
    fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   104
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   105
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   106
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   107
# Test PATTERN_EOL with 'sed' for a regular line.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   108
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   109
TESTOUT="${TESTCLASSES}/testout.sed_reg_line_eol"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   110
echo 'regular line' | sed -n "/line${PATTERN_EOL}/p" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   111
if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   112
    echo "INFO: PATTERN_EOL works for regular line with sed."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   113
else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   114
    echo "ERROR: PATTERN_EOL does not work for regular line with sed." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   115
    status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   116
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   117
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   118
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   119
if $isWindows; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   120
    # Test PATTERN_EOL with 'sed' for a CR line.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   121
    #
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   122
    TESTOUT="${TESTCLASSES}/testout.sed_cr_line_eol"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   123
    echo 'CR line
' | sed -n "/line${PATTERN_EOL}/p" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   124
    if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   125
        echo "INFO: PATTERN_EOL works for CR line with sed."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   126
    else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   127
        echo "ERROR: PATTERN_EOL does not work for CR line with sed." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   128
        status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   129
    fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   130
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   131
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   132
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   133
# Display the PATTERN_WS value:
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   134
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   135
echo "INFO: PATTERN_WS="`echo "$PATTERN_WS" | od -c`
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   136
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   137
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   138
# Test PATTERN_WS with 'grep' for a blank.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   139
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   140
TESTOUT="${TESTCLASSES}/testout.grep_blank"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   141
set +e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   142
echo 'blank: ' | grep "$PATTERN_WS" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   143
set -e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   144
if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   145
    echo "INFO: PATTERN_WS works for blanks with grep."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   146
else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   147
    echo "ERROR: PATTERN_WS does not work for blanks with grep." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   148
    status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   149
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   150
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   151
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   152
# Test PATTERN_WS with 'grep' for a tab.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   153
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   154
TESTOUT="${TESTCLASSES}/testout.grep_tab"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   155
set +e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   156
echo 'tab:	' | grep "$PATTERN_WS" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   157
set -e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   158
if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   159
    echo "INFO: PATTERN_WS works for tabs with grep."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   160
else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   161
    echo "ERROR: PATTERN_WS does not work for tabs with grep." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   162
    status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   163
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   164
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   165
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   166
# Test PATTERN_WS with 'sed' for a blank.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   167
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   168
TESTOUT="${TESTCLASSES}/testout.sed_blank"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   169
echo 'blank: ' | sed -n "/$PATTERN_WS/p" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   170
if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   171
    echo "INFO: PATTERN_WS works for blanks with sed."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   172
else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   173
    echo "ERROR: PATTERN_WS does not work for blanks with sed." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   174
    status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   175
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   176
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   177
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   178
# Test PATTERN_WS with 'sed' for a tab.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   179
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   180
TESTOUT="${TESTCLASSES}/testout.sed_tab"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   181
echo 'tab:	' | sed -n "/$PATTERN_WS/p" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   182
if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   183
    echo "INFO: PATTERN_WS works for tabs with sed."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   184
else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   185
    echo "ERROR: PATTERN_WS does not work for tabs with sed." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   186
    status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   187
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   188
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   189
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   190
# Test startApplication and use PORTFILE for coordination
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   191
# The app sleeps for 30 seconds.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   192
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   193
PORTFILE="${TESTCLASSES}"/shutdown.port
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   194
startApplication SleeperApplication "${PORTFILE}" 30
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   195
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   196
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   197
# Test appJavaPid in "ps" cmd output.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   198
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   199
TESTOUT="${TESTCLASSES}/testout.ps_app"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   200
set +e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   201
if $isCygwin; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   202
    # On Cygwin, appJavaPid is the Windows pid for the Java process
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   203
    # and appOtherPid is the Cygwin pid for the Java process.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   204
    ps -p "$appOtherPid" \
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   205
        | grep "${PATTERN_WS}${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   206
else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   207
    # output only pid and comm columns to avoid mismatches
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   208
    ps -eo pid,comm \
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   209
        | grep "^${PATTERN_WS}*${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   210
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   211
set -e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   212
if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   213
    echo "INFO: begin appJavaPid=$appJavaPid in 'ps' cmd output:"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   214
    cat "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   215
    echo "INFO: end appJavaPid=$appJavaPid in 'ps' cmd output."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   216
else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   217
    echo "ERROR: 'ps' cmd should show appJavaPid=$appJavaPid." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   218
    status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   219
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   220
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   221
if [ -n "$appOtherPid" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   222
    # Test appOtherPid in "ps" cmd output, if we have one.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   223
    #
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   224
    TESTOUT="${TESTCLASSES}/testout.ps_other"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   225
    set +e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   226
    if $isCygwin; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   227
        ps -p "$appOtherPid" \
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   228
            | grep "${PATTERN_WS}${appOtherPid}${PATTERN_WS}" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   229
    else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   230
        # output only pid and comm columns to avoid mismatches
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   231
        ps -eo pid,comm \
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   232
            | grep "^${PATTERN_WS}*${appOtherPid}${PATTERN_WS}" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   233
    fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   234
    set -e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   235
    if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   236
        echo "INFO: begin appOtherPid=$appOtherPid in 'ps' cmd output:"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   237
        cat "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   238
        echo "INFO: end appOtherPid=$appOtherPid in 'ps' cmd output."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   239
    else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   240
        echo "ERROR: 'ps' cmd should show appOtherPid=$appOtherPid." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   241
        status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   242
    fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   243
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   244
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   245
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   246
# Test stopApplication and PORTFILE for coordination
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   247
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   248
stopApplication "${PORTFILE}"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   249
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   250
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   251
# Test application still running after stopApplication.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   252
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   253
# stopApplication just lets the app know that it can stop, but the
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   254
# app might still be doing work. This test just demonstrates that
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   255
# fact and doesn't fail if the app is already done.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   256
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   257
TESTOUT="${TESTCLASSES}/testout.after_stop"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   258
set +e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   259
if $isCygwin; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   260
    # On Cygwin, appJavaPid is the Windows pid for the Java process
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   261
    # and appOtherPid is the Cygwin pid for the Java process.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   262
    ps -p "$appOtherPid" \
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   263
        | grep "${PATTERN_WS}${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   264
else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   265
    # output only pid and comm columns to avoid mismatches
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   266
    ps -eo pid,comm \
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   267
        | grep "^${PATTERN_WS}*${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   268
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   269
set -e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   270
if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   271
    echo "INFO: it is okay for appJavaPid=$appJavaPid to still be running" \
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   272
        "after stopApplication() is called."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   273
    echo "INFO: begin 'after_stop' output:"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   274
    cat "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   275
    echo "INFO: end 'after_stop' output."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   276
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   277
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   278
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   279
# Test waitForApplication
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   280
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   281
# The app might already be gone so this function shouldn't generate
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   282
# a fatal error in either call.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   283
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   284
waitForApplication
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   285
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   286
if [ $isWindows = false ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   287
    # Windows can recycle pids quickly so we can't use this test there
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   288
    TESTOUT="${TESTCLASSES}/testout.after_kill"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   289
    set +e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   290
    # output only pid and comm columns to avoid mismatches
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   291
    ps -eo pid,comm \
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   292
        | grep "^${PATTERN_WS}*${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   293
    set -e
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   294
    if [ -s "$TESTOUT" ]; then
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   295
        echo "ERROR: 'ps' cmd should not show appJavaPid." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   296
        echo "ERROR: begin 'after_kill' output:" >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   297
        cat "$TESTOUT" >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   298
        echo "ERROR: end 'after_kill' output." >&2
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   299
        status=1
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   300
    else
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   301
        echo "INFO: 'ps' cmd does not show appJavaPid after" \
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   302
            "waitForApplication() is called."
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   303
    fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   304
fi
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   305
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   306
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   307
# Test killApplication
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   308
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   309
# The app is already be gone so this function shouldn't generate
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   310
# a fatal error.
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   311
#
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   312
killApplication
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   313
4979c5d548f8 6964018: 3/4 AnonLoggerWeakRefLeak and LoggerWeakRefLeak can fail in JPRT
dcubed
parents:
diff changeset
   314
exit $status