From 3dc53e0351a37fc6d3f6a6e311df0320987edc48 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Thu, 31 Mar 2022 12:50:14 +0700 Subject: POM bug: separate jvm.arg.allowSecurityManager from jvm.arg.addOpens Before, this was in a single variable, and for JDK 18+, the security manager setting also falsely overwrote the '--add-opens' command. This was the root cause for a few dozen LTW tests to fail on JDK 18, if they were not run in full LTW mode, i.e. in a separate JVM. After this fix, it should be possible to revert the corresponding commits, at least their non-cosmetic parts. Signed-off-by: Alexander Kriegisch --- docs/developer/BUILD.md | 8 ++++++-- pom.xml | 9 +++++++-- run-all-junit-tests/pom.xml | 6 ++++-- testing-drivers/pom.xml | 5 ++++- tests/pom.xml | 5 ++++- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/docs/developer/BUILD.md b/docs/developer/BUILD.md index d19c4013d..2cc8bfff5 100644 --- a/docs/developer/BUILD.md +++ b/docs/developer/BUILD.md @@ -110,12 +110,16 @@ Other existing profiles, which developers are less likely to actively use becaus profile is inactive by default, because in the context of a Maven build it would cause all tests to be run twice (during module build and again when running the big suite), hence the profile name. - * `jdk-8-to-15` - Activated automatically on JDKs 8-15, setting property `jvm.arg.addOpens` to an empty value, because - it is only needed on JDK 16+, see next bullet point. + * `jdk-8-to-15` - Activated automatically on JDKs 8-15, setting properties `jvm.arg.addOpens` and + `jvm.arg.allowSecurityManager` to empty values, because they are only needed on JDK 16+ or 18+, respectively. See + next bullet point. * `jdk-16-to-xx` - Activated automatically on JDKs 16+, setting property `jvm.arg.addOpens` to value `--add-opens java.base/java.lang=ALL-UNNAMED`, which is needed in order to run LTW tests. + * `jdk-18-to-xx` - Activated automatically on JDKs 18+, setting property `jvm.arg.allowSecurityManager` to value + `-Djava.security.manager=allow`, which is needed by some tests in order to override `System.exit`. + ### Build properties The following properties and their default values in different profile are used in order to activate or skip Maven diff --git a/pom.xml b/pom.xml index b5b640a9d..cade005da 100644 --- a/pom.xml +++ b/pom.xml @@ -196,6 +196,7 @@ + @@ -205,6 +206,7 @@ --add-opens java.base/java.lang=ALL-UNNAMED + @@ -218,7 +220,7 @@ As of Java 18, the new API for blocking System.exit is not available yet, see https://bugs.openjdk.java.net/browse/JDK-8199704. --> - -Djava.security.manager=allow + -Djava.security.manager=allow @@ -268,7 +270,10 @@ 2.22.2 - ${jvm.arg.addOpens} + + ${jvm.arg.addOpens} + ${jvm.arg.allowSecurityManager} + **/*ModuleTests.java diff --git a/run-all-junit-tests/pom.xml b/run-all-junit-tests/pom.xml index 583acfae1..30df18d38 100644 --- a/run-all-junit-tests/pom.xml +++ b/run-all-junit-tests/pom.xml @@ -198,7 +198,10 @@ maven-surefire-plugin true - ${jvm.arg.addOpens} + + ${jvm.arg.addOpens} + ${jvm.arg.allowSecurityManager} + @@ -253,4 +256,3 @@ - diff --git a/testing-drivers/pom.xml b/testing-drivers/pom.xml index e22c688a2..30b75c3ca 100644 --- a/testing-drivers/pom.xml +++ b/testing-drivers/pom.xml @@ -55,7 +55,10 @@ maven-surefire-plugin false - ${jvm.arg.addOpens} + + ${jvm.arg.addOpens} + ${jvm.arg.allowSecurityManager} + **/*AjcTestSpecAsTest* diff --git a/tests/pom.xml b/tests/pom.xml index 21efac3cc..7b5e400bd 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -122,7 +122,10 @@ maven-surefire-plugin false - ${jvm.arg.addOpens} + + ${jvm.arg.addOpens} + ${jvm.arg.allowSecurityManager} + **/TestsModuleTests* -- cgit v1.2.3 From f80addbd89a6c15bb208c9f931913e4ca0c0d221 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Thu, 31 Mar 2022 12:54:07 +0700 Subject: Revert "A few dozen more tests need 'useFullLTW' mode" This reverts commit 8c15d83a466843b5dba8ba454329baaca0080cc5. --- .../org/aspectj/systemtest/ajc150/ajc150.xml | 14 +-- .../org/aspectj/systemtest/ajc150/ltw/ltw.xml | 2 +- .../org/aspectj/systemtest/ajc151/ajc151.xml | 92 ++++++++--------- .../org/aspectj/systemtest/ajc152/ajc152.xml | 10 +- .../aspectj/systemtest/ajc152/synchronization.xml | 114 ++++++++++----------- .../org/aspectj/systemtest/ajc153/ajc153.xml | 8 +- .../org/aspectj/systemtest/ajc154/ajc154.xml | 4 +- .../org/aspectj/systemtest/ajc1612/ajc1612.xml | 24 ++--- .../org/aspectj/systemtest/ajc162/ajc162.xml | 6 +- .../org/aspectj/systemtest/ajc164/ajc164.xml | 2 +- .../org/aspectj/systemtest/ajc170/ajc170.xml | 4 +- .../org/aspectj/systemtest/ajc180/ajc180.xml | 8 +- .../org/aspectj/systemtest/ajc1810/ajc1810.xml | 2 +- 13 files changed, 145 insertions(+), 145 deletions(-) diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ajc150.xml index 0eb724096..7963070e0 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ajc150.xml @@ -6174,7 +6174,7 @@ - + @@ -6184,7 +6184,7 @@ - + @@ -6194,7 +6194,7 @@ - + @@ -6204,7 +6204,7 @@ - + @@ -6214,7 +6214,7 @@ - + @@ -6225,7 +6225,7 @@ - + @@ -6235,7 +6235,7 @@ - + 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 6e66e388e..66cd3cfbf 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 @@ -215,7 +215,7 @@ - + diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc151/ajc151.xml index f92d235e2..8d8cd66b8 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc151/ajc151.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc151/ajc151.xml @@ -4,7 +4,7 @@ - + @@ -20,7 +20,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -70,7 +70,7 @@ - + @@ -99,7 +99,7 @@ - + @@ -120,23 +120,23 @@ - + - + - - + + - - + + @@ -153,7 +153,7 @@ - + @@ -167,19 +167,19 @@ - + - - + + - - + + - + @@ -191,32 +191,32 @@ - + - - + + - + - + - + - + @@ -227,7 +227,7 @@ - + @@ -239,7 +239,7 @@ - + @@ -248,12 +248,12 @@ - + - + @@ -264,7 +264,7 @@ - + @@ -272,18 +272,18 @@ - + - + - + @@ -292,11 +292,11 @@ - + - + @@ -307,17 +307,17 @@ - + - + - + @@ -345,7 +345,7 @@ - + @@ -379,7 +379,7 @@ - + @@ -390,10 +390,10 @@ - + - + @@ -403,8 +403,8 @@ - - + + @@ -415,4 +415,4 @@ - + \ No newline at end of file diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc152/ajc152.xml index 91ec24385..37ebfbb85 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc152/ajc152.xml @@ -451,7 +451,7 @@ - + @@ -462,7 +462,7 @@ - + @@ -600,7 +600,7 @@ - + @@ -611,7 +611,7 @@ - + @@ -621,7 +621,7 @@ - + diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc152/synchronization.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc152/synchronization.xml index f2c8cb02b..99096fa53 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc152/synchronization.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc152/synchronization.xml @@ -2,7 +2,7 @@ - + @@ -15,7 +15,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -78,7 +78,7 @@ - + @@ -110,19 +110,19 @@ - + - + - + @@ -130,7 +130,7 @@ - + @@ -138,7 +138,7 @@ - + @@ -148,7 +148,7 @@ - + @@ -163,11 +163,11 @@ - + - + @@ -184,7 +184,7 @@ - + @@ -199,7 +199,7 @@ - + @@ -214,7 +214,7 @@ - + @@ -238,7 +238,7 @@ - + @@ -258,7 +258,7 @@ - + @@ -272,7 +272,7 @@ - + @@ -283,7 +283,7 @@ - + @@ -294,7 +294,7 @@ - + @@ -305,7 +305,7 @@ - + @@ -316,7 +316,7 @@ - + @@ -324,7 +324,7 @@ - + @@ -336,8 +336,8 @@ - - + + @@ -349,8 +349,8 @@ - - + + @@ -362,8 +362,8 @@ - - + + @@ -375,8 +375,8 @@ - - + + @@ -395,8 +395,8 @@ - - + + @@ -415,22 +415,22 @@ - - + + - + - + - + @@ -439,7 +439,7 @@ - + @@ -449,11 +449,11 @@ - + - - + + @@ -468,7 +468,7 @@ - + @@ -483,7 +483,7 @@ - + @@ -500,7 +500,7 @@ - + @@ -513,7 +513,7 @@ - + @@ -537,7 +537,7 @@ - + @@ -561,7 +561,7 @@ - + @@ -585,8 +585,8 @@ - - + + @@ -598,8 +598,8 @@ - - + + @@ -611,7 +611,7 @@ - + @@ -626,7 +626,7 @@ - + @@ -638,8 +638,8 @@ - - + + diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc153/ajc153.xml index 21103699b..00bf094bc 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc153/ajc153.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc153/ajc153.xml @@ -742,7 +742,7 @@ - + @@ -773,7 +773,7 @@ - + @@ -789,7 +789,7 @@ - + @@ -804,7 +804,7 @@ - + diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc154/ajc154.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc154/ajc154.xml index 4031ead6f..a0d38cb6c 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc154/ajc154.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc154/ajc154.xml @@ -118,7 +118,7 @@ - + @@ -212,7 +212,7 @@ - + diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml index aade93bf6..5a8556d80 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml @@ -24,7 +24,7 @@ - + @@ -42,7 +42,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -79,7 +79,7 @@ - + @@ -91,7 +91,7 @@ - + @@ -103,7 +103,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -127,7 +127,7 @@ - + @@ -136,7 +136,7 @@ - + @@ -146,7 +146,7 @@ - + @@ -156,7 +156,7 @@ - + @@ -168,7 +168,7 @@ - + diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc162/ajc162.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc162/ajc162.xml index 94725fab8..e45a21509 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc162/ajc162.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc162/ajc162.xml @@ -15,7 +15,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -36,7 +36,7 @@ - + diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc164/ajc164.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc164/ajc164.xml index 53f705bda..a14d8d0e7 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc164/ajc164.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc164/ajc164.xml @@ -56,7 +56,7 @@ - + diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc170/ajc170.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc170/ajc170.xml index 21fb5348c..f3f18f6d9 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc170/ajc170.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc170/ajc170.xml @@ -134,7 +134,7 @@ - + @@ -147,7 +147,7 @@ - + diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc180/ajc180.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc180/ajc180.xml index 2f62c5169..257f5972c 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc180/ajc180.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc180/ajc180.xml @@ -5,19 +5,19 @@ - + - + - + @@ -25,7 +25,7 @@ - + diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1810/ajc1810.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1810/ajc1810.xml index 3fe89bee5..90fcbc1e7 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc1810/ajc1810.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1810/ajc1810.xml @@ -5,7 +5,7 @@ - + -- cgit v1.2.3 From 7bd69575fd362e132fb3f6af948d608ec36ac8c9 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Thu, 31 Mar 2022 12:54:08 +0700 Subject: Revert "AtAjLTWTests: 4 test cases switched to 'useFullLTW' mode" This reverts commit 5288ef1c1c8be2df85e59740f41622f4cfb9d899. --- .../systemtest/ajc150/ataspectj/AtAjLTWTests.java | 7 +++---- .../org/aspectj/systemtest/ajc150/ataspectj/ltw.xml | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java index e06a3b0c3..c7be1944c 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java @@ -121,12 +121,11 @@ public class AtAjLTWTests extends XMLBasedAjcTestCase { public void testLTWDumpClosure() { runTest("LTW DumpTest closure"); - // Test runs with 'usefullltw="true"' -> dump files are created in the sandbox directory - File f = new File(ajc.getSandboxDirectory() + "/_ajdump/ataspectj/DumpTestTheDump$AjcClosure1.class"); + File f = new File("_ajdump/ataspectj/DumpTestTheDump$AjcClosure1.class"); assertTrue("Missing dump file " + f.getAbsolutePath(), f.exists()); - // tidy up... (should not be necessary in sandbox directory, but does not hurt) - f = new File(ajc.getSandboxDirectory() + "/_ajdump"); + // tidy up... + f = new File("_ajdump"); FileUtil.deleteContents(f); f.delete(); } diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml index 9dfc4afe4..a72fa4ebf 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml @@ -95,7 +95,7 @@ options="-1.5"/> - + - + @@ -163,7 +163,7 @@ files="ataspectj/ltwlog/Aspect1.java" options="-1.5 -XterminateAfterCompilation" > - + @@ -182,7 +182,7 @@ files="ataspectj/ltwlog/Aspect1.java" options="-1.5 -XterminateAfterCompilation" > - + @@ -207,7 +207,7 @@ files="ataspectj/ltwlog/Aspect1.java" options="-1.5 -XterminateAfterCompilation" > - + @@ -233,7 +233,7 @@ files="ataspectj/ltwlog/Aspect1.java" options="-1.5 -XterminateAfterCompilation" > - + @@ -290,7 +290,7 @@ files="ataspectj/ConcreteAtAspectTest.java,ataspectj/TestHelper.java" options="-1.5 -XterminateAfterCompilation" /> - + @@ -298,7 +298,7 @@ files="ataspectj/ConcreteAspectTest.aj,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing -XterminateAfterCompilation" /> - + @@ -306,7 +306,7 @@ files="ataspectj/ConcretePrecedenceAspectTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing -XterminateAfterCompilation" /> - + @@ -346,4 +346,4 @@ - + \ No newline at end of file -- cgit v1.2.3 From 020aa0361baaa9bb228c40ab88169edc135c160c Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Thu, 31 Mar 2022 14:24:03 +0700 Subject: Revert "Fix more LTW tests" This reverts commit 63d5e3e893bd149245465de1610716930998dec8. --- .../src/test/java/org/aspectj/testing/RunSpec.java | 4 +-- .../org/aspectj/systemtest/ajc150/ltw/ltw.xml | 31 ++-------------------- .../org/aspectj/systemtest/ajc1612/ajc1612.xml | 2 +- 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/testing/src/test/java/org/aspectj/testing/RunSpec.java b/testing/src/test/java/org/aspectj/testing/RunSpec.java index 181eb9062..c50b40f76 100644 --- a/testing/src/test/java/org/aspectj/testing/RunSpec.java +++ b/testing/src/test/java/org/aspectj/testing/RunSpec.java @@ -22,7 +22,7 @@ import java.util.StringTokenizer; import org.aspectj.tools.ajc.AjcTestCase; import org.aspectj.util.FileUtil; -import static org.aspectj.util.LangUtil.is9VMOrGreater; +import static org.aspectj.util.LangUtil.is16VMOrGreater; /** * @author Adrian Colyer @@ -75,7 +75,7 @@ public class RunSpec implements ITestStep { // The reason for setting this parameter for Java 9+ instead of 16+ is that it helps to avoid the JVM printing // unwanted illegal access warnings during weaving in 'useFullLTW' mode, either making existing tests fail or // having to assert on the warning messages. - vmargs += is9VMOrGreater() ? " --add-opens java.base/java.lang=ALL-UNNAMED" : ""; + vmargs += is16VMOrGreater() ? " --add-opens java.base/java.lang=ALL-UNNAMED" : ""; AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(), getModuleToRun(), args, vmargs, getClasspath(), getModulepath(), useLtw, "true".equalsIgnoreCase(usefullltw)); 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 66cd3cfbf..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 @@ -221,7 +221,7 @@ - + @@ -229,33 +229,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -271,7 +244,7 @@ text="this affected type is not exposed to the weaver: TestITDMethod" /> + ltw="aop-abstractaspect.xml"> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml index 5a8556d80..650bdea43 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1612/ajc1612.xml @@ -13,7 +13,7 @@ - + -- cgit v1.2.3