hotspot/test/compiler/aot/cli/jaotc/JaotcTestHelper.java
changeset 46826 dae7992b1615
parent 46804 db2cd95b294c
equal deleted inserted replaced
46824:9e13f4eb7670 46826:dae7992b1615
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 package compiler.aot.cli.jaotc;
    24 package compiler.aot.cli.jaotc;
    25 
    25 
       
    26 import compiler.aot.AotCompiler;
       
    27 
    26 import java.io.File;
    28 import java.io.File;
    27 import java.io.IOException;
    29 import java.io.IOException;
       
    30 
    28 import jdk.test.lib.process.ExitCode;
    31 import jdk.test.lib.process.ExitCode;
    29 import jdk.test.lib.Platform;
    32 import jdk.test.lib.Platform;
    30 import jdk.test.lib.JDKToolLauncher;
    33 import jdk.test.lib.JDKToolLauncher;
    31 import jdk.test.lib.Utils;
    34 import jdk.test.lib.Utils;
    32 import jdk.test.lib.cli.CommandLineOptionTest;
    35 import jdk.test.lib.cli.CommandLineOptionTest;
    33 import jdk.test.lib.process.OutputAnalyzer;
    36 import jdk.test.lib.process.OutputAnalyzer;
       
    37 import jdk.test.lib.process.ProcessTools;
    34 
    38 
    35 public class JaotcTestHelper {
    39 public class JaotcTestHelper {
    36     public static final String DEFAULT_LIB_PATH = "./unnamed." + Platform.sharedLibraryExt();
    40     public static final String DEFAULT_LIB_PATH = "./unnamed." + Platform.sharedLibraryExt();
    37     public static final String DEFAULT_LIBRARY_LOAD_MESSAGE = "loaded    " + DEFAULT_LIB_PATH
    41     public static final String DEFAULT_LIBRARY_LOAD_MESSAGE = "loaded    " + DEFAULT_LIB_PATH
    38             + "  aot library";
    42             + "  aot library";
    47         }
    51         }
    48         launcher.addToolArg("--compile-with-assertions");
    52         launcher.addToolArg("--compile-with-assertions");
    49         for (String arg : args) {
    53         for (String arg : args) {
    50             launcher.addToolArg(arg);
    54             launcher.addToolArg(arg);
    51         }
    55         }
       
    56         String linker = AotCompiler.resolveLinker();
       
    57         if (linker != null) {
       
    58             launcher.addToolArg("--linker-path");
       
    59             launcher.addToolArg(linker);
       
    60         }
    52         String[] cmd = launcher.getCommand();
    61         String[] cmd = launcher.getCommand();
    53         try {
    62         try {
    54             return new OutputAnalyzer(new ProcessBuilder(cmd).start());
    63             return ProcessTools.executeCommand(cmd);
    55         } catch (IOException e) {
    64         } catch (Throwable e) {
    56             throw new Error("Can't start test process: " + e, e);
    65             throw new Error("Can't start test process: " + e, e);
    57         }
    66         }
    58     }
    67     }
    59 
    68 
    60     public static void checkLibraryUsage(String classToRun) {
    69     public static void checkLibraryUsage(String classToRun) {