test/lib/jdk/test/lib/cds/CDSTestUtils.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff test/lib/jdk/test/lib/cds

test/lib/jdk/test/lib/cds/CDSTestUtils.java

Print this page




 194             return this;
 195         }
 196 
 197 
 198         public Result assertNormalExit(String... matches) throws Exception {
 199             if (!hasMappingFailure) {
 200                 checkMatches(output, matches);
 201                 output.shouldHaveExitValue(0);
 202             }
 203             return this;
 204         }
 205 
 206         public Result assertAbnormalExit(String... matches) throws Exception {
 207             if (!hasMappingFailure) {
 208                 checkMatches(output, matches);
 209                 output.shouldNotHaveExitValue(0);
 210             }
 211 
 212             return this;
 213         }




 214     }
 215 
 216     // Specify this property to copy sdandard output of the child test process to
 217     // the parent/main stdout of the test.
 218     // By default such output is logged into a file, and is copied into the main stdout.
 219     public static final boolean CopyChildStdoutToMainStdout =
 220         Boolean.valueOf(System.getProperty("test.cds.copy.child.stdout", "true"));
 221 
 222     // This property is passed to child test processes
 223     public static final String TestTimeoutFactor = System.getProperty("test.timeout.factor", "1.0");
 224 
 225     public static final String UnableToMapMsg =
 226         "Unable to map shared archive: test did not complete; assumed PASS";
 227 
 228     // Create bootstrap CDS archive,
 229     // use extra JVM command line args as a prefix.
 230     // For CDS tests specifying prefix makes more sense than specifying suffix, since
 231     // normally there are no classes or arguments to classes, just "-version"
 232     // To specify suffix explicitly use CDSOptions.addSuffix()
 233     public static OutputAnalyzer createArchive(String... cliPrefix)


 346         if ((output.getExitValue() == 1) && (
 347             outStr.contains("Unable to reserve shared space at required address") ||
 348             outStr.contains("Unable to map ReadOnly shared space at required address") ||
 349             outStr.contains("Unable to map ReadWrite shared space at required address") ||
 350             outStr.contains("Unable to map MiscData shared space at required address") ||
 351             outStr.contains("Unable to map MiscCode shared space at required address") ||
 352             outStr.contains("Unable to map OptionalData shared space at required address") ||
 353             outStr.contains("Could not allocate metaspace at a compatible address") ||
 354             outStr.contains("UseSharedSpaces: Unable to allocate region, range is not within java heap") ))
 355         {
 356             return true;
 357         }
 358 
 359         return false;
 360     }
 361 
 362     public static Result run(String... cliPrefix) throws Exception {
 363         CDSOptions opts = new CDSOptions();
 364         opts.setArchiveName(getDefaultArchiveName());
 365         opts.addPrefix(cliPrefix);




 366         return new Result(opts, runWithArchive(opts));
 367     }
 368 
 369     // Execute JVM with CDS archive, specify command line args suffix
 370     public static OutputAnalyzer runWithArchive(String... cliPrefix)
 371         throws Exception {
 372 
 373         return runWithArchive( (new CDSOptions())
 374                                .setArchiveName(getDefaultArchiveName())
 375                                .addPrefix(cliPrefix) );
 376     }
 377 
 378 
 379     // Execute JVM with CDS archive, specify CDSOptions
 380     public static OutputAnalyzer runWithArchive(CDSOptions opts)
 381         throws Exception {
 382 
 383         ArrayList<String> cmd = new ArrayList<String>();
 384 
 385         for (String p : opts.prefix) cmd.add(p);




 194             return this;
 195         }
 196 
 197 
 198         public Result assertNormalExit(String... matches) throws Exception {
 199             if (!hasMappingFailure) {
 200                 checkMatches(output, matches);
 201                 output.shouldHaveExitValue(0);
 202             }
 203             return this;
 204         }
 205 
 206         public Result assertAbnormalExit(String... matches) throws Exception {
 207             if (!hasMappingFailure) {
 208                 checkMatches(output, matches);
 209                 output.shouldNotHaveExitValue(0);
 210             }
 211 
 212             return this;
 213         }
 214 
 215         public OutputAnalyzer getOutput() {
 216             return output;
 217         }
 218     }
 219 
 220     // Specify this property to copy sdandard output of the child test process to
 221     // the parent/main stdout of the test.
 222     // By default such output is logged into a file, and is copied into the main stdout.
 223     public static final boolean CopyChildStdoutToMainStdout =
 224         Boolean.valueOf(System.getProperty("test.cds.copy.child.stdout", "true"));
 225 
 226     // This property is passed to child test processes
 227     public static final String TestTimeoutFactor = System.getProperty("test.timeout.factor", "1.0");
 228 
 229     public static final String UnableToMapMsg =
 230         "Unable to map shared archive: test did not complete; assumed PASS";
 231 
 232     // Create bootstrap CDS archive,
 233     // use extra JVM command line args as a prefix.
 234     // For CDS tests specifying prefix makes more sense than specifying suffix, since
 235     // normally there are no classes or arguments to classes, just "-version"
 236     // To specify suffix explicitly use CDSOptions.addSuffix()
 237     public static OutputAnalyzer createArchive(String... cliPrefix)


 350         if ((output.getExitValue() == 1) && (
 351             outStr.contains("Unable to reserve shared space at required address") ||
 352             outStr.contains("Unable to map ReadOnly shared space at required address") ||
 353             outStr.contains("Unable to map ReadWrite shared space at required address") ||
 354             outStr.contains("Unable to map MiscData shared space at required address") ||
 355             outStr.contains("Unable to map MiscCode shared space at required address") ||
 356             outStr.contains("Unable to map OptionalData shared space at required address") ||
 357             outStr.contains("Could not allocate metaspace at a compatible address") ||
 358             outStr.contains("UseSharedSpaces: Unable to allocate region, range is not within java heap") ))
 359         {
 360             return true;
 361         }
 362 
 363         return false;
 364     }
 365 
 366     public static Result run(String... cliPrefix) throws Exception {
 367         CDSOptions opts = new CDSOptions();
 368         opts.setArchiveName(getDefaultArchiveName());
 369         opts.addPrefix(cliPrefix);
 370         return new Result(opts, runWithArchive(opts));
 371     }
 372 
 373     public static Result run(CDSOptions opts) throws Exception {
 374         return new Result(opts, runWithArchive(opts));
 375     }
 376 
 377     // Execute JVM with CDS archive, specify command line args suffix
 378     public static OutputAnalyzer runWithArchive(String... cliPrefix)
 379         throws Exception {
 380 
 381         return runWithArchive( (new CDSOptions())
 382                                .setArchiveName(getDefaultArchiveName())
 383                                .addPrefix(cliPrefix) );
 384     }
 385 
 386 
 387     // Execute JVM with CDS archive, specify CDSOptions
 388     public static OutputAnalyzer runWithArchive(CDSOptions opts)
 389         throws Exception {
 390 
 391         ArrayList<String> cmd = new ArrayList<String>();
 392 
 393         for (String p : opts.prefix) cmd.add(p);


test/lib/jdk/test/lib/cds/CDSTestUtils.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File