Package org.z.system

Examples of org.z.system.ProcessExecuter


    String inputFile = "org/z/test/" + name + ".java";
    new File("org/z/test").mkdirs();
    Resources.ExtractResource("org/z/test/" + name + ".in.txt", inputFile);
   
    // check syntax
    ProcessExecuter p = new ProcessExecuter("javac org/z/test/" + name + ".java");
    ProcessOutput pout = p.execute();
    if(!pout.getStderr().trim().equals("")) {
      System.err.println(pout.getStderr().trim());
      throw new Exception(pout.getStderr().trim());
    }
   
    // run
    try {
      Z z = new Z(new String[] {inputFile});
      z.getClassPath().add(new ClassPathItem("../library", ""));
      z.getClassPath().add(new ClassPathItem("../library/java/lang", "java/lang"));
      z.setMainClass("org.z.test.HelloWorld");
      z.run();
    }
    catch(CompilerException e) {
      e.printStackTrace();
    }
   
    // run it
    ProcessExecuter p2 = new ProcessExecuter("./a.out");
    ProcessOutput pout2 = p2.execute();
    String output = pout2.getStdout() + pout2.getStderr().trim();
    //System.out.println(output);
   
    // compare result
    String expected = Resources.FetchResource("org/z/test/" + name + ".out.txt");
View Full Code Here

TOP

Related Classes of org.z.system.ProcessExecuter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.