559 * {@code TEST_VM_FLAGLESS} enviroment variable can be used to force this
560 * method to return true and allow any flags.
561 *
562 * @return true if there are no JVM flags
563 */
564 private String isFlagless() {
565 boolean result = true;
566 if (System.getenv("TEST_VM_FLAGLESS") != null) {
567 return "" + result;
568 }
569
570 List<String> allFlags = new ArrayList<String>();
571 Collections.addAll(allFlags, System.getProperty("test.vm.opts", "").trim().split("\\s+"));
572 Collections.addAll(allFlags, System.getProperty("test.java.opts", "").trim().split("\\s+"));
573
574 // check -XX flags
575 var ignoredXXFlags = Set.of(
576 // added by run-test framework
577 "MaxRAMPercentage",
578 // added by test environment
579 "CreateCoredumpOnCrash"
580 );
581 result &= allFlags.stream()
582 .filter(s -> s.startsWith("-XX:"))
583 // map to names:
584 // remove -XX:
585 .map(s -> s.substring(4))
586 // remove +/- from bool flags
587 .map(s -> s.charAt(0) == '+' || s.charAt(0) == '-' ? s.substring(1) : s)
588 // remove =.* from others
589 .map(s -> s.contains("=") ? s.substring(0, s.indexOf('=')) : s)
590 // skip known-to-be-there flags
591 .filter(s -> !ignoredXXFlags.contains(s))
592 .findAny()
593 .isEmpty();
594
595 // check -X flags
596 var ignoredXFlags = Set.of(
597 // default, yet still seen to be explicitly set
598 "mixed",
599 // -XmxmNNNm added by run-test framework for non-hotspot tests
|
559 * {@code TEST_VM_FLAGLESS} enviroment variable can be used to force this
560 * method to return true and allow any flags.
561 *
562 * @return true if there are no JVM flags
563 */
564 private String isFlagless() {
565 boolean result = true;
566 if (System.getenv("TEST_VM_FLAGLESS") != null) {
567 return "" + result;
568 }
569
570 List<String> allFlags = new ArrayList<String>();
571 Collections.addAll(allFlags, System.getProperty("test.vm.opts", "").trim().split("\\s+"));
572 Collections.addAll(allFlags, System.getProperty("test.java.opts", "").trim().split("\\s+"));
573
574 // check -XX flags
575 var ignoredXXFlags = Set.of(
576 // added by run-test framework
577 "MaxRAMPercentage",
578 // added by test environment
579 "CreateCoredumpOnCrash",
580 // experimental features unlocking flag does not affect behavior
581 "UnlockExperimentalVMOptions",
582 // all compact headers settings should run flagless tests
583 "UseCompactObjectHeaders"
584 );
585 result &= allFlags.stream()
586 .filter(s -> s.startsWith("-XX:"))
587 // map to names:
588 // remove -XX:
589 .map(s -> s.substring(4))
590 // remove +/- from bool flags
591 .map(s -> s.charAt(0) == '+' || s.charAt(0) == '-' ? s.substring(1) : s)
592 // remove =.* from others
593 .map(s -> s.contains("=") ? s.substring(0, s.indexOf('=')) : s)
594 // skip known-to-be-there flags
595 .filter(s -> !ignoredXXFlags.contains(s))
596 .findAny()
597 .isEmpty();
598
599 // check -X flags
600 var ignoredXFlags = Set.of(
601 // default, yet still seen to be explicitly set
602 "mixed",
603 // -XmxmNNNm added by run-test framework for non-hotspot tests
|