From 29acb9063ace3558f9c8280b3f418a17ae15be8d Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Sat, 20 Mar 2021 14:25:39 +0700 Subject: [PATCH] Fix test relying on JVM warning being stripped from output 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 --- .../java/org/aspectj/testing/AntSpec.java | 8 +++----- .../org/aspectj/systemtest/ajc150/ltw/ltw.xml | 19 +++++++++---------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/testing/src/test/java/org/aspectj/testing/AntSpec.java b/testing/src/test/java/org/aspectj/testing/AntSpec.java index b5f23ca74..92ea21877 100644 --- a/testing/src/test/java/org/aspectj/testing/AntSpec.java +++ b/testing/src/test/java/org/aspectj/testing/AntSpec.java @@ -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); } } diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ltw/ltw.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ltw/ltw.xml index 5565e91b7..652ddecd5 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ltw/ltw.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ltw/ltw.xml @@ -511,7 +511,6 @@ - @@ -550,11 +549,11 @@ - @@ -657,8 +656,8 @@ files="MultipleDumpTest.java, Class1.java, Class2.java, Class3.java" options="-1.5" /> - @@ -672,7 +671,7 @@ - - + + -- 2.39.5