7186723: TEST_BUG: Race condition in sun/management/jmxremote/startstop/JMXStartStopTest.sh
authordsamersoff
Sat, 29 Sep 2012 15:44:06 +0400
changeset 14013 10f55dd791e1
parent 14012 5eb69af39af2
child 14014 da3648e13e67
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
jdk/test/ProblemList.txt
jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java
jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java
jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh
jdk/test/sun/management/jmxremote/startstop/REMOTE_TESTING.txt
--- a/jdk/test/ProblemList.txt	Fri Sep 28 14:56:38 2012 -0700
+++ b/jdk/test/ProblemList.txt	Sat Sep 29 15:44:06 2012 +0400
@@ -153,9 +153,6 @@
 # 7144846
 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
 javax/management/remote/mandatory/notif/DiffHBTest.java 	generic-all
 
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java	Fri Sep 28 14:56:38 2012 -0700
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java	Sat Sep 29 15:44:06 2012 +0400
@@ -21,17 +21,27 @@
  * questions.
  */
 
-import java.io.RandomAccessFile;
+import java.io.File;
 
 public class JMXStartStopDoSomething {
 
+    private static final String lockFileName = "JMXStartStop.lck";
 
-    public void doSomething(){
+    public static void doSomething() {
         try {
-            for (int i=0; i < 10; ++i) {
-                RandomAccessFile f = new RandomAccessFile("/dev/null","r");
-                int n = f.read();
-                f.close();
+            File lockFile = new File(lockFileName);
+            lockFile.createNewFile();
+
+            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) {
@@ -41,12 +51,7 @@
 
     public static void main(String args[]) throws Exception {
         System.err.println("main enter");
-        int count = 1;
-        while(count > 0) {
-            JMXStartStopDoSomething p = new JMXStartStopDoSomething();
-            p.doSomething();
-            Thread.sleep(1);
-        }
-        // System.err.println("main exit");
+        doSomething();
+        System.err.println("main exit");
     }
 }
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Fri Sep 28 14:56:38 2012 -0700
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Sat Sep 29 15:44:06 2012 +0400
@@ -167,14 +167,14 @@
             }
         } catch (RuntimeException r) {
             dbg_print("No connection: ", r);
-            System.out.println("NO_CONN");
+            System.out.print("NO_CONN");
             System.exit(1);
         } catch (Throwable t) {
             dbg_print("No connection: ", t);
-            System.out.println("NO_CONN");
+            System.out.print("NO_CONN");
             System.exit(2);
         }
-        System.out.println("OK_CONN");
+        System.out.print("OK_CONN");
         System.exit(0);
     }
 
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh	Fri Sep 28 14:56:38 2012 -0700
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh	Sat Sep 29 15:44:06 2012 +0400
@@ -27,7 +27,6 @@
 # @run shell JMXStartStopTest.sh --jtreg --no-compile
 # @summary No word Failed expected in the test output
 
-_verbose=no
 _server=no
 _jtreg=no
 _compile=yes
@@ -39,14 +38,14 @@
 _testclasses=".classes"
 _testsrc=`pwd`
 
-_logname=".classes/JMXStartStopTest_output.txt"
-
+_logname=".classes/output.txt"
+_lockFileName="JMXStartStop.lck"
 
 _compile(){
 
     if [ ! -e ${_testclasses} ]
     then
-	  mkdir -p ${_testclasses} 
+      mkdir -p ${_testclasses} 
     fi   
 
     rm -f ${_testclasses}/JMXStartStopTest.class
@@ -62,21 +61,17 @@
 }
 
 _app_start(){
+  ${TESTJAVA}/bin/java -server $* -cp ${_testclasses} JMXStartStopDoSomething  >> ${_logname} 2>&1 &
 
-  if [ "${_verbose}" = "yes" ]
-  then
-     echo "RUN: ${TESTJAVA}/bin/java -server $* -cp ${_testclasses} JMXStartStopDoSomething "
-  fi 
-  ${TESTJAVA}/bin/java -server $* -cp ${_testclasses} JMXStartStopDoSomething  >> ${_logname} 2>&1 &
-  sleep 1 
-
-  pid=`_get_pid`
-  if [ "x${pid}" = "x" ]
+  npid=`_get_pid`
+  if [ "${npid}" = "" ]
   then
      echo "ERROR: Test app not started"
-     exit -1
+     if [ "${_jtreg}" = "yes" ]
+     then
+       exit -1
+     fi  
   fi
-
 }
 
 _get_pid(){
@@ -84,32 +79,36 @@
 }
 
 _app_stop(){
-    pid=`_get_pid`
-    if [ "x${pid}" != "x" ]
-    then
-       kill $pid
-    fi
+  rm ${_lockFileName}
 
-    # Stop on first failed test under jtreg
-    if [ "x$1" = "xFailed" -a "${_jtreg}" = "yes" ]
+  # wait until VM is actually shuts down
+  while true 
+  do
+    npid=`_get_pid`
+    if [ "${npid}" = "" ] 
     then
-      exit -1
+      break
     fi
+    sleep 1
+  done 
 }
-   
-testme(){
-    ${TESTJAVA}/bin/java -cp ${_testclasses} JMXStartStopTest $*
+
+_exit_on_jtreg(){
+  # Stop on first failed test under jtreg
+  if [ "${_jtreg}" = "yes" ]
+  then
+      _app_stop
+      exit -1
+  fi
+}
+
+_testme(){
+  ${TESTJAVA}/bin/java -cp ${_testclasses} JMXStartStopTest $*
 }   
 
   
 _jcmd(){
-  if [ "${_verbose}" = "yes" ]
-  then
-     echo "RUN: ${TESTJAVA}/bin/jcmd JMXStartStopDoSomething $*"
-     ${TESTJAVA}/bin/jcmd JMXStartStopDoSomething $* 
-  else
-     ${TESTJAVA}/bin/jcmd JMXStartStopDoSomething $* > /dev/null 2>/dev/null
-  fi
+  ${TESTJAVA}/bin/jcmd JMXStartStopDoSomething $* > /dev/null 2>/dev/null
 } 
 
 _echo(){
@@ -122,139 +121,136 @@
 test_01(){
 # Run an app with JMX enabled stop it and 
 # restart on other port
-		
-    _echo "**** Test one ****"		
+        
+    _echo "**** Test one ****"      
 
     _app_start  -Dcom.sun.management.jmxremote.port=$1 \
                 -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
 
-    res2=`testme $1`
+    res2=`_testme $1`
 
     _jcmd ManagementAgent.start jmxremote.port=$2
 
-    res3=`testme $2`
-
+    res3=`_testme $2`
 
     if [ "${res1}" = "OK_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ] 
     then
-	_echo "Passed"
+        _echo "Passed"
     else
-	_echo "Failed r1(OK):${res1} r2(NO):${res2} r3(OK):${res3}"
-    _app_stop "Failed"
+        _echo "Failed r1(OK):${res1} r2(NO):${res2} r3(OK):${res3}"
+        _exit_on_jtreg
     fi
 
     _app_stop
-
 }  
    
 test_02(){
 # Run an app without JMX enabled 
 # start JMX by jcmd
 
-_echo "**** Test two ****"		
-_app_start  
+    _echo "**** Test two ****"      
+    _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(){
 # Run an app without JMX enabled 
 # start JMX by jcmd on one port than on other one
 
-_echo "**** Test three ****"		
-_app_start  
+    _echo "**** Test three ****"        
+    _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
-_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
-res1=`testme $1`
+    res1=`_testme $1`
 
-if [ "${res1}" = "OK_CONN" ] 
-then
-    _echo "Passed $1"
-else
-    _echo "Failed r1(NO):${res1}"
-    _app_stop "Failed"
-fi
+    if [ "${res1}" = "OK_CONN" ] 
+    then
+        _echo "Passed $1"
+    else
+        _echo "Failed r1(NO):${res1}"
+        _exit_on_jtreg
+    fi
 
 #Second agent shouldn't connect
-res1=`testme $2`
+    res1=`_testme $2`
 
-if [ "${res1}" = "NO_CONN" ] 
-then
-    _echo "Passed $2"
-else
-    _echo "Failed r1(OK):${res1}"
-fi
+    if [ "${res1}" = "NO_CONN" ] 
+    then
+        _echo "Passed $2"
+    else
+        _echo "Failed r1(OK):${res1}"
+        _exit_on_jtreg
+    fi
 
-_app_stop
+    _app_stop
 }   
    
 test_04(){
 # Run an app without JMX enabled 
 # start JMX by jcmd on one port, specify rmi port explicitly
 
-_echo "**** Test four ****"		
-_app_start  
+    _echo "**** Test four ****"     
+    _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
-res1=`testme $1 $2`
+    res1=`_testme $1 $2`
 
-if [ "${res1}" = "OK_CONN" ] 
-then
-    _echo "Passed $1 $2"
-else
-    _echo "Failed r1(NO):${res1}"
-    _app_stop "Failed"
-fi
+    if [ "${res1}" = "OK_CONN" ] 
+    then
+        _echo "Passed $1 $2"
+    else
+        _echo "Failed r1(NO):${res1}"
+        _exit_on_jtreg
+    fi
 
-_app_stop
+    _app_stop
 }   
 
 test_05(){
 # Run an app without JMX enabled, it will enable local server
 # but should leave remote server disabled  
 
-_echo "**** Test five ****"		
-_app_start  
+    _echo "**** Test five ****"     
+    _app_start  
 
-_jcmd ManagementAgent.start jmxremote=1 
+    _jcmd ManagementAgent.start jmxremote=1 
 
-# First agent should connect
-res1=`testme $1`
+    # First agent should connect
+    res1=`_testme $1`
 
-if [ "${res1}" = "NO_CONN" ] 
-then
-    _echo "Passed $1 $2"
-else
-    _echo "Failed r1(OK):${res1}"
-    _app_stop "Failed"
-fi
+    if [ "${res1}" = "NO_CONN" ] 
+    then
+        _echo "Passed $1 $2"
+    else
+        _echo "Failed r1(OK):${res1}"
+        _exit_on_jtreg
+    fi
 
-_app_stop
+    _app_stop
 }   
 
 test_06(){
@@ -264,35 +260,35 @@
 # 1) with the same port 
 # 2) with other port
 # 3) attempt to stop it twice
-# Check for valid messages in the output	
+# Check for valid messages in the output    
 
-_echo "**** Test six ****"		
-_app_start  
+    _echo "**** Test six ****"      
+    _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
-res1=`testme $1 $2`
+    # First agent should connect
+    res1=`_testme $1 $2`
 
-if [ "${res1}" = "OK_CONN" ] 
-then
-    _echo "Passed $1 $2"
-else
-    _echo "Failed r1(NO):${res1}"
-    _app_stop "Failed"
-fi
+    if [ "${res1}" = "OK_CONN" ] 
+    then
+        _echo "Passed $1 $2"
+    else
+        _echo "Failed r1(NO):${res1}"
+        _exit_on_jtreg
+    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(){
@@ -300,27 +296,26 @@
 # in command line.
 # make sure these properties overriden corectly 
 
-_echo "**** Test seven ****"		
-
-_app_start   -Dcom.sun.management.jmxremote.authenticate=false \
-             -Dcom.sun.management.jmxremote.ssl=true 
+    _echo "**** Test seven ****"        
 
-res1=`testme $1`
+    _app_start   -Dcom.sun.management.jmxremote.authenticate=false \
+                 -Dcom.sun.management.jmxremote.ssl=true 
 
-_jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false
+    res1=`_testme $1`
 
-res2=`testme $2`
+    _jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false
 
+    res2=`_testme $2`
 
-if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" ] 
-then
-   echo "Passed"
-else
-	_echo "Failed r1(NO):${res1} r2(OK):${res2}"
-    _app_stop "Failed"
-fi
+    if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" ] 
+    then
+        echo "Passed"
+    else
+        _echo "Failed r1(NO):${res1} r2(OK):${res2}"
+        _exit_on_jtreg
+    fi
 
-_app_stop
+    _app_stop
 }   
 
 test_08(){
@@ -329,32 +324,31 @@
 # stop JMX agent and then start it again with different property values
 # make sure these properties overriden corectly 
 
-_echo "**** Test eight ****"		
+    _echo "**** Test eight ****"        
 
-_app_start  -Dcom.sun.management.jmxremote.port=$1 \
-	    -Dcom.sun.management.jmxremote.authenticate=false \
-	    -Dcom.sun.management.jmxremote.ssl=true 
+    _app_start  -Dcom.sun.management.jmxremote.port=$1 \
+                -Dcom.sun.management.jmxremote.authenticate=false \
+                -Dcom.sun.management.jmxremote.ssl=true 
 
-res1=`testme $1`
+    res1=`_testme $1`
 
-_jcmd ManagementAgent.stop
+    _jcmd ManagementAgent.stop
 
-res2=`testme $1`
+    res2=`_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
 
-res3=`testme $2`
-
+    res3=`_testme $2`
 
-if [ "${res1}" = "NO_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ] 
-then
-    _echo "Passed"
-else
-    _echo "Failed r1(NO):${res1} r2(NO):${res2} r3(OK):${res3}"
-    _app_stop "Failed"
-fi
+    if [ "${res1}" = "NO_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ] 
+    then
+        _echo "Passed"
+    else
+        _echo "Failed r1(NO):${res1} r2(NO):${res2} r3(OK):${res3}"
+        _exit_on_jtreg
+    fi
  
-_app_stop
+    _app_stop
 }   
 
 test_09(){
@@ -365,31 +359,31 @@
 # in command line
 # make sure these properties overriden corectly 
 
-_echo "**** Test nine ****"		
+    _echo "**** Test nine ****"     
 
-_app_start -Dcom.sun.management.config.file=${_testsrc}/management_cl.properties \
-           -Dcom.sun.management.jmxremote.authenticate=false 
+    _app_start -Dcom.sun.management.config.file=${_testsrc}/management_cl.properties \
+               -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 \
-       jmxremote.authenticate=false jmxremote.port=$2
+    _jcmd ManagementAgent.start config.file=${_testsrc}/management_jcmd.properties \
+                                jmxremote.authenticate=false jmxremote.port=$2
 
-res3=`testme $2`
+    res3=`_testme $2`
 
-if [ "${res1}" = "NO_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ] 
-then
-    _echo "Passed"
-else
-    _echo "Failed r1(NO):${res1} r2(NO):${res2} r3(OK):${res3}"
-    _app_stop "Failed"
-fi
+    if [ "${res1}" = "NO_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ] 
+    then
+        _echo "Passed"
+    else
+        _echo "Failed r1(NO):${res1} r2(NO):${res2} r3(OK):${res3}"
+        _exit_on_jtreg
+    fi
  
-_app_stop
+    _app_stop
 }   
 
 test_10(){
@@ -399,34 +393,34 @@
 # stop JMX agent again and then start it without property value
 # make sure these properties overriden corectly 
 
-_echo "**** Test ten ****"		
+    _echo "**** Test ten ****"      
 
-_app_start  -Dcom.sun.management.jmxremote.port=$1 \
-	    -Dcom.sun.management.jmxremote.authenticate=false \
-	    -Dcom.sun.management.jmxremote.ssl=true 
+    _app_start  -Dcom.sun.management.jmxremote.port=$1 \
+                -Dcom.sun.management.jmxremote.authenticate=false \
+                -Dcom.sun.management.jmxremote.ssl=true 
 
-res1=`testme $1`
+    res1=`_testme $1`
 
-_jcmd ManagementAgent.stop
-_jcmd ManagementAgent.start jmxremote.ssl=false jmxremote.port=$1
+    _jcmd ManagementAgent.stop
+    _jcmd ManagementAgent.start jmxremote.ssl=false jmxremote.port=$1
 
 
-res2=`testme $1`
+    res2=`_testme $1`
 
-_jcmd ManagementAgent.stop
-_jcmd ManagementAgent.start jmxremote.port=$1
+    _jcmd ManagementAgent.stop
+    _jcmd ManagementAgent.start jmxremote.port=$1
 
-res3=`testme $1`
+    res3=`_testme $1`
 
-if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" -a "${res3}" = "NO_CONN" ] 
-then
-    _echo "Passed"
-else
-    _echo "Failed r1(NO):${res1} r2(OK):${res2} r3(NO):${res3}"
-    _app_stop "Failed"
-fi
+    if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" -a "${res3}" = "NO_CONN" ] 
+    then
+        _echo "Passed"
+    else
+        _echo "Failed r1(NO):${res1} r2(OK):${res2} r3(NO):${res3}"
+        _exit_on_jtreg
+    fi
  
-_app_stop
+    _app_stop
 }   
 
 test_11(){
@@ -434,102 +428,87 @@
 # stop remote agent 
 # make sure local agent is not affected
 
-_echo "**** Test eleven ****"		
+    _echo "**** Test eleven ****"       
 
-_app_start  -Dcom.sun.management.jmxremote.port=$2 \
-	    -Dcom.sun.management.jmxremote.authenticate=false \
-	    -Dcom.sun.management.jmxremote.ssl=false 
-	  
-res1=`testme $2`
+    _app_start  -Dcom.sun.management.jmxremote.port=$2 \
+                -Dcom.sun.management.jmxremote.authenticate=false \
+                -Dcom.sun.management.jmxremote.ssl=false 
+      
+    res1=`_testme $2`
 
-_jcmd ManagementAgent.stop
+    _jcmd ManagementAgent.stop
 
-pid=`${TESTJAVA}/bin/jps | sed -n "/JMXStartStopDoSomething/s/ .*//p"`
-res2=`testme local ${pid}`
+    pid=`${TESTJAVA}/bin/jps | sed -n "/JMXStartStopDoSomething/s/ .*//p"`
+    res2=`_testme local ${pid}`
 
-if [ "${res1}" = "OK_CONN" -a "${res2}" = "OK_CONN" ] 
-then
-    _echo "Passed"
-else
-    _echo "Failed r1(OK):${res1} r2(OK):${res2}"
-    _app_stop "Failed"
-fi
+    if [ "${res1}" = "OK_CONN" -a "${res2}" = "OK_CONN" ] 
+    then
+        _echo "Passed"
+    else
+        _echo "Failed r1(OK):${res1} r2(OK):${res2}"
+        _exit_on_jtreg
+    fi
  
-_app_stop
+    _app_stop
 }   
 
 test_12(){
 # Run an app with JMX disabled 
 # start local agent only
 
-_echo "**** Test twelve ****"		
+    _echo "**** Test twelve ****"       
 
-_app_start 
-	  
-res1=`testme $1`
+    _app_start 
+      
+    res1=`_testme $1`
 
-_jcmd ManagementAgent.start_local
+    _jcmd ManagementAgent.start_local
 
-pid=`_get_pid`
-if [ "x${pid}" = "x" ]
-then
-  res2="NO_CONN"
-else
-  res2=`testme local ${pid}`
-fi
+    pid=`_get_pid`
+    if [ "x${pid}" = "x" ]
+    then
+        res2="NO_CONN"
+    else
+        res2=`_testme local ${pid}`
+    fi
 
-if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" ] 
-then
-    _echo "Passed"
-else
-    _echo "Failed r1(NO):${res1} r2(OK):${res2}"
-    _app_stop "Failed"
-fi
+    if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" ] 
+    then
+        _echo "Passed"
+    else
+        _echo "Failed r1(NO):${res1} r2(OK):${res2}"
+        _exit_on_jtreg
+    fi
  
-_app_stop
+    _app_stop
 }   
 
 test_13(){
 # Run an app with -javaagent make sure it works as expected - system properties are ignored
 
-_echo "**** Test 13 ****"		
-
-AGENT="${TESTJAVA}/jre/lib/management-agent.jar"
-if [ ! -f ${AGENT} ]
- then
-  AGENT="${TESTJAVA}/lib/management-agent.jar"
-fi
+    _echo "**** Test thirteen ****"       
+			   
+    AGENT="${TESTJAVA}/jre/lib/management-agent.jar"
+    if [ ! -f ${AGENT} ]
+    then
+        AGENT="${TESTJAVA}/lib/management-agent.jar"
+    fi
 
-_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`
+    _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`
 
-if [ "${res1}" = "NO_CONN" ] 
-then
-    _echo "Passed"
-else
-    _echo "Failed r1(NO):${res1}"
-    _app_stop "Failed"
-fi
+    if [ "${res1}" = "NO_CONN" ] 
+    then
+        _echo "Passed"
+    else
+        _echo "Failed r1(NO):${res1}"
+        _exit_on_jtreg
+    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 =======================================
 
 if [ "x${TESTJAVA}" = "x" ]
@@ -542,11 +521,6 @@
 then
   echo "${TESTJAVA}/bin/jcmd"
   echo "Doesn't exist or not an executable"
-
-  if [ "${_verbose}" != "yes" ]
-  then
-    exit
-  fi
 fi
 
 
@@ -556,8 +530,6 @@
 for parm in "$@"  
 do
    case $parm in
-  --verbose)      _verbose=yes  ;;
-  --server)       _server=yes   ;;
   --jtreg)        _jtreg=yes    ;;
   --no-compile)   _compile=no   ;;
   --testsuite=*)  _testsuite=`_echo $parm | sed "s,^--.*=\(.*\),\1,"`  ;;
@@ -584,20 +556,10 @@
 
 rm -f ${_logname}
 
-# Start server mode tests
-# All of them require manual cleanup
-if [ "x${_server}" = "xyes" ]
-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}
+done
 
- # Local mode tests
- for i in `echo ${_testsuite} | sed -e "s/,/ /g"`
- do
-  test_${i} ${_port_one} ${_port_two}
- done
 
-fi
-
--- a/jdk/test/sun/management/jmxremote/startstop/REMOTE_TESTING.txt	Fri Sep 28 14:56:38 2012 -0700
+++ b/jdk/test/sun/management/jmxremote/startstop/REMOTE_TESTING.txt	Sat Sep 29 15:44:06 2012 +0400
@@ -2,7 +2,15 @@
 2. Make sure tcp connection between them works
 3. run tcpdump -i <interface> host <host2_name> and 'tcp[13] & 2!=0'
    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
 6. connect jconsole to host2:50234
    Make sure jconsole works