8021296: [TESTBUG] Test8017498.sh fails to find "gcc" and fails to compile on some Linux releases
Added checking for gcc and simplified the sig_handler() in the test case Reviewed-by: dcubed, coleenp, minqi, dlong
This commit is contained in:
parent
b4094e9fa8
commit
7e63c7bb0f
@ -3,6 +3,7 @@
|
|||||||
##
|
##
|
||||||
## @test Test6929067.sh
|
## @test Test6929067.sh
|
||||||
## @bug 6929067
|
## @bug 6929067
|
||||||
|
## @bug 8021296
|
||||||
## @summary Stack guard pages should be removed when thread is detached
|
## @summary Stack guard pages should be removed when thread is detached
|
||||||
## @compile T.java
|
## @compile T.java
|
||||||
## @run shell Test6929067.sh
|
## @run shell Test6929067.sh
|
||||||
@ -21,6 +22,11 @@ echo "TESTSRC=${TESTSRC}"
|
|||||||
OS=`uname -s`
|
OS=`uname -s`
|
||||||
case "$OS" in
|
case "$OS" in
|
||||||
Linux)
|
Linux)
|
||||||
|
gcc_cmd=`which gcc`
|
||||||
|
if [ "x$gcc_cmd" == "x" ]; then
|
||||||
|
echo "WARNING: gcc not found. Cannot execute test." 2>&1
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
NULL=/dev/null
|
NULL=/dev/null
|
||||||
PS=":"
|
PS=":"
|
||||||
FS="/"
|
FS="/"
|
||||||
@ -119,10 +125,10 @@ echo "VM type: ${VMTYPE}"
|
|||||||
# Check to ensure you have a /usr/lib/libpthread.so if you don't please look
|
# Check to ensure you have a /usr/lib/libpthread.so if you don't please look
|
||||||
# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
|
# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
|
||||||
|
|
||||||
gcc -DLINUX ${COMP_FLAG} -o invoke \
|
$gcc_cmd -DLINUX ${COMP_FLAG} -o invoke \
|
||||||
-I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
|
-I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
|
||||||
-L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
|
-L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
|
||||||
-ljvm -lpthread invoke.c
|
-ljvm -lpthread invoke.c
|
||||||
|
|
||||||
./invoke
|
./invoke
|
||||||
exit $?
|
exit $?
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
##
|
##
|
||||||
## @test Test7107135.sh
|
## @test Test7107135.sh
|
||||||
## @bug 7107135
|
## @bug 7107135
|
||||||
|
## @bug 8021296
|
||||||
## @summary Stack guard pages lost after loading library with executable stack.
|
## @summary Stack guard pages lost after loading library with executable stack.
|
||||||
## @run shell Test7107135.sh
|
## @run shell Test7107135.sh
|
||||||
##
|
##
|
||||||
@ -45,6 +46,11 @@ OS=`uname -s`
|
|||||||
case "$OS" in
|
case "$OS" in
|
||||||
Linux)
|
Linux)
|
||||||
echo "Testing on Linux"
|
echo "Testing on Linux"
|
||||||
|
gcc_cmd=`which gcc`
|
||||||
|
if [ "x$gcc_cmd" == "x" ]; then
|
||||||
|
echo "WARNING: gcc not found. Cannot execute test." 2>&1
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
NULL=NUL
|
NULL=NUL
|
||||||
@ -62,7 +68,10 @@ THIS_DIR=.
|
|||||||
cp ${TESTSRC}${FS}*.java ${THIS_DIR}
|
cp ${TESTSRC}${FS}*.java ${THIS_DIR}
|
||||||
${TESTJAVA}${FS}bin${FS}javac *.java
|
${TESTJAVA}${FS}bin${FS}javac *.java
|
||||||
|
|
||||||
gcc -fPIC -shared -c -o test.o -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux ${TESTSRC}${FS}test.c
|
$gcc_cmd -fPIC -shared -c -o test.o \
|
||||||
|
-I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux \
|
||||||
|
${TESTSRC}${FS}test.c
|
||||||
|
|
||||||
ld -shared -z execstack -o libtest-rwx.so test.o
|
ld -shared -z execstack -o libtest-rwx.so test.o
|
||||||
ld -shared -z noexecstack -o libtest-rw.so test.o
|
ld -shared -z noexecstack -o libtest-rw.so test.o
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
## @test Test8017498.sh
|
## @test Test8017498.sh
|
||||||
## @bug 8017498
|
## @bug 8017498
|
||||||
## @bug 8020791
|
## @bug 8020791
|
||||||
|
## @bug 8021296
|
||||||
## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX
|
## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX
|
||||||
## @run shell/timeout=30 Test8017498.sh
|
## @run shell/timeout=30 Test8017498.sh
|
||||||
##
|
##
|
||||||
@ -45,6 +46,11 @@ OS=`uname -s`
|
|||||||
case "$OS" in
|
case "$OS" in
|
||||||
Linux)
|
Linux)
|
||||||
echo "Testing on Linux"
|
echo "Testing on Linux"
|
||||||
|
gcc_cmd=`which gcc`
|
||||||
|
if [ "x$gcc_cmd" == "x" ]; then
|
||||||
|
echo "WARNING: gcc not found. Cannot execute test." 2>&1
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
if [ "$VM_BITS" = "64" ]
|
if [ "$VM_BITS" = "64" ]
|
||||||
then
|
then
|
||||||
MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so
|
MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so
|
||||||
@ -64,15 +70,11 @@ THIS_DIR=.
|
|||||||
cp ${TESTSRC}${FS}*.java ${THIS_DIR}
|
cp ${TESTSRC}${FS}*.java ${THIS_DIR}
|
||||||
${TESTJAVA}${FS}bin${FS}javac *.java
|
${TESTJAVA}${FS}bin${FS}javac *.java
|
||||||
|
|
||||||
gcc -DLINUX -fPIC -shared \
|
$gcc_cmd -DLINUX -fPIC -shared \
|
||||||
-o ${TESTSRC}${FS}libTestJNI.so \
|
-o ${TESTSRC}${FS}libTestJNI.so \
|
||||||
-I${TESTJAVA}${FS}include \
|
-I${TESTJAVA}${FS}include \
|
||||||
-I${TESTJAVA}${FS}include${FS}linux \
|
-I${TESTJAVA}${FS}include${FS}linux \
|
||||||
${TESTSRC}${FS}TestJNI.c
|
${TESTSRC}${FS}TestJNI.c
|
||||||
if [ $? != 0 ]
|
|
||||||
then
|
|
||||||
echo "WARNING: the gcc command failed." 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# run the java test in the background
|
# run the java test in the background
|
||||||
cmd="LD_PRELOAD=$MY_LD_PRELOAD \
|
cmd="LD_PRELOAD=$MY_LD_PRELOAD \
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE // for the definition of REG_RIP in ucontext.h
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@ -32,11 +31,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void sig_handler(int sig, siginfo_t *info, ucontext_t *context) {
|
void sig_handler(int sig, siginfo_t *info, ucontext_t *context) {
|
||||||
int thrNum;
|
|
||||||
|
|
||||||
printf( " HANDLER (1) " );
|
printf( " HANDLER (1) " );
|
||||||
// Move forward RIP to skip failing instruction
|
|
||||||
context->uc_mcontext.gregs[REG_RIP] += 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) {
|
JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user