diff --git a/testsuite/src/it/java/org/graalvm/tests/integration/AppReproducersTest.java b/testsuite/src/it/java/org/graalvm/tests/integration/AppReproducersTest.java index b97e7bb..66b7a66 100644 --- a/testsuite/src/it/java/org/graalvm/tests/integration/AppReproducersTest.java +++ b/testsuite/src/it/java/org/graalvm/tests/integration/AppReproducersTest.java @@ -85,8 +85,15 @@ public class AppReproducersTest { private static final Logger LOGGER = Logger.getLogger(AppReproducersTest.class.getName()); + private static final String LOCALEINCLUDES_SWITCH_REPLACEMENT_1_MANDREL_PRE_24_2_0 = "-J-Duser.country=CA"; + private static final String LOCALEINCLUDES_SWITCH_REPLACEMENT_2_MANDREL_PRE_24_2_0 = "-J-Duser.language=fr"; + private static final String LOCALEINCLUDES_SWITCH_REPLACEMENT_1_MANDREL_POST_24_2_0 = "-H:IncludeLocales=fr-CA"; + private static final String LOCALEINCLUDES_SWITCH_REPLACEMENT_2_MANDREL_POST_24_2_0 = ""; + private static final String EXTRA_TZONES_OPTS = "-Duser.language=fr"; public static final String BASE_DIR = getBaseDir(); + public static final String LOCALEINCLUDES_TOKEN_1 = ""; + public static final String LOCALEINCLUDES_TOKEN_2 = ""; @Test @Tag("randomNumbers") @@ -702,10 +709,25 @@ public void timezonesBakedIn(TestInfo testInfo) throws IOException, InterruptedE // Build processLog = Path.of(appDir.getAbsolutePath(), "logs", "build-and-run.log").toFile(); - builderRoutine(app, report, cn, mn, appDir, processLog); + Map switches = null; + final boolean inContainer = app.runtimeContainer != ContainerNames.NONE; + if (UsedVersion.getVersion(inContainer).compareTo(Version.create(24, 2, 0)) >= 0) { + // Locale inclusion for Mandrel 24.2 ignores -Duser.language and -Duser.country settings + // at build time. + switches = Map.of(LOCALEINCLUDES_TOKEN_1, LOCALEINCLUDES_SWITCH_REPLACEMENT_1_MANDREL_POST_24_2_0, + LOCALEINCLUDES_TOKEN_2, LOCALEINCLUDES_SWITCH_REPLACEMENT_2_MANDREL_POST_24_2_0); + } else { + switches = Map.of(LOCALEINCLUDES_TOKEN_1, LOCALEINCLUDES_SWITCH_REPLACEMENT_1_MANDREL_PRE_24_2_0, + LOCALEINCLUDES_TOKEN_2, LOCALEINCLUDES_SWITCH_REPLACEMENT_2_MANDREL_PRE_24_2_0); + } + builderRoutine(0, app.buildAndRunCmds.cmds.length - 1, app, report, cn, mn, appDir, processLog, null, switches); LOGGER.info("Running..."); List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + if (UsedVersion.getVersion(inContainer).compareTo(Version.create(24, 2, 0)) >= 0) { + // Mandrel 24.2 needs the desired language set at runtime + cmd.add(EXTRA_TZONES_OPTS); + } process = runCommand(cmd, appDir, processLog, app); assertNotNull(process, "The test application failed to run. Check " + getLogsDir(cn, mn) + File.separator + processLog.getName()); process.waitFor(5, TimeUnit.SECONDS); diff --git a/testsuite/src/it/java/org/graalvm/tests/integration/utils/BuildAndRunCmds.java b/testsuite/src/it/java/org/graalvm/tests/integration/utils/BuildAndRunCmds.java index d8623fe..314cfac 100755 --- a/testsuite/src/it/java/org/graalvm/tests/integration/utils/BuildAndRunCmds.java +++ b/testsuite/src/it/java/org/graalvm/tests/integration/utils/BuildAndRunCmds.java @@ -22,6 +22,8 @@ import java.io.File; import static org.graalvm.tests.integration.AppReproducersTest.BASE_DIR; +import static org.graalvm.tests.integration.AppReproducersTest.LOCALEINCLUDES_TOKEN_1; +import static org.graalvm.tests.integration.AppReproducersTest.LOCALEINCLUDES_TOKEN_2; import static org.graalvm.tests.integration.JFRTest.JFR_FLIGHT_RECORDER_HOTSPOT_TOKEN; import static org.graalvm.tests.integration.JFRTest.JFR_MONITORING_SWITCH_TOKEN; import static org.graalvm.tests.integration.PerfCheckTest.FINAL_NAME_TOKEN; @@ -191,7 +193,7 @@ public enum BuildAndRunCmds { }), TIMEZONES(new String[][]{ new String[]{"mvn", "package"}, - new String[]{"native-image", "-J-Duser.country=CA", "-J-Duser.language=fr", "-jar", "target/timezones.jar", "target/timezones"}, + new String[]{"native-image", LOCALEINCLUDES_TOKEN_1, LOCALEINCLUDES_TOKEN_2, "-jar", "target/timezones.jar", "target/timezones"}, new String[]{IS_THIS_WINDOWS ? "target\\timezones.exe" : "./target/timezones"} }), CALENDARS(new String[][]{