@@ -593,27 +593,42 @@ private void installWhiteBox() {
593
593
* Disable IR verification completely in certain cases.
594
594
*/
595
595
private void disableIRVerificationIfNotFeasible () {
596
- if (irVerificationPossible ) {
597
- irVerificationPossible = Platform .isDebugBuild () && !Platform .isInt () && !Platform .isComp ();
598
- if (!irVerificationPossible ) {
599
- System .out .println ("IR verification disabled due to not running a debug build (required for PrintIdeal" +
600
- "and PrintOptoAssembly), running with -Xint, or -Xcomp (use warm-up of 0 instead)" );
601
- return ;
602
- }
596
+ if (!irVerificationPossible ) {
597
+ return ;
598
+ }
603
599
604
- irVerificationPossible = hasIRAnnotations ();
605
- if (!irVerificationPossible ) {
606
- System .out .println ("IR verification disabled due to test " + testClass + " not specifying any @IR annotations" );
607
- return ;
608
- }
600
+ boolean debugTest = Platform .isDebugBuild ();
601
+ boolean intTest = !Platform .isInt ();
602
+ boolean compTest = !Platform .isComp ();
603
+ boolean irTest = hasIRAnnotations ();
604
+ // No IR verification is done if additional non-whitelisted JTreg VM or Javaoptions flag is specified.
605
+ List <String > nonWhiteListedFlags = anyNonWhitelistedJTregVMAndJavaOptsFlags ();
606
+ boolean nonWhiteListedTest = nonWhiteListedFlags .isEmpty ();
609
607
610
- // No IR verification is done if additional non-whitelisted JTreg VM or Javaoptions flag is specified.
611
- irVerificationPossible = onlyWhitelistedJTregVMAndJavaOptsFlags ();
612
- if (!irVerificationPossible ) {
613
- System .out .println ("IR verification disabled due to using non-whitelisted JTreg VM or Javaoptions flag(s)."
614
- + System .lineSeparator ());
615
- }
608
+ irVerificationPossible = debugTest && intTest && compTest && irTest && nonWhiteListedTest ;
609
+ if (irVerificationPossible ) {
610
+ return ;
616
611
}
612
+
613
+ System .out .println ("IR verification disabled due to the following reason(s):" );
614
+ if (!debugTest ) {
615
+ System .out .println ("- Not running a debug build (required for PrintIdeal and PrintOptoAssembly)" );
616
+ }
617
+ if (!intTest ) {
618
+ System .out .println ("- Running with -Xint (no compilations)" );
619
+ }
620
+ if (!compTest ) {
621
+ System .out .println ("- Running with -Xcomp (use warm-up of 0 instead)" );
622
+ }
623
+ if (!irTest ) {
624
+ System .out .println ("- Test " + testClass + " not specifying any @IR annotations" );
625
+ }
626
+ if (!nonWhiteListedTest ) {
627
+ System .out .println ("- Using non-whitelisted JTreg VM or Javaoptions flag(s):" );
628
+ nonWhiteListedFlags .forEach ((f ) -> System .out .println (" - " + f ));
629
+ }
630
+
631
+ System .out .println ("" );
617
632
}
618
633
619
634
/**
@@ -741,18 +756,19 @@ private boolean hasIRAnnotations() {
741
756
return Arrays .stream (testClass .getDeclaredMethods ()).anyMatch (m -> m .getAnnotationsByType (IR .class ).length > 0 );
742
757
}
743
758
744
- private boolean onlyWhitelistedJTregVMAndJavaOptsFlags () {
759
+ private List < String > anyNonWhitelistedJTregVMAndJavaOptsFlags () {
745
760
List <String > flags = Arrays .stream (Utils .getTestJavaOpts ())
746
761
.map (s -> s .replaceFirst ("-XX:[+|-]?|-(?=[^D|^e])" , "" ))
747
762
.collect (Collectors .toList ());
763
+ List <String > nonWhiteListedFlags = new ArrayList ();
748
764
for (String flag : flags ) {
749
765
// Property flags (prefix -D), -ea and -esa are whitelisted.
750
766
if (!flag .startsWith ("-D" ) && !flag .startsWith ("-e" ) && JTREG_WHITELIST_FLAGS .stream ().noneMatch (flag ::contains )) {
751
767
// Found VM flag that is not whitelisted
752
- return false ;
768
+ nonWhiteListedFlags . add ( flag ) ;
753
769
}
754
770
}
755
- return true ;
771
+ return nonWhiteListedFlags ;
756
772
}
757
773
758
774
private void runTestVM (List <String > additionalFlags ) {
0 commit comments