author | adlertz |
Fri, 24 Jan 2014 13:06:52 +0100 | |
changeset 22804 | 401135897b65 |
parent 22488 | f36fa426262c |
child 22898 | 3f9e14c6f705 |
permissions | -rw-r--r-- |
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 |
## |
21769
61c68af507c9
8028160: [TESTBUG] Exclude failing (runtime) jtreg tests using @ignore
hseigel
parents:
18988
diff
changeset
|
27 |
## @ignore 8028806 |
18939
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
28 |
## @test Test8017498.sh |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
29 |
## @bug 8017498 |
18952
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
30 |
## @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
|
31 |
## @bug 8021296 |
22488
f36fa426262c
8022301: [TESTBUG] runtime/jsig/Test8017498.sh incorrectly compiles native code
ccheung
parents:
21769
diff
changeset
|
32 |
## @bug 8022301 |
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 |
18952
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
34 |
## @run shell/timeout=30 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 |
|
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
37 |
if [ "${TESTSRC}" = "" ] |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
38 |
then |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
39 |
TESTSRC=${PWD} |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
40 |
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
|
41 |
fi |
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` |
0e7cbc5c39ec
8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents:
18952
diff
changeset
|
54 |
if [ "x$gcc_cmd" == "x" ]; then |
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 |
18939
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
58 |
if [ "$VM_BITS" = "64" ] |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
59 |
then |
18952
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
60 |
MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so |
18939
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
61 |
else |
18952
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
62 |
MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}i386${FS}libjsig.so |
22488
f36fa426262c
8022301: [TESTBUG] runtime/jsig/Test8017498.sh incorrectly compiles native code
ccheung
parents:
21769
diff
changeset
|
63 |
EXTRA_CFLAG=-m32 |
18939
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
64 |
fi |
18952
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
65 |
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
|
66 |
;; |
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 |
echo "Test passed; only valid for Linux" |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
69 |
exit 0; |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
70 |
;; |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
71 |
esac |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
72 |
|
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
73 |
THIS_DIR=. |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
74 |
|
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
75 |
cp ${TESTSRC}${FS}*.java ${THIS_DIR} |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
76 |
${TESTJAVA}${FS}bin${FS}javac *.java |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
77 |
|
18988
0e7cbc5c39ec
8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
ccheung
parents:
18952
diff
changeset
|
78 |
$gcc_cmd -DLINUX -fPIC -shared \ |
22488
f36fa426262c
8022301: [TESTBUG] runtime/jsig/Test8017498.sh incorrectly compiles native code
ccheung
parents:
21769
diff
changeset
|
79 |
${EXTRA_CFLAG} -z noexecstack \ |
18952
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
80 |
-o ${TESTSRC}${FS}libTestJNI.so \ |
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
81 |
-I${TESTJAVA}${FS}include \ |
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
82 |
-I${TESTJAVA}${FS}include${FS}linux \ |
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
83 |
${TESTSRC}${FS}TestJNI.c |
18939
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
84 |
|
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
85 |
# 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
|
86 |
cmd="LD_PRELOAD=$MY_LD_PRELOAD \ |
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
87 |
${TESTJAVA}${FS}bin${FS}java \ |
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
88 |
-Djava.library.path=${TESTSRC}${FS} -server TestJNI 100" |
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
89 |
echo "$cmd > test.out 2>&1" |
dd89db581bca
8020791: [TESTBUG] runtime/jsig/Test8017498.sh failed to compile native code
ccheung
parents:
18939
diff
changeset
|
90 |
eval $cmd > test.out 2>&1 |
18939
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
91 |
|
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
92 |
grep "old handler" test.out > ${NULL} |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
93 |
if [ $? = 0 ] |
2afa9e202276
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
ccheung
parents:
diff
changeset
|
94 |
then |
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 |