< prev index next >

test/jtreg-ext/requires/VMProps.java

Print this page

652      * Checks if we are in <i>almost</i> out-of-box configuration, i.e. the flags
653      * which JVM is started with don't affect its behavior "significantly".
654      * {@code TEST_VM_FLAGLESS} enviroment variable can be used to force this
655      * method to return true and allow any flags.
656      *
657      * @return true if there are no JVM flags
658      */
659     private String isFlagless() {
660         boolean result = true;
661         if (System.getenv("TEST_VM_FLAGLESS") != null) {
662             return "" + result;
663         }
664 
665         List<String> allFlags = allFlags().toList();
666 
667         // check -XX flags
668         var ignoredXXFlags = Set.of(
669                 // added by run-test framework
670                 "MaxRAMPercentage",
671                 // added by test environment
672                 "CreateCoredumpOnCrash"




673         );
674         result &= allFlags.stream()
675                           .filter(s -> s.startsWith("-XX:"))
676                           // map to names:
677                               // remove -XX:
678                               .map(s -> s.substring(4))
679                               // remove +/- from bool flags
680                               .map(s -> s.charAt(0) == '+' || s.charAt(0) == '-' ? s.substring(1) : s)
681                               // remove =.* from others
682                               .map(s -> s.contains("=") ? s.substring(0, s.indexOf('=')) : s)
683                           // skip known-to-be-there flags
684                           .filter(s -> !ignoredXXFlags.contains(s))
685                           .findAny()
686                           .isEmpty();
687 
688         // check -X flags
689         var ignoredXFlags = Set.of(
690                 // default, yet still seen to be explicitly set
691                 "mixed",
692                 // -XmxmNNNm added by run-test framework for non-hotspot tests

652      * Checks if we are in <i>almost</i> out-of-box configuration, i.e. the flags
653      * which JVM is started with don't affect its behavior "significantly".
654      * {@code TEST_VM_FLAGLESS} enviroment variable can be used to force this
655      * method to return true and allow any flags.
656      *
657      * @return true if there are no JVM flags
658      */
659     private String isFlagless() {
660         boolean result = true;
661         if (System.getenv("TEST_VM_FLAGLESS") != null) {
662             return "" + result;
663         }
664 
665         List<String> allFlags = allFlags().toList();
666 
667         // check -XX flags
668         var ignoredXXFlags = Set.of(
669                 // added by run-test framework
670                 "MaxRAMPercentage",
671                 // added by test environment
672                 "CreateCoredumpOnCrash",
673                 // experimental features unlocking flag does not affect behavior
674                 "UnlockExperimentalVMOptions",
675                 // all compact headers settings should run flagless tests
676                 "UseCompactObjectHeaders"
677         );
678         result &= allFlags.stream()
679                           .filter(s -> s.startsWith("-XX:"))
680                           // map to names:
681                               // remove -XX:
682                               .map(s -> s.substring(4))
683                               // remove +/- from bool flags
684                               .map(s -> s.charAt(0) == '+' || s.charAt(0) == '-' ? s.substring(1) : s)
685                               // remove =.* from others
686                               .map(s -> s.contains("=") ? s.substring(0, s.indexOf('=')) : s)
687                           // skip known-to-be-there flags
688                           .filter(s -> !ignoredXXFlags.contains(s))
689                           .findAny()
690                           .isEmpty();
691 
692         // check -X flags
693         var ignoredXFlags = Set.of(
694                 // default, yet still seen to be explicitly set
695                 "mixed",
696                 // -XmxmNNNm added by run-test framework for non-hotspot tests
< prev index next >