]> source.dussan.org Git - aspectj.git/commitdiff
Fix test relying on JVM warning being stripped from output
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Sat, 20 Mar 2021 07:25:39 +0000 (14:25 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Sat, 20 Mar 2021 07:27:28 +0000 (14:27 +0700)
The line in which warnings like "Archived non-system classes are
disabled because the java.system.class.loader property is specified"
appears can start with e.g."OpenJDK 64-Bit Server VM" or "Java
HotSpot(TM) 64-Bit Server VM". Therefore, an exact match on the former
worked on Linux, but not on Windows, or maybe the difference is
generally between Oracle and OpenJDK. anyway, I use Oracle on Windows
and my build failed. Now it is fixed because I made the match more
generic using a regex.

I also removed a now obsolete check for the occurrence of the stripped
line in test "JDK14 LTW with XML".

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
testing/src/test/java/org/aspectj/testing/AntSpec.java
tests/src/test/resources/org/aspectj/systemtest/ajc150/ltw/ltw.xml

index b5f23ca74c553b8e5e1a7508cb7dbbaf284cfb71..92ea2187765d94fae9e3c7a2f9d1c26d8c28fc85 100644 (file)
@@ -225,11 +225,9 @@ public class AntSpec implements ITestStep {
                                stderr2 = stderr2.replaceAll("WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations\n","");
                                stderr2 = stderr2.replaceAll("WARNING: All illegal access operations will be denied in a future release\n","");
                        }
-                       // J12
-                       String msg = "Java HotSpot(TM) 64-Bit Server VM warning: Archived non-system classes are disabled because the java.system.class.loader property is specified (value = \"org.aspectj.weaver.loadtime.WeavingURLClassLoader\"). To use archived non-system classes, this property must not be set";
-                       if (stderr2.contains(msg)) {
-                               stderr2 = stderr2.replace(msg+"\n","");
-                       }
+                       // J12: Line can start with e.g."OpenJDK 64-Bit Server VM" or "Java HotSpot(TM) 64-Bit Server VM". Therefore,
+                       // we have to match a substring instead of a whole line
+                       stderr2 = stderr2.replaceAll("[^\n]+ warning: Archived non-system classes are disabled because the java.system.class.loader property is specified .*org.aspectj.weaver.loadtime.WeavingURLClassLoader[^\n]+\n?","");
                        m_stdErrSpec.matchAgainst(stderr2);
                }
        }
index 5565e91b7dee6ec9febd4ad9e8357c8410334b86..652ddecd5d387f60601bde8b6ef2f4dfcb7df24a 100644 (file)
                        <line text="Hello World!" />
                </stdout>
                <stderr>
-               <line text="Archived non-system classes are disabled" vm="14+"/>
                        <line text="TraceFactory.instance=" />
                </stderr>
        </ant>
                </stdout>
        </ant>
 </ajc-test>
-<!-- <ajc-test dir="ltw" title="TestServer with Parent and Child" keywords="ltw,server"> 
-       <compile files="Parent.java" options="-outjar parent.jar"/> <compile files="Child.java" 
-       options="-classpath parent.jar -outjar child.jar"/> <ant file="ant-server.xml" 
-       target="TestServer with Parent and Child" verbose="true"> <stdout> <line 
-       text="Starting ..."/> <line text="Running Child"/> <line text="Parent"/> 
+<!-- <ajc-test dir="ltw" title="TestServer with Parent and Child" keywords="ltw,server">
+       <compile files="Parent.java" options="-outjar parent.jar"/> <compile files="Child.java"
+       options="-classpath parent.jar -outjar child.jar"/> <ant file="ant-server.xml"
+       target="TestServer with Parent and Child" verbose="true"> <stdout> <line
+       text="Starting ..."/> <line text="Running Child"/> <line text="Parent"/>
        <line text="Child"/> <line text="Stopping ..."/> </stdout> </ant> </ajc-test> -->
 <ajc-test dir="ltw" title="TestServer with Parent and Child"
        keywords="ltw,server">
                files="MultipleDumpTest.java, Class1.java, Class2.java, Class3.java"
                options="-1.5" />
        <compile files="Aspect.aj" options="-1.5 -outxml -Xlint:ignore" />
-       <!-- <run class="MultipleDumpTest" ltw="aop-multipledumponerror.xml"> <stdout> 
-               <line text="? AbortingMessageHandler.AbortingMessageHandler()"/> </stdout> 
+       <!-- <run class="MultipleDumpTest" ltw="aop-multipledumponerror.xml"> <stdout>
+               <line text="? AbortingMessageHandler.AbortingMessageHandler()"/> </stdout>
                </run> -->
        <ant file="ant.xml" target="multiple dump on error" verbose="true">
                <stdout>
                </stdout>
        </ant>
 </ajc-test>
-    
-    
+
+
 
 </suite>