test/runtime/jsig/Test8017498.sh

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/runtime/jsig/Test8017498.sh	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,95 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +#
     1.7 +#  Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     1.8 +#  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.9 +#
    1.10 +#  This code is free software; you can redistribute it and/or modify it
    1.11 +#  under the terms of the GNU General Public License version 2 only, as
    1.12 +#  published by the Free Software Foundation.
    1.13 +#
    1.14 +#  This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +#  version 2 for more details (a copy is included in the LICENSE file that
    1.18 +#  accompanied this code).
    1.19 +#
    1.20 +#  You should have received a copy of the GNU General Public License version
    1.21 +#  2 along with this work; if not, write to the Free Software Foundation,
    1.22 +#  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +#  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 +#  or visit www.oracle.com if you need additional information or have any
    1.26 +#  questions.
    1.27 +#
    1.28 +
    1.29 +##
    1.30 +## @ignore 8028806
    1.31 +## @test Test8017498.sh
    1.32 +## @bug 8017498
    1.33 +## @bug 8020791
    1.34 +## @bug 8021296
    1.35 +## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX
    1.36 +## @run shell/timeout=30 Test8017498.sh
    1.37 +##
    1.38 +
    1.39 +if [ "${TESTSRC}" = "" ]
    1.40 +then
    1.41 +  TESTSRC=${PWD}
    1.42 +  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
    1.43 +fi
    1.44 +echo "TESTSRC=${TESTSRC}"
    1.45 +## Adding common setup Variables for running shell tests.
    1.46 +. ${TESTSRC}/../../test_env.sh
    1.47 +
    1.48 +# set platform-dependent variables
    1.49 +OS=`uname -s`
    1.50 +case "$OS" in
    1.51 +  Linux)
    1.52 +    echo "Testing on Linux"
    1.53 +    gcc_cmd=`which gcc`
    1.54 +    if [ "x$gcc_cmd" == "x" ]; then
    1.55 +        echo "WARNING: gcc not found. Cannot execute test." 2>&1
    1.56 +        exit 0;
    1.57 +    fi
    1.58 +    if [ "$VM_BITS" = "64" ]
    1.59 +    then
    1.60 +        MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so
    1.61 +    else
    1.62 +        MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}i386${FS}libjsig.so
    1.63 +    fi
    1.64 +    echo MY_LD_PRELOAD = ${MY_LD_PRELOAD}
    1.65 +    ;;
    1.66 +  *)
    1.67 +    echo "Test passed; only valid for Linux"
    1.68 +    exit 0;
    1.69 +    ;;
    1.70 +esac
    1.71 +
    1.72 +THIS_DIR=.
    1.73 +
    1.74 +cp ${TESTSRC}${FS}*.java ${THIS_DIR}
    1.75 +${TESTJAVA}${FS}bin${FS}javac *.java
    1.76 +
    1.77 +$gcc_cmd -DLINUX -fPIC -shared \
    1.78 +    -o ${TESTSRC}${FS}libTestJNI.so \
    1.79 +    -I${TESTJAVA}${FS}include \
    1.80 +    -I${TESTJAVA}${FS}include${FS}linux \
    1.81 +    ${TESTSRC}${FS}TestJNI.c
    1.82 +
    1.83 +# run the java test in the background
    1.84 +cmd="LD_PRELOAD=$MY_LD_PRELOAD \
    1.85 +    ${TESTJAVA}${FS}bin${FS}java \
    1.86 +    -Djava.library.path=${TESTSRC}${FS} -server TestJNI 100"
    1.87 +echo "$cmd > test.out 2>&1"
    1.88 +eval $cmd > test.out 2>&1
    1.89 +
    1.90 +grep "old handler" test.out > ${NULL}
    1.91 +if [ $? = 0 ]
    1.92 +then
    1.93 +    echo "Test Passed"
    1.94 +    exit 0
    1.95 +fi
    1.96 +
    1.97 +echo "Test Failed"
    1.98 +exit 1

mercurial