Browse Source

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 <Alexander@Kriegisch.name>
tags/V1_9_9_1
Alexander Kriegisch 2 years ago
parent
commit
3dc53e0351
5 changed files with 25 additions and 8 deletions
  1. 6
    2
      docs/developer/BUILD.md
  2. 7
    2
      pom.xml
  3. 4
    2
      run-all-junit-tests/pom.xml
  4. 4
    1
      testing-drivers/pom.xml
  5. 4
    1
      tests/pom.xml

+ 6
- 2
docs/developer/BUILD.md View File

@@ -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

+ 7
- 2
pom.xml View File

@@ -196,6 +196,7 @@
</activation>
<properties>
<jvm.arg.addOpens/>
<jvm.arg.allowSecurityManager/>
</properties>
</profile>
<profile>
@@ -205,6 +206,7 @@
</activation>
<properties>
<jvm.arg.addOpens>--add-opens java.base/java.lang=ALL-UNNAMED</jvm.arg.addOpens>
<jvm.arg.allowSecurityManager/>
</properties>
</profile>
<profile>
@@ -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.
-->
<jvm.arg.addOpens>-Djava.security.manager=allow</jvm.arg.addOpens>
<jvm.arg.allowSecurityManager>-Djava.security.manager=allow</jvm.arg.allowSecurityManager>
</properties>
</profile>
<profile>
@@ -268,7 +270,10 @@
<version>2.22.2</version>
<configuration>
<!--<testFailureIgnore>true</testFailureIgnore>-->
<argLine>${jvm.arg.addOpens}</argLine>
<argLine>
${jvm.arg.addOpens}
${jvm.arg.allowSecurityManager}
</argLine>
<excludes>
<exclude>**/*ModuleTests.java</exclude>
</excludes>

+ 4
- 2
run-all-junit-tests/pom.xml View File

@@ -198,7 +198,10 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<argLine>${jvm.arg.addOpens}</argLine>
<argLine>
${jvm.arg.addOpens}
${jvm.arg.allowSecurityManager}
</argLine>
</configuration>
<executions>
<execution>
@@ -253,4 +256,3 @@
</build>

</project>


+ 4
- 1
testing-drivers/pom.xml View File

@@ -55,7 +55,10 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<argLine>${jvm.arg.addOpens}</argLine>
<argLine>
${jvm.arg.addOpens}
${jvm.arg.allowSecurityManager}
</argLine>
<excludes>
<exclude>**/*AjcTestSpecAsTest*</exclude>
</excludes>

+ 4
- 1
tests/pom.xml View File

@@ -122,7 +122,10 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration combine.self="override">
<testFailureIgnore>false</testFailureIgnore>
<argLine>${jvm.arg.addOpens}</argLine>
<argLine>
${jvm.arg.addOpens}
${jvm.arg.allowSecurityManager}
</argLine>
<includes>
<include>**/TestsModuleTests*</include>
</includes>

Loading…
Cancel
Save