Mercurial > hg > truffle
comparison test/runtime/jsig/Test8017498.sh @ 11147:732af649bc3a
8017498: JVM crashes when native code calls sigaction(sig) where sig>=0x20
Summary: Added (sig < MAXSIGNUM) check in jsig.c
Reviewed-by: dholmes, acorn
author | ccheung |
---|---|
date | Wed, 17 Jul 2013 12:22:57 -0700 |
parents | |
children | 72727c4b6dec |
comparison
equal
deleted
inserted
replaced
11146:e619a2766bcc | 11147:732af649bc3a |
---|---|
1 #!/bin/sh | |
2 | |
3 # | |
4 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. | |
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
6 # | |
7 # This code is free software; you can redistribute it and/or modify it | |
8 # under the terms of the GNU General Public License version 2 only, as | |
9 # published by the Free Software Foundation. | |
10 # | |
11 # This code is distributed in the hope that it will be useful, but WITHOUT | |
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 # version 2 for more details (a copy is included in the LICENSE file that | |
15 # accompanied this code). | |
16 # | |
17 # You should have received a copy of the GNU General Public License version | |
18 # 2 along with this work; if not, write to the Free Software Foundation, | |
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
20 # | |
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
22 # or visit www.oracle.com if you need additional information or have any | |
23 # questions. | |
24 # | |
25 | |
26 ## | |
27 ## @test Test8017498.sh | |
28 ## @bug 8017498 | |
29 ## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX | |
30 ## @run shell Test8017498.sh | |
31 ## | |
32 | |
33 if [ "${TESTSRC}" = "" ] | |
34 then | |
35 TESTSRC=${PWD} | |
36 echo "TESTSRC not set. Using "${TESTSRC}" as default" | |
37 fi | |
38 echo "TESTSRC=${TESTSRC}" | |
39 ## Adding common setup Variables for running shell tests. | |
40 . ${TESTSRC}/../../test_env.sh | |
41 | |
42 # set platform-dependent variables | |
43 OS=`uname -s` | |
44 case "$OS" in | |
45 Linux) | |
46 echo "Testing on Linux" | |
47 if [ "$VM_BITS" = "64" ] | |
48 then | |
49 LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so | |
50 else | |
51 LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}i386${FS}libjsig.so | |
52 fi | |
53 echo LD_PRELOAD = ${LD_PRELOAD} | |
54 export LD_PRELOAD=${LD_PRELOAD} | |
55 ;; | |
56 *) | |
57 NULL=NUL | |
58 PS=";" | |
59 FS="\\" | |
60 echo "Test passed; only valid for Linux" | |
61 exit 0; | |
62 ;; | |
63 esac | |
64 | |
65 THIS_DIR=. | |
66 | |
67 cp ${TESTSRC}${FS}*.java ${THIS_DIR} | |
68 ${TESTJAVA}${FS}bin${FS}javac *.java | |
69 | |
70 gcc -fPIC -shared -o ${TESTSRC}${FS}libTestJNI.so -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux ${TESTSRC}${FS}TestJNI.c | |
71 | |
72 # run the java test in the background | |
73 echo ${TESTJAVA}${FS}bin${FS}java -Djava.library.path=${TESTSRC}${FS} -server TestJNI 100 > test.out 2>&1 & | |
74 ${TESTJAVA}${FS}bin${FS}java -Djava.library.path=${TESTSRC}${FS} -server TestJNI 100 > test.out 2>&1 & | |
75 | |
76 # obtain the process id | |
77 C_PID=$! | |
78 | |
79 # sleep for 1s | |
80 sleep 1 | |
81 | |
82 # reset LD_PRELOAD | |
83 unset LD_PRELOAD | |
84 | |
85 # check the output file (test.out) | |
86 grep "old handler" test.out > ${NULL} | |
87 if [ $? = 0 ] | |
88 then | |
89 echo "Test Passed" | |
90 exit 0 | |
91 else | |
92 kill -9 ${C_PID} | |
93 echo "Test Failed" | |
94 exit 1 | |
95 fi |