test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageRuntimeBase.java
branchJDK-8200758-branch
changeset 57445 405ddd80496e
parent 57419 44c2481650ce
equal deleted inserted replaced
57444:91e9d4691e5e 57445:405ddd80496e
    24 import java.io.File;
    24 import java.io.File;
    25 import java.nio.file.Files;
    25 import java.nio.file.Files;
    26 
    26 
    27  public class JPackageCreateAppImageRuntimeBase {
    27  public class JPackageCreateAppImageRuntimeBase {
    28     private static final String app = JPackagePath.getApp();
    28     private static final String app = JPackagePath.getApp();
    29     private static final String appWorkingDir = JPackagePath.getAppWorkingDir();
       
    30     private static final String runtimeJava = JPackagePath.getRuntimeJava();
    29     private static final String runtimeJava = JPackagePath.getRuntimeJava();
    31     private static final String runtimeJavaOutput = "javaOutput.txt";
    30     private static final String runtimeJavaOutput = "javaOutput.txt";
    32     private static final String appOutput = JPackagePath.getAppOutputFile();
    31     private static final String appOutput = JPackagePath.getAppOutputFile();
    33 
    32 
    34     private static void validateResult(String[] result) throws Exception {
    33     private static void validateResult(String[] result) throws Exception {
    49         int retVal = JPackageHelper.execute(null, app);
    48         int retVal = JPackageHelper.execute(null, app);
    50         if (retVal != 0) {
    49         if (retVal != 0) {
    51             throw new AssertionError("Test application exited with error: " + retVal);
    50             throw new AssertionError("Test application exited with error: " + retVal);
    52         }
    51         }
    53 
    52 
    54         File outfile = new File(appWorkingDir + File.separator + appOutput);
    53         File outfile = new File(appOutput);
    55         if (!outfile.exists()) {
    54         if (!outfile.exists()) {
    56             throw new AssertionError(appOutput + " was not created");
    55             throw new AssertionError(appOutput + " was not created");
    57         }
    56         }
    58 
    57 
    59         String output = Files.readString(outfile.toPath());
    58         String output = Files.readString(outfile.toPath());
    82             throw new AssertionError("Unexpected result: " + result[0]);
    81             throw new AssertionError("Unexpected result: " + result[0]);
    83         }
    82         }
    84     }
    83     }
    85 
    84 
    86     public static void testCreateAppImage(String [] cmd) throws Exception {
    85     public static void testCreateAppImage(String [] cmd) throws Exception {
       
    86 System.out.println("----- current dir = " + System.getProperty("user.dir"));
    87         JPackageHelper.executeCLI(true, cmd);
    87         JPackageHelper.executeCLI(true, cmd);
       
    88 System.out.println("----- current dir = " + System.getProperty("user.dir"));
    88         validate();
    89         validate();
    89         validateRuntime();
    90         validateRuntime();
    90     }
    91     }
    91 
    92 
    92     public static void testCreateAppImageToolProvider(String [] cmd) throws Exception {
    93     public static void testCreateAppImageToolProvider(String [] cmd) throws Exception {
       
    94 System.out.println("----- ToolProvider current dir = " + System.getProperty("user.dir"));
    93         JPackageHelper.executeToolProvider(true, cmd);
    95         JPackageHelper.executeToolProvider(true, cmd);
       
    96 System.out.println("----- ToolProvider current dir = " + System.getProperty("user.dir"));
    94         validate();
    97         validate();
    95         validateRuntime();
    98         validateRuntime();
    96     }
    99     }
    97 
   100 
    98 }
   101 }