You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2007/06/04 11:49:03 UTC

svn commit: r544110 - in /harmony/enhanced/jdktools/trunk/modules/jpda: make/exclude.common test/common/unit/org/apache/harmony/jpda/tests/jdwp/ThreadReference/OwnedMonitorsTest.java

Author: tellison
Date: Mon Jun  4 02:48:16 2007
New Revision: 544110

URL: http://svn.apache.org/viewvc?view=rev&rev=544110
Log:
Apply patch HARMOMY-4002 ([jdktools][jpda] JDWP test org.apache.harmony.jpda.tests.jdwp.ThreadReference.OwnedMonitorsTest is ambigous)

Modified:
    harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.common
    harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ThreadReference/OwnedMonitorsTest.java

Modified: harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.common?view=diff&rev=544110&r1=544109&r2=544110
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.common (original)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/make/exclude.common Mon Jun  4 02:48:16 2007
@@ -20,3 +20,5 @@
 org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadEndTest.java
 org/apache/harmony/jpda/tests/jdwp/MultiSession/ThreadStartTest.java
 org/apache/harmony/jpda/tests/jdwp/MultiSession/VMDeathTest.java
+#3866
+org/apache/harmony/jpda/tests/jdwp/ThreadReference/OwnedMonitorsTest.java

Modified: harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ThreadReference/OwnedMonitorsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ThreadReference/OwnedMonitorsTest.java?view=diff&rev=544110&r1=544109&r2=544110
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ThreadReference/OwnedMonitorsTest.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/test/common/unit/org/apache/harmony/jpda/tests/jdwp/ThreadReference/OwnedMonitorsTest.java Mon Jun  4 02:48:16 2007
@@ -47,16 +47,29 @@
      * This testcase exercises ThreadReference.OwnedMonitors command.
      * <BR>At first the test starts OwnedMonitorsDebuggee which runs
      * the tested thread 'TESTED_THREAD'. 
-     * <BR> Then the tests performs the ThreadReference.OwnedMonitors command 
+     * <BR>Then the test performs the ThreadReference.OwnedMonitors command 
      * for the tested thread and gets list of monitor objects. 
+     * It is expected that this command returns at least two monitors 
+     * owned by 'TESTED_THREAD' thread
      * <BR>After this for each received monitor object the test performs 
      * ObjectReference.MonitorInfo command.
-     * <BR>it is expected that this command returns the 'TESTED_THREAD' thread
+     * It is expected that this command returns the 'TESTED_THREAD' thread
      * as owner for each monitor.
      */
     public void testOwnedMonitors001() {
+
         synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
 
+        // checking capability relevant for this test
+        logWriter.println("==> Check capability: canGetOwnedMonitorInfo");
+        debuggeeWrapper.vmMirror.capabilities();
+        boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canGetOwnedMonitorInfo;
+        if (!isCapability) {
+            logWriter.println("##WARNING: this VM dosn't possess capability: canGetOwnedMonitorInfo");
+            synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
+            return;
+        }
+
         // getting ID of the tested thread
         logWriter.println("==> testedThreadName = " + OwnedMonitorsDebuggee.TESTED_THREAD);
         logWriter.println("==> Get testedThreadID...");
@@ -95,16 +108,22 @@
             checkReplyPacket(replyObj, "ObjectReference::MonitorInfo command");
             
             ownerThread = replyObj.getNextValueAsThreadID();
+            logWriter.println("\t\t" + "ownerThread ID:   " + ownerThread);
+
             ownerName = debuggeeWrapper.vmMirror.getThreadName(ownerThread);
-            logWriter.println("\towner: "
-                    + " " + ownerName
-                    + "(" + ownerThread + ")");
+            logWriter.println("\t\t" + "ownerThread name: " + ownerName);
+
             if (ownerThread != testedThreadID) {
-                printErrorAndFail("wrong owner: " + ownerThread);
+                printErrorAndFail("wrong owner thread: " + ownerThread);
             }
             if (!ownerName.equals(OwnedMonitorsDebuggee.TESTED_THREAD)) {
-                printErrorAndFail("wrong owner name: " + ownerName);
+                printErrorAndFail("wrong owner thread name: " + ownerName);
             }
+        }
+
+        // check that at least two owned monitors are returned
+        if (owned < 2) {
+             printErrorAndFail("wrong number of owned monitors: " + owned + " (expected at least 2)");
         }
 
         synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);