hotspot/test/runtime/jsig/Test8017498.sh
author stefank
Wed, 20 Apr 2016 09:58:15 +0200
changeset 38000 7519aefb5b86
parent 26305 352debf44a39
permissions -rw-r--r--
8079843: do_young_space_rescan - comment out of sync with code Reviewed-by: mgerdin, sjohanss, ehelin, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     1
#!/bin/sh
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     2
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     3
#
22488
f36fa426262c 8022301: [TESTBUG] runtime/jsig/Test8017498.sh incorrectly compiles native code
ccheung
parents: 21769
diff changeset
     4
#  Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     5
#  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     6
#
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     7
#  This code is free software; you can redistribute it and/or modify it
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     8
#  under the terms of the GNU General Public License version 2 only, as
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
     9
#  published by the Free Software Foundation.
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    10
#
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    11
#  This code is distributed in the hope that it will be useful, but WITHOUT
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    12
#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    13
#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    14
#  version 2 for more details (a copy is included in the LICENSE file that
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    15
#  accompanied this code).
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    16
#
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    17
#  You should have received a copy of the GNU General Public License version
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    18
#  2 along with this work; if not, write to the Free Software Foundation,
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    19
#  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    20
#
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    21
#  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    22
#  or visit www.oracle.com if you need additional information or have any
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    23
#  questions.
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    24
#
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    25
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    26
##
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    27
## @test Test8017498.sh
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    28
## @bug 8017498
18952
dd89db581bca 8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents: 18939
diff changeset
    29
## @bug 8020791
18988
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 18952
diff changeset
    30
## @bug 8021296
22488
f36fa426262c 8022301: [TESTBUG] runtime/jsig/Test8017498.sh incorrectly compiles native code
ccheung
parents: 21769
diff changeset
    31
## @bug 8022301
22898
3f9e14c6f705 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 22488
diff changeset
    32
## @bug 8025519
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    33
## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX
22898
3f9e14c6f705 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 22488
diff changeset
    34
## @run shell/timeout=60 Test8017498.sh
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    35
##
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    36
26305
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    37
if [ -z "${TESTSRC}" ]; then
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    38
  TESTSRC="${PWD}"
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    39
  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    40
fi
26305
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    41
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    42
echo "TESTSRC=${TESTSRC}"
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    43
## Adding common setup Variables for running shell tests.
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    44
. ${TESTSRC}/../../test_env.sh
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    45
22488
f36fa426262c 8022301: [TESTBUG] runtime/jsig/Test8017498.sh incorrectly compiles native code
ccheung
parents: 21769
diff changeset
    46
EXTRA_CFLAG=
f36fa426262c 8022301: [TESTBUG] runtime/jsig/Test8017498.sh incorrectly compiles native code
ccheung
parents: 21769
diff changeset
    47
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    48
# set platform-dependent variables
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    49
OS=`uname -s`
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    50
case "$OS" in
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    51
  Linux)
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    52
    echo "Testing on Linux"
18988
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 18952
diff changeset
    53
    gcc_cmd=`which gcc`
26305
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    54
    if [ -z "$gcc_cmd" ]; then
18988
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 18952
diff changeset
    55
        echo "WARNING: gcc not found. Cannot execute test." 2>&1
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 18952
diff changeset
    56
        exit 0;
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 18952
diff changeset
    57
    fi
22898
3f9e14c6f705 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 22488
diff changeset
    58
    MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}${VM_CPU}${FS}libjsig.so
26305
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    59
    if [ "$VM_BITS" = "32" ] && [ "$VM_CPU" != "arm" ] && [ "$VM_CPU" != "ppc" ]; then
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    60
        EXTRA_CFLAG=-m32
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    61
    fi
18952
dd89db581bca 8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents: 18939
diff changeset
    62
    echo MY_LD_PRELOAD = ${MY_LD_PRELOAD}
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    63
    ;;
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    64
  *)
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    65
    echo "Test passed; only valid for Linux"
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    66
    exit 0;
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    67
    ;;
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    68
esac
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    69
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    70
THIS_DIR=.
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    71
26305
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    72
cp "${TESTSRC}${FS}"*.java "${THIS_DIR}"
22898
3f9e14c6f705 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 22488
diff changeset
    73
${COMPILEJAVA}${FS}bin${FS}javac *.java
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    74
18988
0e7cbc5c39ec 8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents: 18952
diff changeset
    75
$gcc_cmd -DLINUX -fPIC -shared \
22488
f36fa426262c 8022301: [TESTBUG] runtime/jsig/Test8017498.sh incorrectly compiles native code
ccheung
parents: 21769
diff changeset
    76
    ${EXTRA_CFLAG} -z noexecstack \
25954
479ecda8cf90 8054713: [TESTBUG] runtime/jsig/Test8017498.sh: Execution failed: exit code 1
ctornqvi
parents: 25896
diff changeset
    77
    -o libTestJNI.so \
22898
3f9e14c6f705 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 22488
diff changeset
    78
    -I${COMPILEJAVA}${FS}include \
3f9e14c6f705 8025519: [TESTBUG] runtime/7107135/Test7107135.sh need to use COMPILEJAVA for javac task
ccheung
parents: 22488
diff changeset
    79
    -I${COMPILEJAVA}${FS}include${FS}linux \
18952
dd89db581bca 8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents: 18939
diff changeset
    80
    ${TESTSRC}${FS}TestJNI.c
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    81
26305
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    82
if [ $? -ne 0 ] ; then
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    83
    echo "Compile failed, Ignoring failed compilation and forcing the test to pass"
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    84
    exit 0
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    85
fi
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    86
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    87
# run the java test in the background
18952
dd89db581bca 8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents: 18939
diff changeset
    88
cmd="LD_PRELOAD=$MY_LD_PRELOAD \
dd89db581bca 8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents: 18939
diff changeset
    89
    ${TESTJAVA}${FS}bin${FS}java \
25954
479ecda8cf90 8054713: [TESTBUG] runtime/jsig/Test8017498.sh: Execution failed: exit code 1
ctornqvi
parents: 25896
diff changeset
    90
    -Djava.library.path=. -server TestJNI 100"
26305
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    91
echo "$cmd > test.out"
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    92
eval $cmd > test.out
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    93
26305
352debf44a39 8041727: [TESTBUG] runtime/jsig/Test8017498.sh fails with Test8017498.sh: 50: [: x/usr/bin/gcc: unexpected operator
ctornqvi
parents: 26140
diff changeset
    94
if grep "old handler" test.out > ${NULL}; then
18939
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    95
    echo "Test Passed"
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    96
    exit 0
2afa9e202276 8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff changeset
    97
fi
18952
dd89db581bca 8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents: 18939
diff changeset
    98
dd89db581bca 8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents: 18939
diff changeset
    99
echo "Test Failed"
dd89db581bca 8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents: 18939
diff changeset
   100
exit 1