< prev index next >

test/jdk/tools/jpackage/share/JavaOptionsEqualsTest.java

Print this page
rev 57304 : 8235625: [TESTBUG] tools/jpackage/share/JavaOptionsEqualsTest.java fails with debug VMs
Reviewed-by:


  64 
  65     private static void validate() throws Exception {
  66         File outfile = new File("app.out");
  67 
  68         int retVal = JPackageHelper.execute(outfile, app);
  69         if (retVal != 0) {
  70             throw new AssertionError(
  71                    "Test application exited with error: " + retVal);
  72         }
  73 
  74         if (!outfile.exists()) {
  75             throw new AssertionError(
  76                     "outfile: " + outfile + " was not created");
  77         }
  78 
  79         String output = Files.readString(outfile.toPath());
  80         System.out.println("App output:");
  81         System.out.print(output);
  82 
  83         String[] result = JPackageHelper.splitAndFilter(output);
  84         if (result.length != 4) {
  85             throw new AssertionError(
  86                    "Unexpected number of lines: " + result.length
  87                    + " - output: " + output);
  88         }
  89 
  90         String nextWarning = WARNING_1;
  91         if (!result[0].startsWith(nextWarning)){
  92             nextWarning = WARNING_2;
  93             if (!result[0].startsWith(WARNING_2)){
  94                 throw new AssertionError("Unexpected result[0]: " + result[0]);
  95             } else {
  96                 nextWarning = WARNING_1;
  97             }
  98         }
  99 
 100         if (!result[1].startsWith(nextWarning)) {
 101             throw new AssertionError("Unexpected result[1]: " + result[1]);
 102         }
 103 
 104         if (!result[2].trim().endsWith("jpackage test application")) {
 105             throw new AssertionError("Unexpected result[2]: " + result[2]);
 106         }
 107 
 108         if (!result[3].trim().equals("args.length: 0")) {
 109             throw new AssertionError("Unexpected result[3]: " + result[3]);
 110         }
 111     }
 112 
 113     public static void main(String[] args) throws Exception {
 114         JPackageHelper.createHelloImageJar();
 115         String output = JPackageHelper.executeCLI(true, CMD);
 116         validate();
 117 
 118         JPackageHelper.deleteOutputFolder(OUTPUT);
 119         output = JPackageHelper.executeToolProvider(true, CMD);
 120         validate();
 121     }
 122 
 123 }


  64 
  65     private static void validate() throws Exception {
  66         File outfile = new File("app.out");
  67 
  68         int retVal = JPackageHelper.execute(outfile, app);
  69         if (retVal != 0) {
  70             throw new AssertionError(
  71                    "Test application exited with error: " + retVal);
  72         }
  73 
  74         if (!outfile.exists()) {
  75             throw new AssertionError(
  76                     "outfile: " + outfile + " was not created");
  77         }
  78 
  79         String output = Files.readString(outfile.toPath());
  80         System.out.println("App output:");
  81         System.out.print(output);
  82 
  83         String[] result = JPackageHelper.splitAndFilter(output);
  84         if (result.length < 4) {
  85             throw new AssertionError(
  86                    "Unexpected number of lines: " + result.length
  87                    + " - output: " + output);
  88         }
  89 
  90         String nextWarning = WARNING_1;
  91         if (!result[0].startsWith(nextWarning)){
  92             nextWarning = WARNING_2;
  93             if (!result[0].startsWith(WARNING_2)){
  94                 throw new AssertionError("Unexpected result[0]: " + result[0]);
  95             } else {
  96                 nextWarning = WARNING_1;
  97             }
  98         }
  99 
 100         if (!result[1].startsWith(nextWarning)) {
 101             throw new AssertionError("Unexpected result[1]: " + result[1]);
 102         }
 103 
 104         if (!result[result.length - 2].trim().endsWith("jpackage test application")) {
 105             throw new AssertionError("Unexpected result[2]: " + result[2]);
 106         }
 107 
 108         if (!result[result.length - 1].trim().equals("args.length: 0")) {
 109             throw new AssertionError("Unexpected result[3]: " + result[3]);
 110         }
 111     }
 112 
 113     public static void main(String[] args) throws Exception {
 114         JPackageHelper.createHelloImageJar();
 115         String output = JPackageHelper.executeCLI(true, CMD);
 116         validate();
 117 
 118         JPackageHelper.deleteOutputFolder(OUTPUT);
 119         output = JPackageHelper.executeToolProvider(true, CMD);
 120         validate();
 121     }
 122 
 123 }
< prev index next >