提交 e2e4ca2e 编写于 作者: C ccheung

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
上级 7e2dd472
......@@ -3,6 +3,7 @@
##
## @test Test6929067.sh
## @bug 6929067
## @bug 8021296
## @summary Stack guard pages should be removed when thread is detached
## @compile T.java
## @run shell Test6929067.sh
......@@ -21,6 +22,11 @@ echo "TESTSRC=${TESTSRC}"
OS=`uname -s`
case "$OS" in
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
PS=":"
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
# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
gcc -DLINUX ${COMP_FLAG} -o invoke \
-I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
-L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
-ljvm -lpthread invoke.c
$gcc_cmd -DLINUX ${COMP_FLAG} -o invoke \
-I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
-L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
-ljvm -lpthread invoke.c
./invoke
exit $?
......@@ -27,6 +27,7 @@
##
## @test Test7107135.sh
## @bug 7107135
## @bug 8021296
## @summary Stack guard pages lost after loading library with executable stack.
## @run shell Test7107135.sh
##
......@@ -45,6 +46,11 @@ OS=`uname -s`
case "$OS" in
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
......@@ -62,7 +68,10 @@ THIS_DIR=.
cp ${TESTSRC}${FS}*.java ${THIS_DIR}
${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 noexecstack -o libtest-rw.so test.o
......
......@@ -27,6 +27,7 @@
## @test Test8017498.sh
## @bug 8017498
## @bug 8020791
## @bug 8021296
## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX
## @run shell/timeout=30 Test8017498.sh
##
......@@ -45,6 +46,11 @@ OS=`uname -s`
case "$OS" in
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" ]
then
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}
${TESTJAVA}${FS}bin${FS}javac *.java
gcc -DLINUX -fPIC -shared \
$gcc_cmd -DLINUX -fPIC -shared \
-o ${TESTSRC}${FS}libTestJNI.so \
-I${TESTJAVA}${FS}include \
-I${TESTJAVA}${FS}include${FS}linux \
${TESTSRC}${FS}TestJNI.c
if [ $? != 0 ]
then
echo "WARNING: the gcc command failed." 2>&1
fi
# run the java test in the background
cmd="LD_PRELOAD=$MY_LD_PRELOAD \
......
......@@ -21,7 +21,6 @@
* questions.
*/
#define _GNU_SOURCE // for the definition of REG_RIP in ucontext.h
#include <stdio.h>
#include <jni.h>
#include <signal.h>
......@@ -32,11 +31,8 @@ extern "C" {
#endif
void sig_handler(int sig, siginfo_t *info, ucontext_t *context) {
int thrNum;
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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册