diff -r 094b5d3c7159 -r 43fb1c9e594c jdk/test/com/sun/tools/attach/RunnerUtil.java --- a/jdk/test/com/sun/tools/attach/RunnerUtil.java Thu May 08 08:22:25 2014 +0900 +++ b/jdk/test/com/sun/tools/attach/RunnerUtil.java Fri Apr 25 17:19:49 2014 +0200 @@ -24,12 +24,11 @@ import java.io.IOException; import java.io.File; import java.nio.file.Files; -import java.nio.file.Path; import java.util.Arrays; import java.util.regex.Pattern; import java.util.regex.Matcher; + import jdk.testlibrary.OutputAnalyzer; -import jdk.testlibrary.JDKToolLauncher; import jdk.testlibrary.ProcessTools; import jdk.testlibrary.Utils; import jdk.testlibrary.ProcessThread; @@ -39,6 +38,7 @@ * (Test runner = class that launch a test) */ public class RunnerUtil { + /** * The Application process must be run concurrently with our tests since * the tests will attach to the Application. @@ -49,16 +49,31 @@ * * The Application will write its pid and shutdownPort in the given outFile. */ - public static ProcessThread startApplication(String outFile) throws Throwable { + public static ProcessThread startApplication(String outFile, String... additionalOpts) throws Throwable { String classpath = System.getProperty("test.class.path", "."); - String[] args = Utils.addTestJavaOpts( - "-Dattach.test=true", "-classpath", classpath, "Application", outFile); + String[] myArgs = concat(additionalOpts, new String [] { "-Dattach.test=true", "-classpath", classpath, "Application", outFile }); + String[] args = Utils.addTestJavaOpts(myArgs); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args); ProcessThread pt = new ProcessThread("runApplication", pb); pt.start(); return pt; } + public static String[] concat(String[] a, String[] b) { + if (a == null) { + return b; + } + if (b == null) { + return a; + } + int aLen = a.length; + int bLen = b.length; + String[] c = new String[aLen + bLen]; + System.arraycopy(a, 0, c, 0, aLen); + System.arraycopy(b, 0, c, aLen, bLen); + return c; + } + /** * Will stop the running Application. * First tries to shutdown nicely by connecting to the shut down port.