177 178 cmd.add(System.getProperty("java.home") + separator + "bin" + separator + "java"); 179 for (final String str : forkJVMOptions) { 180 if(!str.isEmpty()) { 181 cmd.add(str); 182 } 183 } 184 cmd.add(Shell.class.getName()); 185 // now add the rest of the "in process" runtime arguments 186 cmd.addAll(getRuntimeArgs()); 187 188 final File outputFileHandle = new File(outputFileName); 189 final File errorFileHandle = new File(errorFileName); 190 191 try { 192 final ProcessBuilder pb = new ProcessBuilder(cmd); 193 pb.redirectOutput(outputFileHandle); 194 pb.redirectError(errorFileHandle); 195 final Process process = pb.start(); 196 197 process.waitFor(); 198 199 if (errorFileHandle.length() > 0) { 200 if (expectRunFailure) { 201 return; 202 } 203 if (!ignoreStdError) { 204 if (outputFileHandle.length() > 0) { 205 TestHelper.dumpFile(outputFileHandle); 206 } 207 fail(TestHelper.fullContent(errorFileHandle)); 208 } 209 } 210 211 if (compare) { 212 compare(outputFileName, expectedFileName, false); 213 } 214 } catch (final IOException | InterruptedException e) { 215 if (!expectRunFailure) { 216 fail("Failure running test " + testFile + ": " + e.getMessage()); 217 // else success 218 } 219 } | 177 178 cmd.add(System.getProperty("java.home") + separator + "bin" + separator + "java"); 179 for (final String str : forkJVMOptions) { 180 if(!str.isEmpty()) { 181 cmd.add(str); 182 } 183 } 184 cmd.add(Shell.class.getName()); 185 // now add the rest of the "in process" runtime arguments 186 cmd.addAll(getRuntimeArgs()); 187 188 final File outputFileHandle = new File(outputFileName); 189 final File errorFileHandle = new File(errorFileName); 190 191 try { 192 final ProcessBuilder pb = new ProcessBuilder(cmd); 193 pb.redirectOutput(outputFileHandle); 194 pb.redirectError(errorFileHandle); 195 final Process process = pb.start(); 196 197 final int exitCode = process.waitFor(); 198 199 if (exitCode != 0 || errorFileHandle.length() > 0) { 200 if (expectRunFailure) { 201 return; 202 } 203 if (!ignoreStdError) { 204 if (outputFileHandle.length() > 0) { 205 TestHelper.dumpFile(outputFileHandle); 206 } 207 fail(TestHelper.fullContent(errorFileHandle)); 208 } 209 } 210 211 if (compare) { 212 compare(outputFileName, expectedFileName, false); 213 } 214 } catch (final IOException | InterruptedException e) { 215 if (!expectRunFailure) { 216 fail("Failure running test " + testFile + ": " + e.getMessage()); 217 // else success 218 } 219 } |