Tue, 30 Jul 2013 14:14:25 -0700
8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
Summary: Added checking for gcc and simplified the sig_handler() in the test case
Reviewed-by: dcubed, coleenp, minqi, dlong
1 #!/bin/sh
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 #
26 ##
27 ## @test Test8017498.sh
28 ## @bug 8017498
29 ## @bug 8020791
30 ## @bug 8021296
31 ## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX
32 ## @run shell/timeout=30 Test8017498.sh
33 ##
35 if [ "${TESTSRC}" = "" ]
36 then
37 TESTSRC=${PWD}
38 echo "TESTSRC not set. Using "${TESTSRC}" as default"
39 fi
40 echo "TESTSRC=${TESTSRC}"
41 ## Adding common setup Variables for running shell tests.
42 . ${TESTSRC}/../../test_env.sh
44 # set platform-dependent variables
45 OS=`uname -s`
46 case "$OS" in
47 Linux)
48 echo "Testing on Linux"
49 gcc_cmd=`which gcc`
50 if [ "x$gcc_cmd" == "x" ]; then
51 echo "WARNING: gcc not found. Cannot execute test." 2>&1
52 exit 0;
53 fi
54 if [ "$VM_BITS" = "64" ]
55 then
56 MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so
57 else
58 MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}i386${FS}libjsig.so
59 fi
60 echo MY_LD_PRELOAD = ${MY_LD_PRELOAD}
61 ;;
62 *)
63 echo "Test passed; only valid for Linux"
64 exit 0;
65 ;;
66 esac
68 THIS_DIR=.
70 cp ${TESTSRC}${FS}*.java ${THIS_DIR}
71 ${TESTJAVA}${FS}bin${FS}javac *.java
73 $gcc_cmd -DLINUX -fPIC -shared \
74 -o ${TESTSRC}${FS}libTestJNI.so \
75 -I${TESTJAVA}${FS}include \
76 -I${TESTJAVA}${FS}include${FS}linux \
77 ${TESTSRC}${FS}TestJNI.c
79 # run the java test in the background
80 cmd="LD_PRELOAD=$MY_LD_PRELOAD \
81 ${TESTJAVA}${FS}bin${FS}java \
82 -Djava.library.path=${TESTSRC}${FS} -server TestJNI 100"
83 echo "$cmd > test.out 2>&1"
84 eval $cmd > test.out 2>&1
86 grep "old handler" test.out > ${NULL}
87 if [ $? = 0 ]
88 then
89 echo "Test Passed"
90 exit 0
91 fi
93 echo "Test Failed"
94 exit 1