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/01/24 18:32:51 UTC
svn commit: r499494 -
/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeTest2.java
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?");
}