6911117: These tests do not work with CYGWIN: com/sun/jdi

Reviewed-by: tbell, alanb
This commit is contained in:
Kelly O'Hair 2010-01-04 15:38:30 -08:00
parent a59db62f07
commit a1ddf1b505
2 changed files with 22 additions and 11 deletions
jdk/test/com/sun/jdi

@ -54,10 +54,14 @@ JAVA="${TESTJAVA}/bin/java"
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
Windows* | CYGWIN_NT*) Windows*)
PS=";" PS=";"
OS="Windows" OS="Windows"
;; ;;
CYGWIN*)
PS=";"
OS="CYGWIN"
;;
* ) * )
PS=":" PS=":"
;; ;;
@ -67,16 +71,23 @@ startDebuggee()
{ {
OUTPUTFILE=${TESTCLASSES}/Debuggee.out OUTPUTFILE=${TESTCLASSES}/Debuggee.out
${JAVA} "$@" > ${OUTPUTFILE} & ${JAVA} "$@" > ${OUTPUTFILE} &
pid="$!" startpid="$!"
pid="${startpid}"
# CYGWIN startpid is not the native windows PID we want, get the WINPID
if [ "${OS}" = "CYGWIN" ]; then
sleep 2
ps -l -p ${startpid}
pid=`ps -l -p ${startpid} | tail -1 | awk '{print $4;}'`
fi
# MKS creates an intermediate shell to launch ${JAVA} so # MKS creates an intermediate shell to launch ${JAVA} so
# ${pid} is not the actual pid. We have put in a small sleep # ${startpid} is not the actual pid. We have put in a small sleep
# to give the intermediate shell process time to launch the # to give the intermediate shell process time to launch the
# "java" process. # "java" process.
if [ "$OS" = "Windows" ]; then if [ "$OS" = "Windows" ]; then
sleep 2 sleep 2
realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6` pid=`ps -o pid,ppid,comm|grep ${startpid}|grep "java"|cut -c1-6`
pid=${realpid}
fi fi
echo "Waiting for Debuggee to initialize..." echo "Waiting for Debuggee to initialize..."
@ -91,7 +102,7 @@ startDebuggee()
echo "Waiting $attempts second(s) ..." echo "Waiting $attempts second(s) ..."
done done
echo "Debuggee is process $pid" echo "Debuggee is process $pid (startpid=${startpid})"
} }
stopDebuggee() stopDebuggee()
@ -100,7 +111,7 @@ stopDebuggee()
if [ $? != 0 ] ; then if [ $? != 0 ] ; then
echo "Error: ShutdownDebuggee failed" echo "Error: ShutdownDebuggee failed"
failures=`expr $failures + 1` failures=`expr $failures + 1`
kill -9 $pid kill -9 ${startpid}
fi fi
} }
@ -123,7 +134,7 @@ startDebuggee \
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n \ -agentlib:jdwp=transport=dt_socket,server=y,suspend=n \
-classpath "${TESTCLASSES}" ProcessAttachDebuggee "${PORTFILE}" -classpath "${TESTCLASSES}" ProcessAttachDebuggee "${PORTFILE}"
$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ $JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
ProcessAttachDebugger $pid 2>&1 ProcessAttachDebugger $pid 2>&1
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
@ -141,7 +152,7 @@ startDebuggee \
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y \ -agentlib:jdwp=transport=dt_socket,server=y,suspend=y \
-classpath "${TESTCLASSES}" ProcessAttachDebuggee "${PORTFILE}" -classpath "${TESTCLASSES}" ProcessAttachDebuggee "${PORTFILE}"
$JAVA -classpath ${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar \ $JAVA -classpath "${TESTCLASSES}${PS}${TESTJAVA}/lib/tools.jar" \
ProcessAttachDebugger $pid 2>&1 ProcessAttachDebugger $pid 2>&1
# The debuggee is suspended and doesn't run until the debugger # The debuggee is suspended and doesn't run until the debugger

@ -51,7 +51,7 @@ case "$OS" in
Linux ) Linux )
PS=":" PS=":"
;; ;;
Windows* ) Windows* | CYGWIN*)
PS=";" PS=";"
;; ;;
* ) * )
@ -71,7 +71,7 @@ SOMEOTHERDIR="${TESTCLASSES}"/someotherdir
$JAVAC -d "${TESTCLASSES}" "${TESTSRC}"/JdiLoadedByCustomLoader.java $JAVAC -d "${TESTCLASSES}" "${TESTSRC}"/JdiLoadedByCustomLoader.java
mkdir "${SOMEOTHERDIR}" mkdir "${SOMEOTHERDIR}"
$JAVAC -d "${SOMEOTHERDIR}" -classpath ${TESTSRC}${PS}${TESTJAVA}/lib/tools.jar \ $JAVAC -d "${SOMEOTHERDIR}" -classpath "${TESTSRC}${PS}${TESTJAVA}/lib/tools.jar" \
"${TESTSRC}"/ListConnectors.java "${TESTSRC}"/ListConnectors.java
# Run the test # Run the test