harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r525064 - in /harmony/enhanced/drlvm/trunk/vm/tests/kernel: java/lang/ org/apache/harmony/lang/generics/
Date Tue, 03 Apr 2007 06:57:15 GMT
Author: varlax
Date: Mon Apr  2 23:57:14 2007
New Revision: 525064

URL: http://svn.apache.org/viewvc?view=rev&rev=525064
Log:
HARMONY-3520 [drlvm][kernel tests] Several tests fixed.

Modified:
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadRTest.java
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadTest.java
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/ClassLoaderTest.java
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialC.java
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialClassLoader.java
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialD.java

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadRTest.java?view=diff&rev=525064&r1=525063&r2=525064
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadRTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadRTest.java Mon Apr  2 23:57:14
2007
@@ -120,7 +120,7 @@
         } 
         t.stop(); 
         
-        int count = 10;
+        int count = 300;
         while(!tt.finished && count-- > 0 ){
             Thread.sleep(100);
         }          

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadTest.java?view=diff&rev=525064&r1=525063&r2=525064
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ThreadTest.java Mon Apr  2 23:57:14
2007
@@ -1480,6 +1480,14 @@
         } catch (InterruptedException e) {
             fail(INTERRUPTED_MESSAGE);
         }
+        waitTime = waitDuration;
+        Thread.State ts = t.getState();
+        while (ts != Thread.State.TIMED_WAITING && !(expired = doSleep(10))) {
+            ts = t.getState();
+        }
+        if (expired) {
+            fail("TIMED_WAITING state has not been reached");
+        }
         t.interrupt();
         waitTime = waitDuration;
         while (!t.exceptionReceived && !(expired = doSleep(10))) {

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/ClassLoaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/ClassLoaderTest.java?view=diff&rev=525064&r1=525063&r2=525064
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/ClassLoaderTest.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/ClassLoaderTest.java
Mon Apr  2 23:57:14 2007
@@ -15,27 +15,16 @@
  *  limitations under the License.
  */
 
-/**
- * @author Serguei S.Zapreyev
- * @version $Revision$
- **/
-
 package org.apache.harmony.lang.generics;
 
-@SuppressWarnings(value={"all"}) public class ClassLoaderTest extends junit.framework.TestCase
{
+import junit.framework.TestCase;
+
+public class ClassLoaderTest extends TestCase {
     public static int flag = 0;
-    public void test() {
-        try {
+    public void test() throws Throwable {
             SpecialClassLoader mcl = new SpecialClassLoader();
             Class cls = mcl.loadClass("");
             Object obj = cls.newInstance();
-            cls.getDeclaredMethod("test", (Class[])null).invoke(obj, (Object[])null);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+            cls.getDeclaredMethod("test").invoke(obj);
     }
-    public void main(String[] args) {
-        (new ClassLoaderTest()).test();
-    }
-
 }

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialC.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialC.java?view=diff&rev=525064&r1=525063&r2=525064
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialC.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialC.java
Mon Apr  2 23:57:14 2007
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Serguei S.Zapreyev
- * @version $Revision$
- **/
-
 package org.apache.harmony.lang.generics;
 
 public class SpecialC {

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialClassLoader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialClassLoader.java?view=diff&rev=525064&r1=525063&r2=525064
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialClassLoader.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialClassLoader.java
Mon Apr  2 23:57:14 2007
@@ -15,35 +15,27 @@
  *  limitations under the License.
  */
 
-/**
- * @author Serguei S.Zapreyev
- * @version $Revision$
- **/
-
 package org.apache.harmony.lang.generics;
+
 import java.io.File;
-import java.io.FileInputStream;
+import java.io.InputStream;
 
-@SuppressWarnings(value={"all"}) public class SpecialClassLoader extends ClassLoader {
+public class SpecialClassLoader extends ClassLoader {
     public Class findClass(String name) {
         try {
-            String s="";
-            String s2="";
+            String s;
             if (ClassLoaderTest.flag == 0) {
-				s="org"+File.separator+"apache"+File.separator+"harmony"+File.separator+"lang"+File.separator+"generics"+File.separator+"SpecialD";
-				s2="org.apache.harmony.lang.generics.SpecialD";
+                s = "org.apache.harmony.lang.generics.SpecialD";
             } else {
-				s="org"+File.separator+"apache"+File.separator+"harmony"+File.separator+"lang"+File.separator+"generics"+File.separator+"SpecialC";
-                s2="org.apache.harmony.lang.generics.SpecialC";
+                s = "org.apache.harmony.lang.generics.SpecialC";
             }
-            FileInputStream fis;
-            fis = new FileInputStream(System.getProperty("java.ext.dirs")+File.separator+"classes"+File.separator+s+".class");
-            byte[] classToBytes = new byte[fis.available()];
-            fis.read(classToBytes);
-            return defineClass(s2, classToBytes, 0, classToBytes.length);
+            InputStream is = getResourceAsStream(s.replace('.', File.separatorChar) + ".class");
+            byte[] classToBytes = new byte[is.available()];
+            is.read(classToBytes);
+            is.close();
+            return defineClass(s, classToBytes, 0, classToBytes.length);
         } catch (Exception e) {
-            System.err.println("Unexpected exception during classloading: ");
-            e.printStackTrace();
+            System.err.println("Unexpected exception during classloading: " + e);
             return null;
         }
     }

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialD.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialD.java?view=diff&rev=525064&r1=525063&r2=525064
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialD.java
(original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/org/apache/harmony/lang/generics/SpecialD.java
Mon Apr  2 23:57:14 2007
@@ -15,34 +15,24 @@
  *  limitations under the License.
  */
 
-/**
- * @author Serguei S.Zapreyev
- * @version $Revision$
- **/
-
 package org.apache.harmony.lang.generics;
 
 import junit.framework.TestCase;
 
 public class SpecialD extends TestCase {
-    public void test() {
-        try {
+    public void test() throws Throwable {
             new SpecialC();
             if(((SpecialClassLoader)this.getClass().getClassLoader()).checkFind("org.apache.harmony.lang.generics.SpecialC")==null)
{
                 fail("FAILED: " + this.getClass().getClassLoader().getClass() + " wasn't
marked as initiating classloader for SpecialC");
-            } else {
-               //System.out.println("PASSED: " + this.getClass().getClassLoader().getClass()
+ " was marked as initiating classloader for SpecialC");
             }
-            //System.out.println("Trying to define SpecialC for the second time...");
+            
+            // Trying to define SpecialC for the second time...
             ClassLoaderTest.flag++;
             try {
                ((SpecialClassLoader)this.getClass().getClassLoader()).loadClass("");
                 fail("FAILED: LinkageError wasn't thrown");
             } catch (LinkageError err) {
+                // expected
             }
-        } catch (Throwable t) {
-             fail("FAILED: Unexpected error thrown:");
-             t.printStackTrace();
-        }
     }
 }



Mime
View raw message