115 pb.command(launcher.getCommand()); 116 System.out.println( 117 pb.command().stream().collect(Collectors.joining(" "))); 118 119 try { 120 p = pb.start(); 121 } catch (Exception attachE) { 122 throw new Error("Couldn't start jhsdb or attach to LingeredApp : " + attachE); 123 } 124 125 // Issue the 'printmdo' input at the clhsdb prompt. 126 OutputStream input = p.getOutputStream(); 127 String str = "printmdo -a > " + PRINTMDO_OUT_FILE + "\nquit\n"; 128 try { 129 input.write(str.getBytes()); 130 input.flush(); 131 } catch (IOException ioe) { 132 throw new Error("Problem issuing the printmdo command: " + str, ioe); 133 } 134 135 try { 136 p.waitFor(); 137 } catch (InterruptedException ie) { 138 throw new Error("Problem awaiting the child process: " + ie, ie); 139 } 140 141 int exitValue = p.exitValue(); 142 if (exitValue != 0) { 143 String output; 144 try { 145 output = new OutputAnalyzer(p).getOutput(); 146 } catch (IOException ioe) { 147 throw new Error("Can't get failed clhsdb process output: " + ioe, ioe); 148 } 149 throw new AssertionError("clhsdb wasn't run successfully: " + output); 150 } 151 } 152 153 public static void main (String... args) throws Exception { 154 155 LingeredApp app = null; 156 157 if (!Platform.shouldSAAttach()) { 158 System.out.println( 159 "SA attach not expected to work - test skipped."); 160 return; 161 } 162 163 try { 164 List<String> vmArgs = new ArrayList<String>(); 165 vmArgs.add("-XX:+ProfileInterpreter"); 166 vmArgs.addAll(Utils.getVmOptions()); 167 168 app = LingeredApp.startApp(vmArgs); 169 System.out.println ("Started LingeredApp with pid " + app.getPid()); 170 startClhsdbForPrintMdo(app.getPid()); | 115 pb.command(launcher.getCommand()); 116 System.out.println( 117 pb.command().stream().collect(Collectors.joining(" "))); 118 119 try { 120 p = pb.start(); 121 } catch (Exception attachE) { 122 throw new Error("Couldn't start jhsdb or attach to LingeredApp : " + attachE); 123 } 124 125 // Issue the 'printmdo' input at the clhsdb prompt. 126 OutputStream input = p.getOutputStream(); 127 String str = "printmdo -a > " + PRINTMDO_OUT_FILE + "\nquit\n"; 128 try { 129 input.write(str.getBytes()); 130 input.flush(); 131 } catch (IOException ioe) { 132 throw new Error("Problem issuing the printmdo command: " + str, ioe); 133 } 134 135 OutputAnalyzer output = new OutputAnalyzer(p); 136 137 try { 138 p.waitFor(); 139 } catch (InterruptedException ie) { 140 p.destroyForcibly(); 141 throw new Error("Problem awaiting the child process: " + ie, ie); 142 } 143 144 output.shouldHaveExitValue(0); 145 } 146 147 public static void main (String... args) throws Exception { 148 149 LingeredApp app = null; 150 151 if (!Platform.shouldSAAttach()) { 152 System.out.println( 153 "SA attach not expected to work - test skipped."); 154 return; 155 } 156 157 try { 158 List<String> vmArgs = new ArrayList<String>(); 159 vmArgs.add("-XX:+ProfileInterpreter"); 160 vmArgs.addAll(Utils.getVmOptions()); 161 162 app = LingeredApp.startApp(vmArgs); 163 System.out.println ("Started LingeredApp with pid " + app.getPid()); 164 startClhsdbForPrintMdo(app.getPid()); |