You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2007/07/23 16:37:25 UTC

svn commit: r558745 - in /harmony/enhanced/jdktools/trunk/modules/jpda: make/ test/common/unit/org/apache/harmony/jpda/tests/jdwp/VirtualMachine/

Author: gshimansky
Date: Mon Jul 23 07:37:24 2007
New Revision: 558745

URL: http://svn.apache.org/viewvc?view=rev&rev=558745
Log:
Applied patch from HARMONY-3508
[jdktools][jpda] JDWP test org.apache.harmony.jpda.tests.jdwp.VirtualMachine.HoldEventsTest intermittently fails


Modified:
    harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.linux.x86.drl.interm
    harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.windows.x86.drl.interm
    harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.windows.x86_64.drl.interm
    harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/VirtualMachine/HoldEventsTest.java

Modified: harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.linux.x86.drl.interm
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.linux.x86.drl.interm?view=diff&rev=558745&r1=558744&r2=558745
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.linux.x86.drl.interm (original)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.linux.x86.drl.interm Mon Jul 23 07:37:24 2007
@@ -1,3 +0,0 @@
-#3508
-org/apache/harmony/jpda/tests/jdwp/VirtualMachine/HoldEventsTest.java
-

Modified: harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.windows.x86.drl.interm
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.windows.x86.drl.interm?view=diff&rev=558745&r1=558744&r2=558745
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.windows.x86.drl.interm (original)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.windows.x86.drl.interm Mon Jul 23 07:37:24 2007
@@ -1,3 +0,0 @@
-#3508
-org/apache/harmony/jpda/tests/jdwp/VirtualMachine/HoldEventsTest.java
-

Modified: harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.windows.x86_64.drl.interm
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.windows.x86_64.drl.interm?view=diff&rev=558745&r1=558744&r2=558745
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.windows.x86_64.drl.interm (original)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.windows.x86_64.drl.interm Mon Jul 23 07:37:24 2007
@@ -1,3 +0,0 @@
-#3508
-org/apache/harmony/jpda/tests/jdwp/VirtualMachine/HoldEventsTest.java
-

Modified: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/VirtualMachine/HoldEventsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/VirtualMachine/HoldEventsTest.java?view=diff&rev=558745&r1=558744&r2=558745
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/VirtualMachine/HoldEventsTest.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/VirtualMachine/HoldEventsTest.java Mon Jul 23 07:37:24 2007
@@ -27,9 +27,11 @@
 
 import org.apache.harmony.jpda.tests.framework.TestErrorException;
 import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.EventPacket;
 import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands;
 import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
 import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket;
+import org.apache.harmony.jpda.tests.framework.jdwp.exceptions.TimeoutException;
 import org.apache.harmony.jpda.tests.jdwp.share.JDWPSyncTestCase;
 import org.apache.harmony.jpda.tests.share.JPDADebuggeeSynchronizer;
 
@@ -38,8 +40,6 @@
  */
 public class HoldEventsTest extends JDWPSyncTestCase {
 
-    CommandPacket event = null;
-
     protected String getDebuggeeClassName() {
         return "org.apache.harmony.jpda.tests.jdwp.VirtualMachine.HoldEventsDebuggee";
     }
@@ -50,8 +50,10 @@
      * <BR> Then the test sends request for TESTED_THREAD and
      * performs VirtualMachine.HoldEvents command.
      * Next, the test waits for debuggee to start the 'TESTED_THREAD'
-     * thread and checks that no any events (including requested TESTED_THREAD event)
-     * are sent to test.
+     * thread and checks that no any events (including requested THREAD_START event)
+     * are received during default timeout.
+     * Then the test sends VirtualMachine.ReleaseEvents command 
+     * and checks that expected THREAD_START event is received.
      */
     public void testHoldEvents001() {
         synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
@@ -70,19 +72,14 @@
         logWriter.println("allow to start thread");
         synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
 
-        EventReceiver thread = new EventReceiver(); 
-        thread.start();
         try {
-            thread.join(settings.getTimeout());
-        } catch (InterruptedException e) {
-            
-        }
-
-        if (event == null) {
+            EventPacket event = debuggeeWrapper.vmMirror.receiveEvent(settings.getTimeout());
+            logWriter.printError("unexpected event received: " + event);
+            fail("unexpected event received");
+        } catch (TimeoutException e) {
             logWriter.println("no events were received");
-        } else {
-            logWriter.printError("unexpected event");
-            fail("unexpected event");
+        } catch (Exception e) {
+            throw new TestErrorException(e);
         }
 
         logWriter.println("send ReleaseEvents");
@@ -91,19 +88,11 @@
                 JDWPCommands.VirtualMachineCommandSet.ReleaseEventsCommand);
         debuggeeWrapper.vmMirror.performCommand(packet);
        
-        event = debuggeeWrapper.vmMirror.receiveCertainEvent(JDWPConstants.EventKind.THREAD_START);
+        EventPacket event = debuggeeWrapper.vmMirror.receiveCertainEvent(JDWPConstants.EventKind.THREAD_START);
+        logWriter.println("expected event received: " + event);
         debuggeeWrapper.vmMirror.resume();
     }
 
-    class EventReceiver extends Thread {
-        public void run() {
-            try {
-                event = debuggeeWrapper.vmMirror.receiveCertainEvent(JDWPConstants.EventKind.THREAD_START);
-            } catch (TestErrorException e) {
-                logWriter.println(e.toString());
-            }
-        }
-    }
     public static void main(String[] args) {
         junit.textui.TestRunner.run(HoldEventsTest.class);
     }