harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r499494 - /harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest2.java
Date Wed, 24 Jan 2007 17:32:51 GMT
Author: gshimansky
Date: Wed Jan 24 09:32:50 2007
New Revision: 499494

URL: http://svn.apache.org/viewvc?view=rev&rev=499494
Log:
Applied HARMONY-3024 [drlvm][kernel tests] RuntimeTest2 is unstable and should be fixed

Tests passed on Ubuntu6 x86, Windows 2003 server x86 and SuSE9 x86_64


Modified:
    harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest2.java

Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest2.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest2.java?view=diff&rev=499494&r1=499493&r2=499494
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest2.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest2.java Wed Jan 24 09:32:50
2007
@@ -375,20 +375,22 @@
                 }
                 cmnd = cmnd + " /C date";
                 Process pi3 = Runtime.getRuntime().exec(cmnd);
-                // System.out.println("1test_exec_Str");
-                try {
-                    Thread.sleep(2000);
-                } catch (Exception e) {
-                }
                 java.io.OutputStream os = pi3.getOutputStream();
                 pi3.getErrorStream();
                 java.io.InputStream is = pi3.getInputStream();
-                if (is.available() < 1) {
+                // wait for is.available != 0
+                int count = 100;
+                while (is.available() < 1 && count-- > 0) {
+                    try {
+                        Thread.sleep(200);
+                    } catch (Exception e) {
+                    }
+                }
+                if (count == 0) {
                     fail("exec(String[], String[], File).check001: where is " +
                             "the date's answer/request?");
                 }
-                // System.out.println("2test_exec_Str");
-                // System.out.println("is.available()"+is.available());
+
                 int ia = is.available();
                 byte[] bb = new byte[ia];
                 is.read(bb);
@@ -426,11 +428,15 @@
                 os.write('\n');
                 os.flush();
 
-                try {
-                    Thread.sleep(2000);
-                } catch (Exception e) {
+                // wait for is.available != 0
+                count = 100;
+                while (is.available() < 1 && count-- > 0) {
+                    try {
+                        Thread.sleep(200);
+                    } catch (Exception e) {
+                    }
                 }
-                if (is.available() < 1) {
+                if (count == 0) {
                     fail("exec(String[], String[], File).check003: where is " +
                             "the date's reaction on the incorrect entering?");
                 }



Mime
View raw message