7158614: JMXStartStopTest.sh failing intermittently

Fixed 3 problems here: 1) checked the lock file too eary 2) never got the process id of a java test 3) some shell commands were not supported in some Solaris machines.

Reviewed-by: dsamersoff, alanb
This commit is contained in:
Shanliang Jiang 2012-12-19 11:06:51 +01:00
parent a0e241952c
commit 679f2eee3f
3 changed files with 20 additions and 16 deletions

View File

@ -141,9 +141,6 @@ java/lang/management/MemoryMXBean/LowMemoryTest2.sh generic-all
# jdk_management
# 7158614
sun/management/jmxremote/startstop/JMXStartStopTest.sh linux-all
############################################################################
# jdk_jmx

View File

@ -41,7 +41,7 @@ public class JMXStartStopDoSomething {
System.err.println("Lock is too old. Aborting");
return;
}
Thread.sleep(1);
Thread.sleep(500);
}
} catch (Throwable e) {

View File

@ -43,7 +43,7 @@ _lockFileName="JMXStartStop.lck"
_compile(){
if [ ! -e ${_testclasses} ]
if [ ! -d ${_testclasses} ]
then
mkdir -p ${_testclasses}
fi
@ -53,7 +53,7 @@ _compile(){
# Compile testcase
${TESTJAVA}/bin/javac -d ${_testclasses} JMXStartStopDoSomething.java JMXStartStopTest.java
if [ ! -e ${_testclasses}/JMXStartStopTest.class ]
if [ ! -f ${_testclasses}/JMXStartStopTest.class ]
then
echo "ERROR: Can't compile"
exit -1
@ -61,17 +61,24 @@ _compile(){
}
_app_start(){
${TESTJAVA}/bin/java ${TESTVMOPTS} $* -cp ${_testclasses} JMXStartStopDoSomething >> ${_logname} 2>&1 &
${TESTJAVA}/bin/java -server $* -cp ${_testclasses} JMXStartStopDoSomething >> ${_logname} 2>&1 &
npid=`_get_pid`
if [ "${npid}" = "" ]
then
echo "ERROR: Test app not started"
if [ "${_jtreg}" = "yes" ]
x=0
while [ ! -f ${_lockFileName} ]
do
if [ $x -gt 20 ]
then
exit -1
fi
fi
echo "ERROR: Test app not started"
if [ "${_jtreg}" = "yes" ]
then
exit -1
fi
fi
echo "Waiting JMXStartStopDoSomething to start: $x"
x=`expr $x + 1`
sleep 1
done
}
_get_pid(){
@ -103,7 +110,7 @@ _exit_on_jtreg(){
}
_testme(){
${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${_testclasses} JMXStartStopTest $*
${TESTJAVA}/bin/java -cp ${_testclasses} JMXStartStopTest $*
}