hotspot/test/runtime/jsig/Test8017498.sh
changeset 40098 8db886f4617c
parent 39922 e613affb88d1
parent 40020 20738e6bef83
child 40099 24807846ffe1
equal deleted inserted replaced
39922:e613affb88d1 40098:8db886f4617c
     1 #!/bin/sh
       
     2 
       
     3 #
       
     4 #  Copyright (c) 2013, 2014, 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 ## @bug 8020791
       
    30 ## @bug 8021296
       
    31 ## @bug 8022301
       
    32 ## @bug 8025519
       
    33 ## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX
       
    34 ## @run shell/timeout=60 Test8017498.sh
       
    35 ##
       
    36 
       
    37 if [ -z "${TESTSRC}" ]; then
       
    38   TESTSRC="${PWD}"
       
    39   echo "TESTSRC not set.  Using "${TESTSRC}" as default"
       
    40 fi
       
    41 
       
    42 echo "TESTSRC=${TESTSRC}"
       
    43 ## Adding common setup Variables for running shell tests.
       
    44 . ${TESTSRC}/../../test_env.sh
       
    45 
       
    46 EXTRA_CFLAG=
       
    47 
       
    48 # set platform-dependent variables
       
    49 OS=`uname -s`
       
    50 case "$OS" in
       
    51   Linux)
       
    52     echo "Testing on Linux"
       
    53     gcc_cmd=`which gcc`
       
    54     if [ -z "$gcc_cmd" ]; then
       
    55         echo "WARNING: gcc not found. Cannot execute test." 2>&1
       
    56         exit 0;
       
    57     fi
       
    58     MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}${VM_CPU}${FS}libjsig.so
       
    59     if [ "$VM_BITS" = "32" ] && [ "$VM_CPU" != "arm" ] && [ "$VM_CPU" != "ppc" ]; then
       
    60         EXTRA_CFLAG=-m32
       
    61     fi
       
    62     echo MY_LD_PRELOAD = ${MY_LD_PRELOAD}
       
    63     ;;
       
    64   *)
       
    65     echo "Test passed; only valid for Linux"
       
    66     exit 0;
       
    67     ;;
       
    68 esac
       
    69 
       
    70 THIS_DIR=.
       
    71 
       
    72 cp "${TESTSRC}${FS}"*.java "${THIS_DIR}"
       
    73 ${COMPILEJAVA}${FS}bin${FS}javac *.java
       
    74 
       
    75 $gcc_cmd -DLINUX -fPIC -shared \
       
    76     ${EXTRA_CFLAG} -z noexecstack \
       
    77     -o libTestJNI.so \
       
    78     -I${COMPILEJAVA}${FS}include \
       
    79     -I${COMPILEJAVA}${FS}include${FS}linux \
       
    80     ${TESTSRC}${FS}TestJNI.c
       
    81 
       
    82 if [ $? -ne 0 ] ; then
       
    83     echo "Compile failed, Ignoring failed compilation and forcing the test to pass"
       
    84     exit 0
       
    85 fi
       
    86 
       
    87 # run the java test in the background
       
    88 cmd="LD_PRELOAD=$MY_LD_PRELOAD \
       
    89     ${TESTJAVA}${FS}bin${FS}java \
       
    90     -Djava.library.path=. -server TestJNI 100"
       
    91 echo "$cmd > test.out"
       
    92 eval $cmd > test.out
       
    93 
       
    94 if grep "old handler" test.out > ${NULL}; then
       
    95     echo "Test Passed"
       
    96     exit 0
       
    97 fi
       
    98 
       
    99 echo "Test Failed"
       
   100 exit 1