提交 07bda3a3 编写于 作者: D dsamersoff

7186723: TEST_BUG: Race condition in sun/management/jmxremote/startstop/JMXStartStopTest.sh

Summary: Make test self-terminating and independent to cygwin/mks kill behaviour
Reviewed-by: sspitsyn, alanb
上级 35f41e47
...@@ -153,9 +153,6 @@ javax/management/loading/LibraryLoader/LibraryLoaderTest.java windows-all ...@@ -153,9 +153,6 @@ javax/management/loading/LibraryLoader/LibraryLoaderTest.java windows-all
# 7144846 # 7144846
javax/management/remote/mandatory/connection/ReconnectTest.java generic-all javax/management/remote/mandatory/connection/ReconnectTest.java generic-all
# 7158614, locks up Windows machines at least
sun/management/jmxremote/startstop/JMXStartStopTest.sh windows-all
# 7120365 # 7120365
javax/management/remote/mandatory/notif/DiffHBTest.java generic-all javax/management/remote/mandatory/notif/DiffHBTest.java generic-all
......
...@@ -21,17 +21,27 @@ ...@@ -21,17 +21,27 @@
* questions. * questions.
*/ */
import java.io.RandomAccessFile; import java.io.File;
public class JMXStartStopDoSomething { public class JMXStartStopDoSomething {
private static final String lockFileName = "JMXStartStop.lck";
public void doSomething(){ public static void doSomething() {
try { try {
for (int i=0; i < 10; ++i) { File lockFile = new File(lockFileName);
RandomAccessFile f = new RandomAccessFile("/dev/null","r"); lockFile.createNewFile();
int n = f.read();
f.close(); while(lockFile.exists()) {
long datetime = lockFile.lastModified();
long epoch = System.currentTimeMillis()/1000;
// Don't allow test app to run more than an hour
if (epoch - datetime > 3600) {
System.err.println("Lock is too old. Aborting");
return;
}
Thread.sleep(1);
} }
} catch (Throwable e) { } catch (Throwable e) {
...@@ -41,12 +51,7 @@ public class JMXStartStopDoSomething { ...@@ -41,12 +51,7 @@ public class JMXStartStopDoSomething {
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
System.err.println("main enter"); System.err.println("main enter");
int count = 1; doSomething();
while(count > 0) { System.err.println("main exit");
JMXStartStopDoSomething p = new JMXStartStopDoSomething();
p.doSomething();
Thread.sleep(1);
}
// System.err.println("main exit");
} }
} }
...@@ -167,14 +167,14 @@ public class JMXStartStopTest { ...@@ -167,14 +167,14 @@ public class JMXStartStopTest {
} }
} catch (RuntimeException r) { } catch (RuntimeException r) {
dbg_print("No connection: ", r); dbg_print("No connection: ", r);
System.out.println("NO_CONN"); System.out.print("NO_CONN");
System.exit(1); System.exit(1);
} catch (Throwable t) { } catch (Throwable t) {
dbg_print("No connection: ", t); dbg_print("No connection: ", t);
System.out.println("NO_CONN"); System.out.print("NO_CONN");
System.exit(2); System.exit(2);
} }
System.out.println("OK_CONN"); System.out.print("OK_CONN");
System.exit(0); System.exit(0);
} }
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
# @run shell JMXStartStopTest.sh --jtreg --no-compile # @run shell JMXStartStopTest.sh --jtreg --no-compile
# @summary No word Failed expected in the test output # @summary No word Failed expected in the test output
_verbose=no
_server=no _server=no
_jtreg=no _jtreg=no
_compile=yes _compile=yes
...@@ -39,14 +38,14 @@ _port_two=50235 ...@@ -39,14 +38,14 @@ _port_two=50235
_testclasses=".classes" _testclasses=".classes"
_testsrc=`pwd` _testsrc=`pwd`
_logname=".classes/JMXStartStopTest_output.txt" _logname=".classes/output.txt"
_lockFileName="JMXStartStop.lck"
_compile(){ _compile(){
if [ ! -e ${_testclasses} ] if [ ! -e ${_testclasses} ]
then then
mkdir -p ${_testclasses} mkdir -p ${_testclasses}
fi fi
rm -f ${_testclasses}/JMXStartStopTest.class rm -f ${_testclasses}/JMXStartStopTest.class
...@@ -62,21 +61,17 @@ _compile(){ ...@@ -62,21 +61,17 @@ _compile(){
} }
_app_start(){ _app_start(){
if [ "${_verbose}" = "yes" ]
then
echo "RUN: ${TESTJAVA}/bin/java -server $* -cp ${_testclasses} JMXStartStopDoSomething "
fi
${TESTJAVA}/bin/java -server $* -cp ${_testclasses} JMXStartStopDoSomething >> ${_logname} 2>&1 & ${TESTJAVA}/bin/java -server $* -cp ${_testclasses} JMXStartStopDoSomething >> ${_logname} 2>&1 &
sleep 1
pid=`_get_pid` npid=`_get_pid`
if [ "x${pid}" = "x" ] if [ "${npid}" = "" ]
then then
echo "ERROR: Test app not started" echo "ERROR: Test app not started"
exit -1 if [ "${_jtreg}" = "yes" ]
then
exit -1
fi
fi fi
} }
_get_pid(){ _get_pid(){
...@@ -84,32 +79,36 @@ _get_pid(){ ...@@ -84,32 +79,36 @@ _get_pid(){
} }
_app_stop(){ _app_stop(){
pid=`_get_pid` rm ${_lockFileName}
if [ "x${pid}" != "x" ]
# wait until VM is actually shuts down
while true
do
npid=`_get_pid`
if [ "${npid}" = "" ]
then then
kill $pid break
fi fi
sleep 1
done
}
# Stop on first failed test under jtreg _exit_on_jtreg(){
if [ "x$1" = "xFailed" -a "${_jtreg}" = "yes" ] # Stop on first failed test under jtreg
then if [ "${_jtreg}" = "yes" ]
then
_app_stop
exit -1 exit -1
fi fi
} }
testme(){ _testme(){
${TESTJAVA}/bin/java -cp ${_testclasses} JMXStartStopTest $* ${TESTJAVA}/bin/java -cp ${_testclasses} JMXStartStopTest $*
} }
_jcmd(){ _jcmd(){
if [ "${_verbose}" = "yes" ] ${TESTJAVA}/bin/jcmd JMXStartStopDoSomething $* > /dev/null 2>/dev/null
then
echo "RUN: ${TESTJAVA}/bin/jcmd JMXStartStopDoSomething $*"
${TESTJAVA}/bin/jcmd JMXStartStopDoSomething $*
else
${TESTJAVA}/bin/jcmd JMXStartStopDoSomething $* > /dev/null 2>/dev/null
fi
} }
_echo(){ _echo(){
...@@ -122,139 +121,136 @@ _echo(){ ...@@ -122,139 +121,136 @@ _echo(){
test_01(){ test_01(){
# Run an app with JMX enabled stop it and # Run an app with JMX enabled stop it and
# restart on other port # restart on other port
_echo "**** Test one ****" _echo "**** Test one ****"
_app_start -Dcom.sun.management.jmxremote.port=$1 \ _app_start -Dcom.sun.management.jmxremote.port=$1 \
-Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.ssl=false
res1=`testme $1` res1=`_testme $1`
_jcmd ManagementAgent.stop _jcmd ManagementAgent.stop
res2=`testme $1` res2=`_testme $1`
_jcmd ManagementAgent.start jmxremote.port=$2 _jcmd ManagementAgent.start jmxremote.port=$2
res3=`testme $2` res3=`_testme $2`
if [ "${res1}" = "OK_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ] if [ "${res1}" = "OK_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ]
then then
_echo "Passed" _echo "Passed"
else else
_echo "Failed r1(OK):${res1} r2(NO):${res2} r3(OK):${res3}" _echo "Failed r1(OK):${res1} r2(NO):${res2} r3(OK):${res3}"
_app_stop "Failed" _exit_on_jtreg
fi fi
_app_stop _app_stop
} }
test_02(){ test_02(){
# Run an app without JMX enabled # Run an app without JMX enabled
# start JMX by jcmd # start JMX by jcmd
_echo "**** Test two ****" _echo "**** Test two ****"
_app_start _app_start
_jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false _jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false
res1=`testme $1` res1=`_testme $1`
if [ "${res1}" = "OK_CONN" ]
then
_echo "Passed"
else
_echo "Failed r1(OK):${res1}"
_app_stop "Failed"
fi
_app_stop
if [ "${res1}" = "OK_CONN" ]
then
_echo "Passed"
else
_echo "Failed r1(OK):${res1}"
_exit_on_jtreg
fi
_app_stop
} }
test_03(){ test_03(){
# Run an app without JMX enabled # Run an app without JMX enabled
# start JMX by jcmd on one port than on other one # start JMX by jcmd on one port than on other one
_echo "**** Test three ****" _echo "**** Test three ****"
_app_start _app_start
_jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false _jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false
# Second agent shouldn't start # Second agent shouldn't start
_jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false _jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false
# First agent should connect # First agent should connect
res1=`testme $1` res1=`_testme $1`
if [ "${res1}" = "OK_CONN" ] if [ "${res1}" = "OK_CONN" ]
then then
_echo "Passed $1" _echo "Passed $1"
else else
_echo "Failed r1(NO):${res1}" _echo "Failed r1(NO):${res1}"
_app_stop "Failed" _exit_on_jtreg
fi fi
#Second agent shouldn't connect #Second agent shouldn't connect
res1=`testme $2` res1=`_testme $2`
if [ "${res1}" = "NO_CONN" ] if [ "${res1}" = "NO_CONN" ]
then then
_echo "Passed $2" _echo "Passed $2"
else else
_echo "Failed r1(OK):${res1}" _echo "Failed r1(OK):${res1}"
fi _exit_on_jtreg
fi
_app_stop _app_stop
} }
test_04(){ test_04(){
# Run an app without JMX enabled # Run an app without JMX enabled
# start JMX by jcmd on one port, specify rmi port explicitly # start JMX by jcmd on one port, specify rmi port explicitly
_echo "**** Test four ****" _echo "**** Test four ****"
_app_start _app_start
_jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.rmi.port=$2 jmxremote.authenticate=false jmxremote.ssl=false _jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.rmi.port=$2 jmxremote.authenticate=false jmxremote.ssl=false
# First agent should connect # First agent should connect
res1=`testme $1 $2` res1=`_testme $1 $2`
if [ "${res1}" = "OK_CONN" ] if [ "${res1}" = "OK_CONN" ]
then then
_echo "Passed $1 $2" _echo "Passed $1 $2"
else else
_echo "Failed r1(NO):${res1}" _echo "Failed r1(NO):${res1}"
_app_stop "Failed" _exit_on_jtreg
fi fi
_app_stop _app_stop
} }
test_05(){ test_05(){
# Run an app without JMX enabled, it will enable local server # Run an app without JMX enabled, it will enable local server
# but should leave remote server disabled # but should leave remote server disabled
_echo "**** Test five ****" _echo "**** Test five ****"
_app_start _app_start
_jcmd ManagementAgent.start jmxremote=1 _jcmd ManagementAgent.start jmxremote=1
# First agent should connect # First agent should connect
res1=`testme $1` res1=`_testme $1`
if [ "${res1}" = "NO_CONN" ] if [ "${res1}" = "NO_CONN" ]
then then
_echo "Passed $1 $2" _echo "Passed $1 $2"
else else
_echo "Failed r1(OK):${res1}" _echo "Failed r1(OK):${res1}"
_app_stop "Failed" _exit_on_jtreg
fi fi
_app_stop _app_stop
} }
test_06(){ test_06(){
...@@ -264,35 +260,35 @@ test_06(){ ...@@ -264,35 +260,35 @@ test_06(){
# 1) with the same port # 1) with the same port
# 2) with other port # 2) with other port
# 3) attempt to stop it twice # 3) attempt to stop it twice
# Check for valid messages in the output # Check for valid messages in the output
_echo "**** Test six ****" _echo "**** Test six ****"
_app_start _app_start
_jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false _jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false
# First agent should connect # First agent should connect
res1=`testme $1 $2` res1=`_testme $1 $2`
if [ "${res1}" = "OK_CONN" ] if [ "${res1}" = "OK_CONN" ]
then then
_echo "Passed $1 $2" _echo "Passed $1 $2"
else else
_echo "Failed r1(NO):${res1}" _echo "Failed r1(NO):${res1}"
_app_stop "Failed" _exit_on_jtreg
fi fi
_jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false _jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false
_jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false _jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false
_jcmd ManagementAgent.stop _jcmd ManagementAgent.stop
_jcmd ManagementAgent.stop _jcmd ManagementAgent.stop
_jcmd ManagementAgent.start jmxremote.port=22 jmxremote.rmi.port=$2 jmxremote.authenticate=false jmxremote.ssl=false _jcmd ManagementAgent.start jmxremote.port=22 jmxremote.rmi.port=$2 jmxremote.authenticate=false jmxremote.ssl=false
_app_stop _app_stop
} }
test_07(){ test_07(){
...@@ -300,27 +296,26 @@ test_07(){ ...@@ -300,27 +296,26 @@ test_07(){
# in command line. # in command line.
# make sure these properties overriden corectly # make sure these properties overriden corectly
_echo "**** Test seven ****" _echo "**** Test seven ****"
_app_start -Dcom.sun.management.jmxremote.authenticate=false \ _app_start -Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=true -Dcom.sun.management.jmxremote.ssl=true
res1=`testme $1` res1=`_testme $1`
_jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false _jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false
res2=`testme $2` res2=`_testme $2`
if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" ]
then
echo "Passed"
else
_echo "Failed r1(NO):${res1} r2(OK):${res2}"
_exit_on_jtreg
fi
if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" ] _app_stop
then
echo "Passed"
else
_echo "Failed r1(NO):${res1} r2(OK):${res2}"
_app_stop "Failed"
fi
_app_stop
} }
test_08(){ test_08(){
...@@ -329,32 +324,31 @@ test_08(){ ...@@ -329,32 +324,31 @@ test_08(){
# stop JMX agent and then start it again with different property values # stop JMX agent and then start it again with different property values
# make sure these properties overriden corectly # make sure these properties overriden corectly
_echo "**** Test eight ****" _echo "**** Test eight ****"
_app_start -Dcom.sun.management.jmxremote.port=$1 \ _app_start -Dcom.sun.management.jmxremote.port=$1 \
-Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=true -Dcom.sun.management.jmxremote.ssl=true
res1=`testme $1`
_jcmd ManagementAgent.stop res1=`_testme $1`
res2=`testme $1` _jcmd ManagementAgent.stop
_jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false res2=`_testme $1`
res3=`testme $2` _jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false
res3=`_testme $2`
if [ "${res1}" = "NO_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ] if [ "${res1}" = "NO_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ]
then then
_echo "Passed" _echo "Passed"
else else
_echo "Failed r1(NO):${res1} r2(NO):${res2} r3(OK):${res3}" _echo "Failed r1(NO):${res1} r2(NO):${res2} r3(OK):${res3}"
_app_stop "Failed" _exit_on_jtreg
fi fi
_app_stop _app_stop
} }
test_09(){ test_09(){
...@@ -365,31 +359,31 @@ test_09(){ ...@@ -365,31 +359,31 @@ test_09(){
# in command line # in command line
# make sure these properties overriden corectly # make sure these properties overriden corectly
_echo "**** Test nine ****" _echo "**** Test nine ****"
_app_start -Dcom.sun.management.config.file=${_testsrc}/management_cl.properties \ _app_start -Dcom.sun.management.config.file=${_testsrc}/management_cl.properties \
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.authenticate=false
res1=`testme $1` res1=`_testme $1`
_jcmd ManagementAgent.stop _jcmd ManagementAgent.stop
res2=`testme $1` res2=`_testme $1`
_jcmd ManagementAgent.start config.file=${_testsrc}/management_jcmd.properties \ _jcmd ManagementAgent.start config.file=${_testsrc}/management_jcmd.properties \
jmxremote.authenticate=false jmxremote.port=$2 jmxremote.authenticate=false jmxremote.port=$2
res3=`testme $2` res3=`_testme $2`
if [ "${res1}" = "NO_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ] if [ "${res1}" = "NO_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ]
then then
_echo "Passed" _echo "Passed"
else else
_echo "Failed r1(NO):${res1} r2(NO):${res2} r3(OK):${res3}" _echo "Failed r1(NO):${res1} r2(NO):${res2} r3(OK):${res3}"
_app_stop "Failed" _exit_on_jtreg
fi fi
_app_stop _app_stop
} }
test_10(){ test_10(){
...@@ -399,34 +393,34 @@ test_10(){ ...@@ -399,34 +393,34 @@ test_10(){
# stop JMX agent again and then start it without property value # stop JMX agent again and then start it without property value
# make sure these properties overriden corectly # make sure these properties overriden corectly
_echo "**** Test ten ****" _echo "**** Test ten ****"
_app_start -Dcom.sun.management.jmxremote.port=$1 \ _app_start -Dcom.sun.management.jmxremote.port=$1 \
-Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=true -Dcom.sun.management.jmxremote.ssl=true
res1=`testme $1` res1=`_testme $1`
_jcmd ManagementAgent.stop _jcmd ManagementAgent.stop
_jcmd ManagementAgent.start jmxremote.ssl=false jmxremote.port=$1 _jcmd ManagementAgent.start jmxremote.ssl=false jmxremote.port=$1
res2=`testme $1` res2=`_testme $1`
_jcmd ManagementAgent.stop _jcmd ManagementAgent.stop
_jcmd ManagementAgent.start jmxremote.port=$1 _jcmd ManagementAgent.start jmxremote.port=$1
res3=`testme $1` res3=`_testme $1`
if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" -a "${res3}" = "NO_CONN" ] if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" -a "${res3}" = "NO_CONN" ]
then then
_echo "Passed" _echo "Passed"
else else
_echo "Failed r1(NO):${res1} r2(OK):${res2} r3(NO):${res3}" _echo "Failed r1(NO):${res1} r2(OK):${res2} r3(NO):${res3}"
_app_stop "Failed" _exit_on_jtreg
fi fi
_app_stop _app_stop
} }
test_11(){ test_11(){
...@@ -434,102 +428,87 @@ test_11(){ ...@@ -434,102 +428,87 @@ test_11(){
# stop remote agent # stop remote agent
# make sure local agent is not affected # make sure local agent is not affected
_echo "**** Test eleven ****" _echo "**** Test eleven ****"
_app_start -Dcom.sun.management.jmxremote.port=$2 \ _app_start -Dcom.sun.management.jmxremote.port=$2 \
-Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.ssl=false
res1=`testme $2` res1=`_testme $2`
_jcmd ManagementAgent.stop _jcmd ManagementAgent.stop
pid=`${TESTJAVA}/bin/jps | sed -n "/JMXStartStopDoSomething/s/ .*//p"` pid=`${TESTJAVA}/bin/jps | sed -n "/JMXStartStopDoSomething/s/ .*//p"`
res2=`testme local ${pid}` res2=`_testme local ${pid}`
if [ "${res1}" = "OK_CONN" -a "${res2}" = "OK_CONN" ] if [ "${res1}" = "OK_CONN" -a "${res2}" = "OK_CONN" ]
then then
_echo "Passed" _echo "Passed"
else else
_echo "Failed r1(OK):${res1} r2(OK):${res2}" _echo "Failed r1(OK):${res1} r2(OK):${res2}"
_app_stop "Failed" _exit_on_jtreg
fi fi
_app_stop _app_stop
} }
test_12(){ test_12(){
# Run an app with JMX disabled # Run an app with JMX disabled
# start local agent only # start local agent only
_echo "**** Test twelve ****" _echo "**** Test twelve ****"
_app_start _app_start
res1=`testme $1` res1=`_testme $1`
_jcmd ManagementAgent.start_local _jcmd ManagementAgent.start_local
pid=`_get_pid` pid=`_get_pid`
if [ "x${pid}" = "x" ] if [ "x${pid}" = "x" ]
then then
res2="NO_CONN" res2="NO_CONN"
else else
res2=`testme local ${pid}` res2=`_testme local ${pid}`
fi fi
if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" ] if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" ]
then then
_echo "Passed" _echo "Passed"
else else
_echo "Failed r1(NO):${res1} r2(OK):${res2}" _echo "Failed r1(NO):${res1} r2(OK):${res2}"
_app_stop "Failed" _exit_on_jtreg
fi fi
_app_stop _app_stop
} }
test_13(){ test_13(){
# Run an app with -javaagent make sure it works as expected - system properties are ignored # Run an app with -javaagent make sure it works as expected - system properties are ignored
_echo "**** Test 13 ****" _echo "**** Test thirteen ****"
AGENT="${TESTJAVA}/jre/lib/management-agent.jar" AGENT="${TESTJAVA}/jre/lib/management-agent.jar"
if [ ! -f ${AGENT} ] if [ ! -f ${AGENT} ]
then then
AGENT="${TESTJAVA}/lib/management-agent.jar" AGENT="${TESTJAVA}/lib/management-agent.jar"
fi fi
_app_start -javaagent:${AGENT}=com.sun.management.jmxremote.port=$1,com.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false _app_start -javaagent:${AGENT}=com.sun.management.jmxremote.port=$1,com.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
res1=`testme $1` res1=`_testme $1`
if [ "${res1}" = "NO_CONN" ] if [ "${res1}" = "NO_CONN" ]
then then
_echo "Passed" _echo "Passed"
else else
_echo "Failed r1(NO):${res1}" _echo "Failed r1(NO):${res1}"
_app_stop "Failed" _exit_on_jtreg
fi fi
_app_stop _app_stop
} }
#============== Server tests =======================
server_test_01(){
_echo "**** Server test one ****"
_app_start -Dcom.sun.management.jmxremote.port=$1 \
-Dcom.sun.management.jmxremote.rmi.port=$2 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false
}
# ============= MAIN ======================================= # ============= MAIN =======================================
if [ "x${TESTJAVA}" = "x" ] if [ "x${TESTJAVA}" = "x" ]
...@@ -542,11 +521,6 @@ if [ ! -x "${TESTJAVA}/bin/jcmd" ] ...@@ -542,11 +521,6 @@ if [ ! -x "${TESTJAVA}/bin/jcmd" ]
then then
echo "${TESTJAVA}/bin/jcmd" echo "${TESTJAVA}/bin/jcmd"
echo "Doesn't exist or not an executable" echo "Doesn't exist or not an executable"
if [ "${_verbose}" != "yes" ]
then
exit
fi
fi fi
...@@ -556,8 +530,6 @@ fi ...@@ -556,8 +530,6 @@ fi
for parm in "$@" for parm in "$@"
do do
case $parm in case $parm in
--verbose) _verbose=yes ;;
--server) _server=yes ;;
--jtreg) _jtreg=yes ;; --jtreg) _jtreg=yes ;;
--no-compile) _compile=no ;; --no-compile) _compile=no ;;
--testsuite=*) _testsuite=`_echo $parm | sed "s,^--.*=\(.*\),\1,"` ;; --testsuite=*) _testsuite=`_echo $parm | sed "s,^--.*=\(.*\),\1,"` ;;
...@@ -584,20 +556,10 @@ fi ...@@ -584,20 +556,10 @@ fi
rm -f ${_logname} rm -f ${_logname}
# Start server mode tests # Local mode tests
# All of them require manual cleanup for i in `echo ${_testsuite} | sed -e "s/,/ /g"`
if [ "x${_server}" = "xyes" ] do
then
server_test_01 ${_port_one} ${_port_two}
else
# Local mode tests
for i in `echo ${_testsuite} | sed -e "s/,/ /g"`
do
test_${i} ${_port_one} ${_port_two} test_${i} ${_port_one} ${_port_two}
done done
fi
...@@ -2,7 +2,15 @@ ...@@ -2,7 +2,15 @@
2. Make sure tcp connection between them works 2. Make sure tcp connection between them works
3. run tcpdump -i <interface> host <host2_name> and 'tcp[13] & 2!=0' 3. run tcpdump -i <interface> host <host2_name> and 'tcp[13] & 2!=0'
on host 1 on host 1
4. run JMXStartStopTest.sh --server on host2 4. run
${TESTJAVA}/bin/java -server JMXStartStopDoSomething \
-Dcom.sun.management.jmxremote.port=50234 \
-Dcom.sun.management.jmxremote.rmi.port=50235 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false
on host2
5. run jconsole on host1 5. run jconsole on host1
6. connect jconsole to host2:50234 6. connect jconsole to host2:50234
Make sure jconsole works Make sure jconsole works
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册