Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest20.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest20.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest20.java (working copy) @@ -15,41 +15,20 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest20 extends TestCase { /** * wait for finish of jvm process then destroy it then exitValue, exitValue */ public void test_20() { - System.out.println("==test_20==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_20): unknown operating system."); + fail("WARNING: unknown operating system."); } try { - String cmnd = RuntimeAdditionalTest0.javaStarter+" MAIN"; + String cmnd = RuntimeAdditionalTest0.javaStarter + " MAIN"; Process pi3 = Runtime.getRuntime().exec(cmnd); while (true) { try { @@ -61,11 +40,10 @@ } } pi3.destroy(); - /*System.out.println(*/pi3.exitValue()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); + pi3.exitValue(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_20): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest24.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest24.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest24.java (working copy) @@ -15,39 +15,18 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest24 extends TestCase { /** * get jvm process' streams, "waitFor" finish of the process then read input * stream, then exitValue */ public void test_24() { - System.out.println("==test_24==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_24): unknown operating system."); + fail("WARNING: unknown operating system."); } try { String cmnd = RuntimeAdditionalTest0.javaStarter; @@ -55,30 +34,27 @@ pi3.getOutputStream(); pi3.getErrorStream(); java.io.InputStream is = pi3.getInputStream(); - /*System.out.println(*/pi3.waitFor()/*)*/; + pi3.waitFor(); int ia; while (true) { while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //System.out.println(new String(bbb)); } try { pi3.exitValue(); while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //System.out.println(new String(bbb)); } break; } catch (IllegalThreadStateException e) { continue; } } - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_24): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest16.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest16.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest16.java (working copy) @@ -15,49 +15,25 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest16 extends TestCase { /** * creation, getting streams, waiting the finish for lots of echo-process */ public void test_16() { - System.out.println("==test_16==="); String cmnd = null; if (RuntimeAdditionalTest0.os.equals("Win")) { cmnd = RuntimeAdditionalTest0.cm + " /C \"echo 777\""; } else if (RuntimeAdditionalTest0.os.equals("Lin")) { cmnd = "sh -c \"echo 777\""; } else { - fail("WARNING (test_1): unknown operating system."); + fail("WARNING: unknown operating system."); } int ia = 0; - //while (ia < (Integer.MAX_VALUE - (Integer.MAX_VALUE / 300) * 2)) { - // ia += Integer.MAX_VALUE / 300; - while (ia < 70/*100*/) { - ia += 1; + while (ia++ < 7) { try { Process pi3 = Runtime.getRuntime().exec(cmnd); pi3.getOutputStream(); @@ -65,7 +41,6 @@ java.io.InputStream is = pi3.getInputStream(); while (true) { try { - Thread.sleep(50); pi3.exitValue(); break; } catch (IllegalThreadStateException e) { @@ -74,8 +49,7 @@ } is.available(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_16): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest36.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest36.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest36.java (working copy) @@ -15,101 +15,54 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import java.io.File; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest36 extends TestCase { /** * check the process exit code has a waited value */ - public void test_35() { // it can hang the test set run - System.out.println("==test_35==="); + public void test_35() { String cmnd = null; if (RuntimeAdditionalTest0.os.equals("Win")) { cmnd = RuntimeAdditionalTest0.cm + " /C "; try { - //for (int i = 0; i < Short.MAX_VALUE / 30; i++) { - //for (int i = 0; i < Short.MAX_VALUE / 100; i++) { - for (int i = 0; i < Short.MAX_VALUE / 150; i++) { +// for (int i = 0; i < Short.MAX_VALUE / 150; i++) { + for (int i = 0; i < 10; i++) { Process pi3 = Runtime.getRuntime() - .exec( - cmnd + "\"exit " + .exec(cmnd + "\"exit " + Integer.toString(i - 500) + "\""); int j = pi3.waitFor(); - /*System.out.println("sent " + Integer.toString(i - 500) - + " | received " + pi3.waitFor());*/ if (j != (i - 500)) { - fail("ERROR(test_35): exiValue " + pi3.exitValue() + fail("ERROR: exiValue " + pi3.exitValue() + " should be " + (i - 500)); } } } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_35): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } else if (RuntimeAdditionalTest0.os.equals("Lin")) { try { - for (int i = 500; i < Short.MAX_VALUE / 100/*30*/; i++) { - //Process pi3 = Runtime.getRuntime().exec("java RuntimeAdditionalSupport1 " + - // Integer.toString(i-500)); - //\\//\\Process pi3 = Runtime.getRuntime().exec("java -cp - // \""+System.getProperty("java.class.path")+"\" RuntimeAdditionalSupport1 " + - // Integer.toString(i-500)); -// Process pi3 = Runtime -// .getRuntime() -// .exec( -// "java " -// + (System.getProperty( -// "java.class.path").length() > 0 ? "-cp " -// + System -// .getProperty("java.class.path") -// : "") + " RuntimeAdditionalSupport1 " -// + Integer.toString(i - 500)); + for (int i = 500; i < Short.MAX_VALUE / 100; i++) { String ttt = System.getProperty("vm.boot.class.path") +(System.getProperty("java.class.path").length() > 0 ? File.pathSeparator + System.getProperty("java.class.path") : ""); - Process pi3 = Runtime - .getRuntime() - .exec( + Process pi3 = Runtime.getRuntime().exec( "java -Xbootclasspath/a:" + ttt + " -cp " + ttt + " java.lang.RuntimeAdditionalSupport1 " + Integer.toString(i - 500)); int j = pi3.waitFor(); - /*System.out.println("sent " + Integer.toString(i - 500) - + " | received " + pi3.waitFor() + " (" + j + ")" - + ((i - 500) & 0xFF));*/ if (j != ((i - 500) & 0xFF)) { - fail("ERROR(test_35): exiValue " + pi3.exitValue() + fail("ERROR: exiValue " + pi3.exitValue() + " should be " + ((i - 500) & 0xFF)); } } } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_35): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } else { - fail("WARNING (test_1): unknown operating system."); + fail("WARNING: unknown operating system."); } } Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest21.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest21.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest21.java (working copy) @@ -15,46 +15,25 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest21 extends TestCase { /** * wait for finish of jvm process then get and read its err, then exitValue */ public void test_21() { - System.out.println("==test_21==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_21): unknown operating system."); + fail("WARNING: unknown operating system."); } try { - String cmnd = RuntimeAdditionalTest0.javaStarter+" MAIN"; + String cmnd = RuntimeAdditionalTest0.javaStarter + " MAIN"; Process pi3 = Runtime.getRuntime().exec(cmnd); while (true) { try { Thread.sleep(50); - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); break; } catch (IllegalThreadStateException e) { continue; @@ -69,24 +48,21 @@ while ((ia = es.available()) != 0) { byte[] bbb = new byte[ia]; es.read(bbb); - //System.out.println(new String(bbb)); } try { pi3.exitValue(); while ((ia = es.available()) != 0) { byte[] bbb = new byte[ia]; es.read(bbb); - //System.out.println(new String(bbb)); } break; } catch (IllegalThreadStateException e) { continue; } } - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_21): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest13.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest13.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest13.java (working copy) @@ -24,44 +24,32 @@ import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest13 extends TestCase { /** * creation of process for incorrect command should lead to IOException then * get Streams of such process should lead to NPE */ public void test_13() { - System.out.println("==test_13==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_13): unknown operating system."); + fail("WARNING: unknown operating system."); } Process pi3 = null; try { String cmnd = "XjavaX"; pi3 = Runtime.getRuntime().exec(cmnd); } catch (Exception eeee) { - try { - pi3.getOutputStream(); - pi3.getErrorStream(); - pi3.getInputStream(); - } catch (NullPointerException e) { - return; - } + if (!(eeee instanceof java.io.IOException)) { + fail("IOException should be thrown"); + } else { + try { + pi3.getOutputStream(); + pi3.getErrorStream(); + pi3.getInputStream(); + } catch (NullPointerException e) { + return; + } + } } - fail("FAILED: test_13"); +// fail("FAILED: test_13"); } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest25.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest25.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest25.java (working copy) @@ -15,74 +15,50 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest25 extends TestCase { /** * get jvm process' streams, waitFor finish of the process, waitFor, * exitValue, destroy, waitFor then read err stream, then exitValue */ public void test_25() { - System.out.println("==test_25==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_25): unknown operating system."); + fail("WARNING: unknown operating system."); } try { - String cmnd = RuntimeAdditionalTest0.javaStarter+" MAIN"; + String cmnd = RuntimeAdditionalTest0.javaStarter + " MAIN"; Process pi3 = Runtime.getRuntime().exec(cmnd); pi3.getOutputStream(); java.io.InputStream es = pi3.getErrorStream(); pi3.getInputStream(); - /*System.out.println(*/pi3.waitFor()/*)*/; - /*System.out.println(*/pi3.waitFor()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.waitFor(); + pi3.waitFor(); + pi3.exitValue(); pi3.destroy(); - /*System.out.println(*/pi3.waitFor()/*)*/; + pi3.waitFor(); int ia; while (true) { while ((ia = es.available()) != 0) { byte[] bbb = new byte[ia]; es.read(bbb); - //System.out.println(new String(bbb)); } try { pi3.exitValue(); while ((ia = es.available()) != 0) { byte[] bbb = new byte[ia]; es.read(bbb); - //System.out.println(new String(bbb)); } break; } catch (IllegalThreadStateException e) { continue; } } - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_25): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest17.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest17.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest17.java (working copy) @@ -15,48 +15,26 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest17 extends TestCase { /** * in loop: creation of echo-process, touch its streams via available and * flush, destroy the process and touch streams again */ public void test_17() { - System.out.println("==test_17==="); int ia = 0; String cmnd = null; if (RuntimeAdditionalTest0.os.equals("Win")) { cmnd = RuntimeAdditionalTest0.cm + " /C \"echo 777\""; } else if (RuntimeAdditionalTest0.os.equals("Lin")) { - //cmnd = "/bin/sh -c \"echo 777\""; cmnd = "/bin/echo 777"; } else { - fail("WARNING (test_1): unknown operating system."); + fail("WARNING: unknown operating system."); } - while (ia++ < 600/*1000*//*10000*/) { + while (ia++ < 6) { try { Process pi3 = Runtime.getRuntime().exec(cmnd); java.io.OutputStream os = pi3.getOutputStream(); @@ -70,9 +48,7 @@ es.available(); os.flush(); } catch (Exception eeee) { - System.out.println("=="+ia+"==="); - eeee.printStackTrace(); - if(ia==1) fail("ERROR (test_17): unexpected exception."); + fail("ERROR " + ia + ": unexpected exception " + eeee); } } } Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest37.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest37.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest37.java (working copy) @@ -15,11 +15,6 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import java.io.BufferedReader; @@ -28,38 +23,20 @@ import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest37 extends TestCase { /** * check an environment variable appears correctly if exec(..., env, ...) is * used */ public void test_36_1() { - System.out.println("==test_36==="); String command = null; if (RuntimeAdditionalTest0.os.equals("Win")) { command = RuntimeAdditionalTest0.cm + " /C \"echo %Z_S_S_2%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\""; } else if (RuntimeAdditionalTest0.os.equals("Lin")) { - //command = "sh -c \"echo $Z_S_S_2\""; - //command = "echo $Z_S_S_2"; command = "/usr/bin/env"; } else { - fail("WARNING (test_1): unknown operating system."); + fail("WARNING: unknown operating system."); } String procValue = null; try { @@ -69,22 +46,18 @@ .getInputStream())); boolean flg = true; while ((procValue = br.readLine()) != null) { - //if (procValue.indexOf("Z_S_S_2=S_O_M_E_T_H_I_N_G") != -1) { if (procValue.indexOf(RuntimeAdditionalTest0.os.equals("Win")?"S_O_M_E_T_H_I_N_Gx":"S_O_M_E_T_H_I_N_G") != -1) { - //System.out.println(procValue); flg = false; return; } - System.out - .println("WARNING (test_36): should it be only singl line in env after such exec? (" - + procValue + ")"); + System.out.println("WARNING: should it be only single line" + + " in env after such exec? (" + procValue + ")"); } if (flg) { - fail("ERROR (test_36): Z_S_S_2 var should be present and assingned correctly."); + fail("ERROR: Z_S_S_2 var should be present and assigned correctly."); } - } catch (IOException e) { - e.printStackTrace(); - fail("ERROR (test_36): unexpected exception."); + } catch (Exception e) { + fail("ERROR: unexpected exception: " + e.toString()); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest0.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest0.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest0.java (working copy) @@ -15,11 +15,6 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import java.io.BufferedReader; @@ -28,21 +23,6 @@ import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest0 extends TestCase { public static String os; @@ -174,41 +154,21 @@ } java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader( proc.getInputStream())); - String rV; + String rV; while((rV = br.readLine())!=null && !rV.endsWith("/jre/bin/java")) { } - if(rV!=null) { - javaStarter = "/usr/jrockit-j2sdk1.4.2_04/jre/bin/java"; - javaStarter = "/usr/lib/java/jre/bin/java"; + if (rV != null) { javaStarter = rV; } else { - /* - String pathList = System.getProperty("java.library.path"); - String[] paths = pathList.split(File.pathSeparator); - int ind1; - for (ind1 = 0; ind1 < paths.length; ind1++) { - if (paths[ind1] == null) { - continue; - } - File asf = new java.io.File(paths[ind1] + File.separator - + "java"); - if (asf.exists()) { - javaStarter = paths[ind1] + File.separator + "java"; - break; - } - } - */ javaStarter = "/usr/lib/java/jre/bin/java"; // last hope :) } System.out.println(javaStarter); -} catch (java.io.IOException e) { + } catch (java.io.IOException e) { System.out .println("### WARNING: Some needed external java hasn't been found! A lot of RuntimeAdditionalTest* can fail due to this reason!"); - //System.out - // .println("### WARNING: java hasn't been found! You can set the path to java, for example, via java.library.path property."); - } + } -try { + try { Process proc = null; try { proc = Runtime.getRuntime().exec(new String[]{"find", "/usr", "-name", "tree"}); @@ -226,10 +186,10 @@ treeStarter = "/usr/bin/tree"; // last hope } System.out.println(treeStarter); - } catch (java.io.IOException e) { + } catch (java.io.IOException e) { System.out .println("### WARNING: tree command hasn't been found! A lot of RuntimeAdditionalTest* can fail due to this reason!"); - } + } try { Process proc = null; @@ -249,10 +209,10 @@ catStarter = "/bin/cat"; // last hope } System.out.println(catStarter); - } catch (java.io.IOException e) { + } catch (java.io.IOException e) { System.out .println("### WARNING: tree command hasn't been found! A lot of RuntimeAdditionalTest* can fail due to this reason!"); - } + } try { Process proc = null; @@ -273,10 +233,10 @@ } //psStarter = "/bin/ps"; // last hope System.out.println(psStarter); - } catch (java.io.IOException e) { + } catch (java.io.IOException e) { System.out .println("### WARNING: tree command hasn't been found! A lot of RuntimeAdditionalTest* can fail due to this reason!"); - } + } try { Process proc = null; @@ -296,10 +256,10 @@ killStarter = "/bin/kill"; // last hope } System.out.println(killStarter); - } catch (java.io.IOException e) { + } catch (java.io.IOException e) { System.out .println("### WARNING: tree command hasn't been found! A lot of RuntimeAdditionalTest* can fail due to this reason!"); - } + } } else { os = "Unk"; @@ -397,19 +357,6 @@ System.out.println(libFile); } - /* - * static String exeFile; static { File f = null; if (os.equals("Win")) { if - * ((f = seekFileInDirsHierarchic(new File("C:\\Program Files"), ".exe", - * fileLength)) != null ) { exeFile = f.getAbsolutePath(); } } else if - * (os.equals("Lin")){ if ((f = seekFileInDirsHierarchic(new File("/opt"), - * ".exe", fileLength)) != null ) { exeFile = f.getAbsolutePath(); } if (exeFile == - * null) { if ((f = seekFileInDirsHierarchic(new File("/usr"), ".exe", - * fileLength)) != null ) { exeFile = f.getAbsolutePath(); } } } else { exeFile = - * null; } if (exeFile == null) System.out.println("### WARNING: *.exe file - * hasn't been found! Tests aren't able for correct run."); - * System.out.println(exeFile); } - */ - protected void setUp() throws Exception { } @@ -421,7 +368,6 @@ * Process.destroy, Process.waitFor, Process.exitValue */ public void test_1() { - System.out.println("==test_1==="); String cmnd = null; if (os.equals("Win")) { cmnd = cm + " /C date"; @@ -430,21 +376,30 @@ } else { fail("WARNING (test_1): unknown operating system."); } + int loopCount; + int ia; if (os.equals("Win")) { try { Process pi3 = Runtime.getRuntime().exec(cmnd); - try { - Thread.sleep(2000); - } catch (Exception e) { - } +// 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) { - fail("ERROR (test_1): input stream is empty(1)."); + loopCount = 500; + ia = is.available(); + while (ia == 0 && loopCount-- > 0) { + try { + Thread.sleep(10); + ia = is.available(); + } catch (Exception e) { + } } - int ia = is.available(); + if (loopCount < 0) { + fail("ERROR: input stream is empty(1)."); + } byte[] bb = new byte[ia]; is.read(bb); String r1 = new String(bb); @@ -467,20 +422,24 @@ os.write('\n'); os.flush(); - try { - Thread.sleep(2000); - } catch (Exception e) { + loopCount = 500; + ia = is.available(); + while (ia == 0 && loopCount-- > 0) { + try { + Thread.sleep(10); + ia = is.available(); + } catch (Exception e) { + } } - if (is.available() < 1) { - fail("ERROR (test_1): input stream is empty(2)."); + if (loopCount < 0) { + fail("ERROR: input stream is empty(2)."); } - ia = is.available(); byte[] bbb = new byte[ia]; is.read(bbb); r1 = new String(bbb); if (r1.indexOf("The system cannot accept the date entered") == -1 && r1.indexOf("Enter the new date") == -1) { - fail("ERROR (test_1): unexpected message(2)."); + fail("ERROR: unexpected message(2)."); } os.write('\n'); try { @@ -492,37 +451,37 @@ } catch (InterruptedException ee) { } } - /*System.out.println(*/pi3.waitFor()/*)*/; + pi3.waitFor(); pi3.destroy(); - /*System.out.println(*/pi3.waitFor()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.waitFor(); + pi3.exitValue(); } catch (Exception eeee) { eeee.printStackTrace(); - fail("ERROR (test_1): unexpected exception."); + fail("ERROR: unexpected exception."); } } else if (os.equals("Lin")) { try { - //Process pi3 = Runtime.getRuntime().exec("sh -c \"sh - // -version\""); Process pi3 = Runtime.getRuntime().exec("sh -c date"); - pi3.getOutputStream(); - pi3.getErrorStream(); java.io.InputStream is = pi3.getInputStream(); - try { - Thread.sleep(1000); - } catch (Exception e) { + loopCount = 500; + ia = is.available(); + while (ia == 0 && loopCount-- > 0) { + try { + Thread.sleep(10); + ia = is.available(); + } catch (Exception e) { + } } - if (is.available() < 1) { - fail("ERROR (test_1): input stream is empty(1)."); + if (loopCount < 0) { + fail("ERROR: input stream is empty(1)."); } - int ia = is.available(); byte[] bb = new byte[ia]; is.read(bb); String r1 = new String(bb); if (r1.indexOf("S") == -1 && r1.indexOf("M") == -1 && r1.indexOf("T") == -1 && r1.indexOf("W") == -1 && r1.indexOf("F") == -1) { - fail("ERROR (test_1): unexpected message(1)." + r1); + fail("ERROR: unexpected message(1)." + r1); } for (int ii = 0; ii < ia; ii++) { bb[ii] = (byte) 0; @@ -530,16 +489,13 @@ Process pi4 = Runtime.getRuntime().exec("sh -c sh"); java.io.OutputStream os4 = pi4.getOutputStream(); - pi4.getErrorStream(); - pi4.getInputStream(); - +// try { +// Thread.sleep(1000); +// } catch (Exception e) { +// } try { - Thread.sleep(1000); - } catch (Exception e) { - } - try { pi4.exitValue(); - fail("ERROR (test_1): process should exist."); + fail("ERROR: process should exist."); } catch (IllegalThreadStateException e) { } os4.write('e'); @@ -548,56 +504,44 @@ os4.write('t'); os4.write('\n'); os4.flush(); + pi4.waitFor(); try { - Thread.sleep(1000); - } catch (Exception e) { - } - try { pi4.exitValue(); } catch (IllegalThreadStateException e) { - fail("ERROR (test_1): process should be destroyed."); + fail("ERROR: process should be destroyed."); } - /*System.out.println(*/pi4.waitFor()/*)*/; + pi4.waitFor(); pi4.destroy(); - /*System.out.println(*/pi4.waitFor()/*)*/; - /*System.out.println(*/pi4.exitValue()/*)*/; + pi4.waitFor(); + pi4.exitValue(); } catch (Exception eeee) { eeee.printStackTrace(); - fail("ERROR (test_1): unexpected exception."); + fail("ERROR: unexpected exception."); } } } - ////////////// Common additional service: /////////////// + + ////////////// Common additional service: /////////////// static java.io.DataOutputStream ps = null; static { - try{ - //String str = ":>"; + try { File fff = null; - //fff = new java.io.File("C:\\IJE\\orp\\ZSS\\___ttttt"+System.getProperty("java.vm.name")+".txt"); - //fff = new java.io.File("/nfs/ins/proj/drl/coreapi/ZSS/DRL_VM/___ttttt"+System.getProperty("java.vm.name")+".txt"); fff = new File(System.getProperty("java.io.tmpdir")+File.separator+"_messageOf_"+((System.getProperty("java.vm.name").indexOf("DRL")!=-1)?System.getProperty("java.vm.name"):"XXX")+"_"+System.getProperty("user.name")+".txt"); fff.createNewFile(); ps = new java.io.DataOutputStream(new java.io.FileOutputStream(fff)); - //ps.writeBytes(System.getProperties().toString()); - //new Throwable().printStackTrace(ps); - }catch(Throwable e){ - //if(System.getProperty("java.vm.name").indexOf("DRL")!=-1){int i=0,j=0; i=i/j;} + } catch (Throwable e) { } } static void doMessage(String mess){ - //ps.println(mess); try { ps.writeBytes(mess); } catch (java.io.IOException ee) {} } static void killCat() { - try{ - //String cmnd1 = RuntimeAdditionalTest0.os.equals("Win")?RuntimeAdditionalTest0.cm + " /C ps -Ws":RuntimeAdditionalTest0.cm + " -c \"ps -ef\""; - //String cmnd1 = RuntimeAdditionalTest0.os.equals("Win")?"C:\\CygWin\\bin\\ps -Ws":RuntimeAdditionalTest0.cm + " -c \"ps -ef\""; - //String cmnd1 = RuntimeAdditionalTest0.psStarter+(RuntimeAdditionalTest0.os.equals("Win")?" -Ws":" -ef"); - /**/String cmnd1 = RuntimeAdditionalTest0.psStarter+(RuntimeAdditionalTest0.os.equals("Win")?" -Ws":" -U "+System.getProperty("user.name")); + try { + String cmnd1 = RuntimeAdditionalTest0.psStarter+(RuntimeAdditionalTest0.os.equals("Win")?" -Ws":" -U "+System.getProperty("user.name")); Process pi5 = Runtime.getRuntime().exec(cmnd1); BufferedReader br = new BufferedReader(new InputStreamReader(pi5 .getInputStream())); @@ -605,36 +549,32 @@ String procValue = null; while (!br.ready()) {} while ((procValue = br.readLine()) != null) { -RuntimeAdditionalTest0.doMessage("9:"+procValue+"\n"); - if (procValue.indexOf("cat") != -1 /*&& (RuntimeAdditionalTest0.os.equals("Win")?true:procValue.indexOf(System.getProperty("user.name")) != -1)*/) { + RuntimeAdditionalTest0.doMessage("9:"+procValue+"\n"); + if (procValue.indexOf("cat") != -1) { flg = false; break; } } if (!flg) { String as[] = procValue.split(" "); -RuntimeAdditionalTest0.doMessage("XX:"+procValue+"\n"); + RuntimeAdditionalTest0.doMessage("XX:"+procValue+"\n"); for (int i = 0; i < as.length; i++) { if(as[i].matches("\\d+")){ - //cmnd1 = RuntimeAdditionalTest0.os.equals("Win")?RuntimeAdditionalTest0.cm + " /C kill "+as[i]:RuntimeAdditionalTest0.cm + " -c \"kill "+as[i]+"\""; - //cmnd1 = RuntimeAdditionalTest0.os.equals("Win")?"C:\\WINNT\\system32\\kill "+as[i]:RuntimeAdditionalTest0.cm + " -c \"kill "+as[i]+"\""; cmnd1 = RuntimeAdditionalTest0.killStarter+(RuntimeAdditionalTest0.os.equals("Win")?"":" -9")+" "+as[i]; -RuntimeAdditionalTest0.doMessage("XXX:"+cmnd1+"\n"); + RuntimeAdditionalTest0.doMessage("XXX:"+cmnd1+"\n"); Runtime.getRuntime().exec(cmnd1); Thread.sleep(3000); } } } - }catch(Exception e){ + } catch (Exception e) { fail("ERROR killCat: unexpected exception: "+e.toString()); } } static void killTree() { - try{ - //String cmnd1 = RuntimeAdditionalTest0.os.equals("Win")?RuntimeAdditionalTest0.cm + " /C ps -Ws":RuntimeAdditionalTest0.cm + " -c \"ps -ef\""; - //String cmnd1 = RuntimeAdditionalTest0.psStarter+(RuntimeAdditionalTest0.os.equals("Win")?" -Ws":" -ef"); - /**/String cmnd1 = RuntimeAdditionalTest0.psStarter+(RuntimeAdditionalTest0.os.equals("Win")?" -Ws":" -U "+System.getProperty("user.name")); + try { + String cmnd1 = RuntimeAdditionalTest0.psStarter+(RuntimeAdditionalTest0.os.equals("Win")?" -Ws":" -U "+System.getProperty("user.name")); Process pi5 = Runtime.getRuntime().exec(cmnd1); BufferedReader br = new BufferedReader(new InputStreamReader(pi5 .getInputStream())); @@ -642,7 +582,7 @@ String procValue = null; while (!br.ready()) {} while ((procValue = br.readLine()) != null) { - if (procValue.indexOf("tree") != -1 /*&& (RuntimeAdditionalTest0.os.equals("Win")?true:procValue.indexOf(System.getProperty("user.name")) != -1)*/) { + if (procValue.indexOf("tree") != -1) { flg = false; break; } @@ -651,14 +591,13 @@ String as[] = procValue.split(" "); for (int i = 0; i < as.length; i++) { if(as[i].matches("\\d+")){ - //cmnd1 = RuntimeAdditionalTest0.os.equals("Win")?RuntimeAdditionalTest0.cm + " /C kill "+as[i]:RuntimeAdditionalTest0.cm + " -c \"kill "+as[i]+"\""; cmnd1 = RuntimeAdditionalTest0.killStarter+(RuntimeAdditionalTest0.os.equals("Win")?"":" -9")+" "+as[i]; Runtime.getRuntime().exec(cmnd1); Thread.sleep(3000); } } } - }catch(Exception e){ + } catch (Exception e) { fail("ERROR killTree: unexpected exception: "+e.toString()); } } Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest4.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest4.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest4.java (working copy) @@ -15,49 +15,26 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest4 extends TestCase { /** - * sleep till finish of "java " process then exitValue, - * exitValue not to catch any exceptions + * wait for finish of "java " process + * then exitValue */ public void test_5() { - System.out.println("==test_5==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_5): unknown operating system."); + fail("WARNING: unknown operating system."); } try { - String cmnd = RuntimeAdditionalTest0.javaStarter+" MAIN"; + String cmnd = RuntimeAdditionalTest0.javaStarter + " MAIN"; Process pi3 = Runtime.getRuntime().exec(cmnd); - Thread.sleep(10000/*15000*/); - /*System.out.println(*/pi3.exitValue()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.waitFor(); + pi3.exitValue(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_5): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest8.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest8.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest8.java (working copy) @@ -15,46 +15,20 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest8 extends TestCase { /** * read the result of "cat " process using the "exitValue - * IllegalThreadStateException" loop to try to read all outed data */ public void test_9() { - System.out.println("==test_9==="); String cmnd = null; if (RuntimeAdditionalTest0.os.equals("Win")) { - //cmnd = RuntimeAdditionalTest0.cm+" /C cat \"C:\\WINNT\\system32\\cmd.exe\""; - //\\//\\cmnd = RuntimeAdditionalTest0.cm+" /C cat \"C:\\IJE\\orp\\ZSS\\___LOG2.DO_VM_CLEAN - // no\""; cmnd = RuntimeAdditionalTest0.cm + " /C cat \"" + RuntimeAdditionalTest0.textFile + "\""; } else if (RuntimeAdditionalTest0.os.equals("Lin")) { - //cmnd = "sh -c \"cat -v /lib/ld.so\""; - //\\//\\cmnd = "cat -v /lib/ld.so"; cmnd = "cat -v \"" + RuntimeAdditionalTest0.libFile + "\""; } else { fail("WARNING (test_1): unknown operating system."); @@ -62,26 +36,18 @@ try { Process pi3 = Runtime.getRuntime().exec(cmnd); - //try { - // Thread.sleep(2000); - //} catch (Exception e) { - //} - pi3.getOutputStream(); - pi3.getErrorStream(); java.io.InputStream is = pi3.getInputStream(); int ia; while (true) { while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //\\//\\System.out.println(new String(bbb)); } try { pi3.exitValue(); while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //\\//\\System.out.println(new String(bbb)); } break; } catch (IllegalThreadStateException e) { @@ -90,8 +56,7 @@ } } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_9): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest14.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest14.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest14.java (working copy) @@ -19,51 +19,31 @@ import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest14 extends TestCase { /** * reading the streams after destroy */ public void test_14() { - System.out.println("==test_14==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_14): unknown operating system."); + fail("WARNING: unknown operating system."); } try { String cmnd = RuntimeAdditionalTest0.javaStarter; Process pi3 = Runtime.getRuntime().exec(cmnd); - pi3.getOutputStream(); - pi3.getErrorStream(); java.io.InputStream is = pi3.getInputStream(); pi3.destroy(); - Thread.sleep(5000); +// Thread.sleep(5000); int ia; while (true) { while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //System.out.println(new String(bbb)); } try { pi3.exitValue(); while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //System.out.println(new String(bbb)); } break; } catch (IllegalThreadStateException e) { @@ -71,8 +51,7 @@ } } } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_14): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest26.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest26.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest26.java (working copy) @@ -15,72 +15,48 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest26 extends TestCase { /** * get jvm process' streams, destroy, waitFor finish of the process then * read err stream, then exitValue */ public void test_26() { - System.out.println("==test_26==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_26): unknown operating system."); + fail("WARNING: unknown operating system."); } try { String cmnd = RuntimeAdditionalTest0.javaStarter+" MAIN"; Process pi3 = Runtime.getRuntime().exec(cmnd); - /*System.out.println(*/pi3.waitFor()/*)*/; + pi3.waitFor(); pi3.getOutputStream(); java.io.InputStream es = pi3.getErrorStream(); pi3.getInputStream(); pi3.destroy(); - /*System.out.println(*/pi3.waitFor()/*)*/; + pi3.waitFor(); int ia; while (true) { while ((ia = es.available()) != 0) { byte[] bbb = new byte[ia]; es.read(bbb); - //System.out.println(new String(bbb)); } try { pi3.exitValue(); while ((ia = es.available()) != 0) { byte[] bbb = new byte[ia]; es.read(bbb); - //System.out.println(new String(bbb)); } break; } catch (IllegalThreadStateException e) { continue; } } - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_26): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest18.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest18.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest18.java (working copy) @@ -15,38 +15,17 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest18 extends TestCase { /** * read jvm output, destroy, exitValue, exitValue and, maybe, read again */ public void test_18() { - System.out.println("==test_18==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_18): unknown operating system."); + fail("WARNING: unknown operating system."); } try { String cmnd = RuntimeAdditionalTest0.javaStarter; @@ -59,14 +38,12 @@ while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //System.out.println(new String(bbb)); } try { pi3.exitValue(); while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //System.out.println(new String(bbb)); } break; } catch (IllegalThreadStateException e) { @@ -74,20 +51,18 @@ } } pi3.destroy(); - /*System.out.println(*/pi3.exitValue()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); + pi3.exitValue(); while (true) { while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //System.out.println(new String(bbb)); } try { pi3.exitValue(); while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //System.out.println(new String(bbb)); } break; } catch (IllegalThreadStateException e) { @@ -95,8 +70,7 @@ } } } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_18): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest38.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest38.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest38.java (working copy) @@ -15,11 +15,6 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import java.io.File; @@ -29,35 +24,17 @@ import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest38 extends TestCase { /** * check possibility of big env array defining via exec(..., env, ...) and * long file name via exec(..., file) */ public void test_36() { - System.out.println("==test_36==="); String command = null; if (RuntimeAdditionalTest0.os.equals("Win")) { command = RuntimeAdditionalTest0.cm + " /C \"echo %Z_S_S_2%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\""; } else if (RuntimeAdditionalTest0.os.equals("Lin")) { - //command = "sh -c \"echo $Z_S_S_2\""; - //command = "echo $Z_S_S_2"; command = "/usr/bin/env"; } else { fail("WARNING (test_1): unknown operating system."); @@ -68,24 +45,20 @@ new String[] { "Z_S_S_2=S_O_M_E_T_H_I_N_G" }); BufferedReader br = new BufferedReader(new InputStreamReader(proc .getInputStream())); - //procValue = br.readLine(); boolean flg = true; while ((procValue = br.readLine()) != null) { - //if (procValue.indexOf("Z_S_S_2=S_O_M_E_T_H_I_N_G") != -1) { if (procValue.indexOf(RuntimeAdditionalTest0.os.equals("Win")?"S_O_M_E_T_H_I_N_Gx":"S_O_M_E_T_H_I_N_G") != -1) { flg = false; break; } - System.out - .println("WARNING (test_36): should it be only singl line in env after such exec? (" - + procValue + ")"); + System.out.println("WARNING: should it be only single line" + + " in env after such exec? (" + procValue + ")"); } if (flg) { - fail("ERROR (test_36): Z_S_S_2 var should be present and assingned correctly."); + fail("ERROR: Z_S_S_2 var should be present and assigned correctly."); } - } catch (IOException e) { - e.printStackTrace(); - fail("ERROR (test_36): unexpected exception."); + } catch (Exception e) { + fail("ERROR: unexpected exception: " + e.toString()); } try { String ts = "Z_S_S_3=S_O_M_E_T_H_I_N_G L_O_N_GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"; @@ -104,7 +77,6 @@ ts, ts, ts, ts, ts, ts, ts, ts, ts, ts, ts2, ts, ts, ts, ts, ts, ts, ts, ts, ts, ts, ts, ts, ts, ts, ts, ts, ts2, ts, ts, ts, ts, ts, - // ts, }, new File("." + File.separator + ".." + File.separator + ".." + File.separator + ".." + File.separator @@ -123,9 +95,6 @@ + File.separator + ".." + File.separator + File.separator + ".." + File.separator + ".." + File.separator + ".." + File.separator + ".." - //+ File.separator + ".." + File.separator - //+ File.separator + ".." + File.separator + ".." - //+ File.separator + ".." + File.separator + ".." + File.separator + ".." + File.separator + File.separator + ".." + File.separator + ".." + File.separator + ".." + File.separator + ".." @@ -151,9 +120,8 @@ BufferedReader br = new BufferedReader(new InputStreamReader(proc .getInputStream())); procValue = br.readLine(); - } catch (java.io.IOException e) { - e.printStackTrace(); - fail("ERROR (test_36): unexpected exception."); + } catch (Exception e) { + fail("ERROR: unexpected exception: " + e.toString()); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest1.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest1.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest1.java (working copy) @@ -15,50 +15,28 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest1 extends TestCase { + /** - * destroy java process then chain of Process.waitFor, Process.exitValue, - * Process.exitValue + * destroy java process then Process.waitFor, Process.exitValue */ public void test_2() { System.out.println("==test_2==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_2): unknown operating system."); + fail("WARNING: unknown operating system."); } try { String cmnd = RuntimeAdditionalTest0.javaStarter; Process pi3 = Runtime.getRuntime().exec(cmnd); pi3.destroy(); - /*System.out.println(*/pi3.waitFor()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.waitFor(); + pi3.exitValue(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_2): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest5.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest5.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest5.java (working copy) @@ -15,39 +15,18 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest5 extends TestCase { /** * destroy java process then "exitValue - IllegalThreadStateException" loop * until the process disappearing */ public void test_6() { - System.out.println("==test_6==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_6): unknown operating system."); + fail("WARNING: unknown operating system."); } try { String cmnd = RuntimeAdditionalTest0.javaStarter; @@ -55,15 +34,14 @@ pi3.destroy(); while (true) { try { - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); break; } catch (IllegalThreadStateException e) { continue; } } } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_6): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest23.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest23.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest23.java (working copy) @@ -15,39 +15,18 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest23 extends TestCase { /** * get jvm process' streams, wait for finish of the process then read input * stream, then exitValue */ public void test_23() { - System.out.println("==test_23==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_23): unknown operating system."); + fail("WARNING: unknown operating system."); } try { String cmnd = RuntimeAdditionalTest0.javaStarter; @@ -58,7 +37,7 @@ while (true) { try { Thread.sleep(50); - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); break; } catch (IllegalThreadStateException e) { continue; @@ -69,24 +48,21 @@ while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //System.out.println(new String(bbb)); } try { pi3.exitValue(); while ((ia = is.available()) != 0) { byte[] bbb = new byte[ia]; is.read(bbb); - //System.out.println(new String(bbb)); } break; } catch (IllegalThreadStateException e) { continue; } } - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_23): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest15.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest15.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest15.java (working copy) @@ -15,43 +15,22 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; import java.io.IOException; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest15 extends TestCase { /** * creation and destroying a lot of jvm-processes getting their streams */ public void test_15() { - System.out.println("==test_15==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_15): unknown operating system."); + fail("WARNING: unknown operating system."); } int ia = 0; String cmnd = RuntimeAdditionalTest0.javaStarter; - while (ia++ < 5/*100*//*300*//*3000*/) { + while (ia++ < 5) { try { Process pi3 = Runtime.getRuntime().exec(cmnd); pi3.getOutputStream(); @@ -83,18 +62,15 @@ pi34.destroy(); pi35.destroy(); pi36.destroy(); - Thread.sleep(50); pi3.getOutputStream(); pi3.getErrorStream(); is = pi3.getInputStream(); try { - is.available(); - } catch (IOException _) { + is.available(); + } catch (IOException _) { } } catch (Exception eeee) { - System.out.println("=="+ia+"==="); - eeee.printStackTrace(); - if (ia == 1) fail("ERROR (test_15): unexpected exception just at the first java invocation."); + fail("ERROR " + ia + ": unexpected exception " + eeee); } } } Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest19.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest19.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest19.java (working copy) @@ -15,50 +15,28 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest19 extends TestCase { /** * destroy jvm process, "destroy" again, exitValue, exitValue */ public void test_19() { - System.out.println("==test_19==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_19): unknown operating system."); + fail("WARNING: unknown operating system."); } try { String cmnd = RuntimeAdditionalTest0.javaStarter; Process pi3 = Runtime.getRuntime().exec(cmnd); pi3.destroy(); - Thread.sleep(5000); + pi3.waitFor(); pi3.destroy(); - /*System.out.println(*/pi3.exitValue()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); + pi3.exitValue(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_19): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file Index: vm/tests/kernel/java/lang/RuntimeAdditionalTest2.java =================================================================== --- vm/tests/kernel/java/lang/RuntimeAdditionalTest2.java (revision 524066) +++ vm/tests/kernel/java/lang/RuntimeAdditionalTest2.java (working copy) @@ -15,81 +15,54 @@ * limitations under the License. */ -/** - * @author Serguei S.Zapreyev - * @version $Revision$ - */ - package java.lang; import junit.framework.TestCase; -/* - * Created on March 29, 2006 - * - * This RuntimeAdditionalTest class is used to test the Core API Runtime class - * - */ - -/** - * ############################################################################### - * ############################################################################### - * TODO: 1. - * ############################################################################### - * ############################################################################### - */ - public class RuntimeAdditionalTest2 extends TestCase { /** - * 1. destroy java process then Process.exitValue 2. waitFor java process - * then Process.exitValue, Process.exitValue 3. destroy "java -version" - * process then Process.exitValue, Process.exitValue + * 1. destroy java process then Process.exitValue + * 2. waitFor java process then Process.exitValue, Process.exitValue + * 3. destroy "java -version" process + * then Process.exitValue, Process.exitValue */ public void test_3() { - System.out.println("==test_3==="); if (RuntimeAdditionalTest0.os.equals("Unk")) { - fail("WARNING (test_3): unknown operating system."); + fail("WARNING: unknown operating system."); } Process pi3 = null; try { - String cmnd = RuntimeAdditionalTest0.javaStarter; pi3 = Runtime.getRuntime().exec(cmnd); pi3.destroy(); - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.exitValue(); } catch (Exception eeee) { - //eeee.printStackTrace(); while (true) { try { - /*System.out.println(=ntln("XXX: " + */pi3.exitValue()/*)*/; + pi3.exitValue(); break; } catch (IllegalThreadStateException e) { continue; } } } - /*System.out.println("YYY: " + */pi3.exitValue()/*)*/; try { - String cmnd = RuntimeAdditionalTest0.javaStarter; pi3 = Runtime.getRuntime().exec(cmnd); - /*System.out.println(*/pi3.waitFor()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.waitFor(); + pi3.exitValue(); + pi3.exitValue(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_3): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } try { - - String cmnd = RuntimeAdditionalTest0.javaStarter+" -version"; + String cmnd = RuntimeAdditionalTest0.javaStarter + " -version"; pi3 = Runtime.getRuntime().exec(cmnd); - /*System.out.println(*/pi3.waitFor()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; - /*System.out.println(*/pi3.exitValue()/*)*/; + pi3.waitFor(); + pi3.exitValue(); + pi3.exitValue(); } catch (Exception eeee) { - eeee.printStackTrace(); - fail("ERROR (test_3): unexpected exception."); + fail("ERROR: unexpected exception " + eeee); } } } \ No newline at end of file