test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageBase.java
branchJDK-8200758-branch
changeset 57407 2c14fbeff1dc
parent 57405 539d8b3f9e1e
child 57419 44c2481650ce
--- a/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageBase.java	Thu Jun 13 19:34:44 2019 -0400
+++ b/test/jdk/tools/jpackage/createappimage/JPackageCreateAppImageBase.java	Fri Jun 14 12:04:12 2019 -0400
@@ -23,6 +23,7 @@
 
 import java.io.File;
 import java.nio.file.Files;
+import java.nio.file.Path;
 
 public abstract class JPackageCreateAppImageBase {
     private static final String appOutput = JPackagePath.getAppOutputFile();
@@ -44,18 +45,27 @@
     }
 
     public static void validate(String app) throws Exception {
-        int retVal = JPackageHelper.execute(null, app);
+        Path outPath = Path.of(appWorkingDir, appOutput);
+        int retVal = JPackageHelper.execute(outPath.toFile(), app);
+
+        if (outPath.toFile().exists()) {
+             System.out.println("output contents: ");
+             System.out.println(Files.readString(outPath) + "\n");
+        } else {
+             System.out.println("no output file: " + outPath
+                   + " from command: " + app);
+        }
+
         if (retVal != 0) {
             throw new AssertionError(
-                   "Test application exited with error: " + retVal);
+                "Test application (" + app + ") exited with error: " + retVal);
         }
 
-        File outfile = new File(appWorkingDir + File.separator + appOutput);
-        if (!outfile.exists()) {
+        if (!outPath.toFile().exists()) {
             throw new AssertionError(appOutput + " was not created");
         }
 
-        String output = Files.readString(outfile.toPath());
+        String output = Files.readString(outPath);
         String[] result = output.split("\n");
         validateResult(result);
     }