< prev index next >

test/jtreg-ext/requires/VMProps.java

Print this page

507      * {@code TEST_VM_FLAGLESS} enviroment variable can be used to force this
508      * method to return true and allow any flags.
509      *
510      * @return true if there are no JVM flags
511      */
512     private String isFlagless() {
513         boolean result = true;
514         if (System.getenv("TEST_VM_FLAGLESS") != null) {
515             return "" + result;
516         }
517 
518         List<String> allFlags = new ArrayList<String>();
519         Collections.addAll(allFlags, System.getProperty("test.vm.opts", "").trim().split("\\s+"));
520         Collections.addAll(allFlags, System.getProperty("test.java.opts", "").trim().split("\\s+"));
521 
522         // check -XX flags
523         var ignoredXXFlags = Set.of(
524                 // added by run-test framework
525                 "MaxRAMPercentage",
526                 // added by test environment
527                 "CreateCoredumpOnCrash"




528         );
529         result &= allFlags.stream()
530                           .filter(s -> s.startsWith("-XX:"))
531                           // map to names:
532                               // remove -XX:
533                               .map(s -> s.substring(4))
534                               // remove +/- from bool flags
535                               .map(s -> s.charAt(0) == '+' || s.charAt(0) == '-' ? s.substring(1) : s)
536                               // remove =.* from others
537                               .map(s -> s.contains("=") ? s.substring(0, s.indexOf('=')) : s)
538                           // skip known-to-be-there flags
539                           .filter(s -> !ignoredXXFlags.contains(s))
540                           .findAny()
541                           .isEmpty();
542 
543         // check -X flags
544         var ignoredXFlags = Set.of(
545                 // default, yet still seen to be explicitly set
546                 "mixed"
547         );

507      * {@code TEST_VM_FLAGLESS} enviroment variable can be used to force this
508      * method to return true and allow any flags.
509      *
510      * @return true if there are no JVM flags
511      */
512     private String isFlagless() {
513         boolean result = true;
514         if (System.getenv("TEST_VM_FLAGLESS") != null) {
515             return "" + result;
516         }
517 
518         List<String> allFlags = new ArrayList<String>();
519         Collections.addAll(allFlags, System.getProperty("test.vm.opts", "").trim().split("\\s+"));
520         Collections.addAll(allFlags, System.getProperty("test.java.opts", "").trim().split("\\s+"));
521 
522         // check -XX flags
523         var ignoredXXFlags = Set.of(
524                 // added by run-test framework
525                 "MaxRAMPercentage",
526                 // added by test environment
527                 "CreateCoredumpOnCrash",
528                 // experimental features unlocking flag does not affect behavior
529                 "UnlockExperimentalVMOptions",
530                 // all compact headers settings should run flagless tests
531                 "UseCompactObjectHeaders"
532         );
533         result &= allFlags.stream()
534                           .filter(s -> s.startsWith("-XX:"))
535                           // map to names:
536                               // remove -XX:
537                               .map(s -> s.substring(4))
538                               // remove +/- from bool flags
539                               .map(s -> s.charAt(0) == '+' || s.charAt(0) == '-' ? s.substring(1) : s)
540                               // remove =.* from others
541                               .map(s -> s.contains("=") ? s.substring(0, s.indexOf('=')) : s)
542                           // skip known-to-be-there flags
543                           .filter(s -> !ignoredXXFlags.contains(s))
544                           .findAny()
545                           .isEmpty();
546 
547         // check -X flags
548         var ignoredXFlags = Set.of(
549                 // default, yet still seen to be explicitly set
550                 "mixed"
551         );
< prev index next >