From d9eb99ba01136ddc2c92d884fb827ccd25158c50 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Tue, 9 May 2023 13:13:35 +0300 Subject: [PATCH] Refactor BuildAndRunCmds to semantically separate build from run commands --- .../tests/integration/AppReproducersTest.java | 75 +- .../tests/integration/DebugSymbolsTest.java | 8 +- .../graalvm/tests/integration/JFRTest.java | 22 +- .../tests/integration/PerfCheckTest.java | 30 +- .../tests/integration/RuntimesSmokeTest.java | 7 +- .../graalvm/tests/integration/utils/Apps.java | 18 +- .../integration/utils/BuildAndRunCmds.java | 831 ++++++++++-------- .../tests/integration/utils/Commands.java | 30 +- 8 files changed, 546 insertions(+), 475 deletions(-) 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 66b7a66..5144995 100644 --- a/testsuite/src/it/java/org/graalvm/tests/integration/AppReproducersTest.java +++ b/testsuite/src/it/java/org/graalvm/tests/integration/AppReproducersTest.java @@ -117,7 +117,7 @@ public void randomNumbersReinit(TestInfo testInfo) throws IOException, Interrupt builderRoutine(app, report, cn, mn, appDir, processLog); LOGGER.info("Running...#1"); - List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); 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); @@ -125,7 +125,7 @@ public void randomNumbersReinit(TestInfo testInfo) throws IOException, Interrupt Logs.appendlnSection(report, String.join(" ", cmd)); LOGGER.info("Running...#2"); - cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); 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); @@ -468,7 +468,7 @@ public void resLocations(TestInfo testInfo, Apps app, String expectedOutput) thr builderRoutine(app, report, cn, mn, appDir, processLog); LOGGER.info("Running..."); - final List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + final List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); final String output = runCommand(cmd, appDir).trim(); Logs.appendln(report, appDir.getAbsolutePath()); Logs.appendlnSection(report, String.join(" ", cmd)); @@ -531,8 +531,7 @@ public void imageioAWT(TestInfo testInfo, Apps app) throws IOException, Interrup // Build processLog = Path.of(appDir.getAbsolutePath(), "logs", "build-and-run.log").toFile(); - builderRoutine(0, app.buildAndRunCmds.cmds.length - 1, - app, report, cn, mn, appDir, processLog, null, getSwitches(app)); + builderRoutine(app, report, cn, mn, appDir, processLog, null, getSwitches(app)); // Record images' hashsums as created by a Java process final List errors = new ArrayList<>(12); @@ -573,7 +572,7 @@ public void imageioAWT(TestInfo testInfo, Apps app) throws IOException, Interrup // Details: https://github.com/Karm/mandrel-integration-tests/issues/151#issuecomment-1516802244 Files.createDirectories(Path.of(appDir.toString(), "lib")).toFile().deleteOnExit(); - final List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + final List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); process = runCommand(cmd, appDir, processLog, app); assertNotNull(process, "The test application failed to run. Check " + getLogsDir(cn, mn) + File.separator + processLog.getName()); process.waitFor(15, TimeUnit.SECONDS); @@ -581,7 +580,7 @@ public void imageioAWT(TestInfo testInfo, Apps app) throws IOException, Interrup Logs.appendlnSection(report, String.join(" ", cmd)); // Test output - final boolean inContainer = app == Apps.IMAGEIO_BUILDER_IMAGE; + final boolean inContainer = app.runtimeContainer != ContainerNames.NONE; controlData.forEach((fileName, hash) -> { final File picture = new File(appDir, fileName); if (picture.exists() && picture.isFile()) { @@ -720,10 +719,10 @@ public void timezonesBakedIn(TestInfo testInfo) throws IOException, InterruptedE 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); + builderRoutine(app, report, cn, mn, appDir, processLog, null, switches); LOGGER.info("Running..."); - List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); 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); @@ -783,16 +782,18 @@ public void timezonesBakedIn(TestInfo testInfo) throws IOException, InterruptedE @Tag("builder-image") @IfMandrelVersion(minJDK = "21.0.3", inContainer = true) public void monitorFieldOffsetContainerTest(TestInfo testInfo) throws IOException, InterruptedException { - monitorFieldOffset(testInfo, Apps.MONITOR_OFFSET_BUILDER_IMAGE); + monitorFieldOffsetOK(testInfo, Apps.MONITOR_OFFSET_OK_BUILDER_IMAGE); + monitorFieldOffsetNOK(testInfo, Apps.MONITOR_OFFSET_NOK_BUILDER_IMAGE); } @Test @IfMandrelVersion(minJDK = "21.0.3") public void monitorFieldOffsetTest(TestInfo testInfo) throws IOException, InterruptedException { - monitorFieldOffset(testInfo, Apps.MONITOR_OFFSET); + monitorFieldOffsetOK(testInfo, Apps.MONITOR_OFFSET_OK); + monitorFieldOffsetNOK(testInfo, Apps.MONITOR_OFFSET_NOK); } - public void monitorFieldOffset(TestInfo testInfo, Apps app) throws IOException, InterruptedException { + public void monitorFieldOffsetOK(TestInfo testInfo, Apps app) throws IOException, InterruptedException { LOGGER.info("Testing app: " + app); Process process = null; File processLog = null; @@ -800,7 +801,7 @@ public void monitorFieldOffset(TestInfo testInfo, Apps app) throws IOException, final File appDir = Path.of(BASE_DIR, app.dir).toFile(); final String cn = testInfo.getTestClass().get().getCanonicalName(); final String mn = testInfo.getTestMethod().get().getName(); - final boolean inContainer = app == Apps.MONITOR_OFFSET_BUILDER_IMAGE; + final boolean inContainer = app.runtimeContainer != ContainerNames.NONE; try { // Cleanup cleanTarget(app); @@ -811,9 +812,9 @@ public void monitorFieldOffset(TestInfo testInfo, Apps app) throws IOException, // OK version processLog = Path.of(appDir.getAbsolutePath(), "logs", "build-and-run.log").toFile(); - builderRoutine(inContainer ? 3 : 2, app, report, cn, mn, appDir, processLog); + builderRoutine(app, report, cn, mn, appDir, processLog); LOGGER.info("Running..."); - final List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 3]); + final List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); 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); @@ -824,13 +825,31 @@ public void monitorFieldOffset(TestInfo testInfo, Apps app) throws IOException, final Pattern pok = Pattern.compile(".*Done all 9000 iterations.*"); assertTrue(searchLogLines(pok, processLog, Charset.defaultCharset()), "Expected pattern " + pok + " was not found in the log." + "Perhaps ContendedPaddingWidth default has changed from 128 bytes to something else?"); + } finally { + cleanup(process, cn, mn, report, app, processLog); + } + } + public void monitorFieldOffsetNOK(TestInfo testInfo, Apps app) throws IOException, InterruptedException { + LOGGER.info("Testing app: " + app); + Process process = null; + File processLog = null; + final StringBuilder report = new StringBuilder(); + final File appDir = Path.of(BASE_DIR, app.dir).toFile(); + final String cn = testInfo.getTestClass().get().getCanonicalName(); + final String mn = testInfo.getTestMethod().get().getName(); + final boolean inContainer = app.runtimeContainer != ContainerNames.NONE; + try { + // Cleanup + cleanTarget(app); if (inContainer) { removeContainers(app.runtimeContainer.name); } + Files.createDirectories(Paths.get(appDir.getAbsolutePath() + File.separator + "logs")); // NOK version - builderRoutine(inContainer ? 4 : 3, app.buildAndRunCmds.cmds.length, app, report, cn, mn, appDir, processLog); + processLog = Path.of(appDir.getAbsolutePath(), "logs", "build-and-run.log").toFile(); + builderRoutine(app, report, cn, mn, appDir, processLog); Logs.checkLog(cn, mn, app, processLog); final Pattern pnok = Pattern.compile(".*Class monitor_field_offset.Main480 has an invalid monitor field offset.*"); assertTrue(searchLogLines(pnok, processLog, Charset.defaultCharset()), "Expected pattern " + pnok + " was not found in the log."); @@ -873,7 +892,7 @@ public void forSerialization(TestInfo testInfo, Apps app) throws IOException, In final File metaINF = Path.of(BASE_DIR, app.dir, "src", "main", "resources", "META-INF", "native-image").toFile(); final String cn = testInfo.getTestClass().get().getCanonicalName(); final String mn = testInfo.getTestMethod().get().getName(); - final boolean inContainer = app == Apps.FOR_SERIALIZATION_BUILDER_IMAGE; + final boolean inContainer = app.runtimeContainer != ContainerNames.NONE; try { // Cleanup cleanTarget(app); @@ -885,11 +904,11 @@ public void forSerialization(TestInfo testInfo, Apps app) throws IOException, In } Files.createDirectories(Paths.get(appDir.getAbsolutePath() + File.separator + "logs")); processLog = Path.of(appDir.getAbsolutePath(), "logs", "build-and-run.log").toFile(); - builderRoutine(inContainer ? 4 : 3, app, report, cn, mn, appDir, processLog); + builderRoutine(app, report, cn, mn, appDir, processLog); LOGGER.info("Running..."); - final List cmdHotSpot = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 2]); - final List cmdNative = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + final List cmdHotSpot = getRunCommand(app.buildAndRunCmds.runCommands[0]); + final List cmdNative = getRunCommand(app.buildAndRunCmds.runCommands[1]); final String hotSpotOutput = runCommand(cmdHotSpot, appDir); final String nativeOutput = runCommand(cmdNative, appDir); Logs.appendln(report, appDir.getAbsolutePath()); @@ -937,7 +956,7 @@ public void calendarsBakedIn(TestInfo testInfo) throws IOException, InterruptedE builderRoutine(app, report, cn, mn, appDir, processLog); LOGGER.info("Running..."); - List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); 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); @@ -982,7 +1001,7 @@ public void recordAnnotationsWork(TestInfo testInfo) throws IOException, Interru builderRoutine(app, report, cn, mn, appDir, processLog); LOGGER.info("Running..."); - List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); 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); @@ -1023,10 +1042,10 @@ public void versionsParsingMandrel(TestInfo testInfo) throws IOException, Interr // Build processLog = Path.of(appDir.getAbsolutePath(), "logs", "build-and-run.log").toFile(); - builderRoutine(2, app, report, cn, mn, appDir, processLog); + builderRoutine(app, report, cn, mn, appDir, processLog); LOGGER.info("Running..."); - List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); 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); @@ -1068,15 +1087,13 @@ public void nativeJVMTextProcessing(TestInfo testInfo) throws IOException, Inter // Build processLog = Path.of(appDir.getAbsolutePath(), "logs", "build-and-run.log").toFile(); - // In this case, the two last commands are used for running the app; one in JVM mode and the other in Native mode. - // We should somehow capture this semantically in an Enum or something. This is fragile... - builderRoutine(app.buildAndRunCmds.cmds.length - 2, app, report, cn, mn, appDir, processLog, null, getSwitches(app)); + builderRoutine(app, report, cn, mn, appDir, processLog, null, getSwitches(app)); final File inputData = new File(BASE_DIR + File.separator + app.dir + File.separator + "target" + File.separator + "test_data.txt"); LOGGER.info("Running JVM mode..."); long start = System.currentTimeMillis(); - List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 2]); + List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); process = runCommand(cmd, appDir, processLog, app, inputData); assertNotNull(process, "The test application failed to run. Check " + getLogsDir(cn, mn) + File.separator + processLog.getName()); process.waitFor(30, TimeUnit.SECONDS); @@ -1086,7 +1103,7 @@ public void nativeJVMTextProcessing(TestInfo testInfo) throws IOException, Inter LOGGER.info("Running Native mode..."); start = System.currentTimeMillis(); - cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + cmd = getRunCommand(app.buildAndRunCmds.runCommands[1]); process = runCommand(cmd, appDir, processLog, app, inputData); assertNotNull(process, "The test application failed to run. Check " + getLogsDir(cn, mn) + File.separator + processLog.getName()); process.waitFor(30, TimeUnit.SECONDS); diff --git a/testsuite/src/it/java/org/graalvm/tests/integration/DebugSymbolsTest.java b/testsuite/src/it/java/org/graalvm/tests/integration/DebugSymbolsTest.java index 77b07a1..55cdbd2 100644 --- a/testsuite/src/it/java/org/graalvm/tests/integration/DebugSymbolsTest.java +++ b/testsuite/src/it/java/org/graalvm/tests/integration/DebugSymbolsTest.java @@ -120,7 +120,7 @@ public void debugSymbolsSmokeGDB(TestInfo testInfo) throws IOException, Interrup // In this case, the two last commands are used for running the app; one in JVM mode and the other in Native mode. // We should somehow capture this semantically in an Enum or something. This is fragile... - builderRoutine(app.buildAndRunCmds.cmds.length - 2, app, report, cn, mn, appDir, processLog, null, getSwitches()); + builderRoutine(app, report, cn, mn, appDir, processLog, null, getSwitches()); assertTrue(Files.exists(Path.of(appDir.getAbsolutePath(), "target", "debug-symbols-smoke")), "debug-symbols-smoke executable does not exist. Compilation failed. Check the logs."); @@ -231,7 +231,7 @@ public void debugSymbolsQuarkus(TestInfo testInfo) throws IOException, Interrupt } else { switches = null; } - builderRoutine(app.buildAndRunCmds.cmds.length - 1, app, report, cn, mn, appDir, processLog, null, switches); + builderRoutine(app, report, cn, mn, appDir, processLog, null, switches); assertTrue(Files.exists(Path.of(appDir.getAbsolutePath(), "target", "quarkus-runner")), "Quarkus executable does not exist. Compilation failed. Check the logs."); @@ -341,12 +341,12 @@ public void debugSymbolsQuarkusContainer(TestInfo testInfo) throws IOException, // Build app and start db processLog = Path.of(appDir.getAbsolutePath(), "logs", "build-and-run.log").toFile(); - builderRoutine(app.buildAndRunCmds.cmds.length - 1, app, report, cn, mn, appDir, processLog); + builderRoutine(app, report, cn, mn, appDir, processLog); waitForContainerLogToMatch("quarkus_test_db", dbReady, 20, 1, TimeUnit.SECONDS); // Start app LOGGER.info("Running..."); - final List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + final List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); runCommand(cmd, appDir, processLog, app); Files.writeString(processLog.toPath(), String.join(" ", cmd) + "\n", StandardOpenOption.APPEND, StandardOpenOption.CREATE); diff --git a/testsuite/src/it/java/org/graalvm/tests/integration/JFRTest.java b/testsuite/src/it/java/org/graalvm/tests/integration/JFRTest.java index 4c0b332..ede5416 100644 --- a/testsuite/src/it/java/org/graalvm/tests/integration/JFRTest.java +++ b/testsuite/src/it/java/org/graalvm/tests/integration/JFRTest.java @@ -223,8 +223,8 @@ public void jfrPerfTestRun(TestInfo testInfo, boolean inContainer) throws IOExce } // Container build requires an additional step: docker build... - builderRoutine(inContainer ? 2 : 1, appJfr, report, cn, mn, appDir, processLog, null, switches); - builderRoutine(inContainer ? 2 : 1, appNoJfr, report, cn, mn, appDir, processLog, null, switches); + builderRoutine(appJfr, report, cn, mn, appDir, processLog, null, switches); + builderRoutine(appNoJfr, report, cn, mn, appDir, processLog, null, switches); startComparisonForBenchmark(Endpoint.REGULAR, true, processLog, cn, mn, report, measurementsLog, appDir, appJfr, appNoJfr, inContainer); LOGGER.info("REGULAR workload completed."); @@ -365,7 +365,7 @@ private Map runBenchmarkForApp(Endpoint endpoint, int trials, A assertTrue(waitForTcpClosed("localhost", 8090, 10), "Hyperfoil likely hanging on port 8090."); } - final List cmd = getRunCommand(app.buildAndRunCmds.cmds[inContainer ? 2 : 1]); + final List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); clearCaches(); //TODO consider using warm up instead of clearing caches Logs.appendln(report, "Trial " + i + " in " + appDir.getAbsolutePath()); Logs.appendlnSection(report, String.join(" ", cmd)); @@ -390,7 +390,7 @@ private Map runBenchmarkForApp(Endpoint endpoint, int trials, A } // Run Hyperfoil controller in container and expose port for test - final List getAndStartHyperfoil = getRunCommand(app.buildAndRunCmds.cmds[inContainer ? 3 : 2]); + final List getAndStartHyperfoil = getRunCommand(app.buildAndRunCmds.runCommands[1]); hyperfoilProcess = runCommand(getAndStartHyperfoil, appDir, processLog, app); Logs.appendln(report, appDir.getAbsolutePath()); Logs.appendlnSection(report, String.join(" ", getAndStartHyperfoil)); @@ -643,14 +643,14 @@ public void jfrSmoke(TestInfo testInfo, Apps app) throws IOException, Interrupte } else { switches = Map.of(JFR_MONITORING_SWITCH_TOKEN, JFROption.MONITOR_21.replacement); } - // In this case, four last commands are used to run the app, JVM, JVM JFR, Native, Native JFR - builderRoutine(app.buildAndRunCmds.cmds.length - 4, app, report, cn, mn, appDir, processLog, null, switches); + // In this case, four commands are used to run the app, JVM, JVM JFR, Native, Native JFR + builderRoutine(app, report, cn, mn, appDir, processLog, null, switches); final File inputData = Path.of(BASE_DIR, app.dir, "target", "test_data.txt").toFile(); LOGGER.info("Running JVM mode..."); long start = System.currentTimeMillis(); - List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 4]); + List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); process = runCommand(cmd, appDir, processLog, app, inputData); assertNotNull(process, "The test application failed to run. Check " + getLogsDir(cn, mn) + File.separator + processLog.getName()); process.waitFor(30, TimeUnit.SECONDS); @@ -660,7 +660,7 @@ public void jfrSmoke(TestInfo testInfo, Apps app) throws IOException, Interrupte LOGGER.info("Running JVM JFR mode..."); start = System.currentTimeMillis(); - cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 3]); + cmd = getRunCommand(app.buildAndRunCmds.runCommands[1]); if (UsedVersion.jdkFeature(inContainer) >= 17) { cmd = replaceSwitchesInCmd(cmd, Map.of(JFR_FLIGHT_RECORDER_HOTSPOT_TOKEN, JFROption.HOTSPOT_17_FLIGHT_RECORDER.replacement)); } else { @@ -675,7 +675,7 @@ public void jfrSmoke(TestInfo testInfo, Apps app) throws IOException, Interrupte LOGGER.info("Running Native mode..."); start = System.currentTimeMillis(); - cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 2]); + cmd = getRunCommand(app.buildAndRunCmds.runCommands[2]); process = runCommand(cmd, appDir, processLog, app, inputData); assertNotNull(process, "The test application failed to run. Check " + getLogsDir(cn, mn) + File.separator + processLog.getName()); process.waitFor(30, TimeUnit.SECONDS); @@ -685,7 +685,7 @@ public void jfrSmoke(TestInfo testInfo, Apps app) throws IOException, Interrupte LOGGER.info("Running Native mode JFR..."); start = System.currentTimeMillis(); - cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + cmd = getRunCommand(app.buildAndRunCmds.runCommands[3]); process = runCommand(cmd, appDir, processLog, app, inputData); assertNotNull(process, "The test application failed to run. Check " + getLogsDir(cn, mn) + File.separator + processLog.getName()); process.waitFor(30, TimeUnit.SECONDS); @@ -817,7 +817,7 @@ public void jfrOptionsSmoke(TestInfo testInfo, Apps app) throws IOException, Int } else { switches = Map.of(JFR_MONITORING_SWITCH_TOKEN, JFROption.MONITOR_21.replacement); } - builderRoutine(2, app, report, cn, mn, appDir, processLog, null, switches); + builderRoutine(app, report, cn, mn, appDir, processLog, null, switches); final Map cmdOutput = new HashMap<>(); cmdOutput.put(new String[]{"./target/timezones", diff --git a/testsuite/src/it/java/org/graalvm/tests/integration/PerfCheckTest.java b/testsuite/src/it/java/org/graalvm/tests/integration/PerfCheckTest.java index 532f10d..03221cc 100644 --- a/testsuite/src/it/java/org/graalvm/tests/integration/PerfCheckTest.java +++ b/testsuite/src/it/java/org/graalvm/tests/integration/PerfCheckTest.java @@ -154,7 +154,6 @@ public void testQuarkusJSONParseOnce(TestInfo testInfo) throws IOException, Inte // Cleanup cleanTarget(app); Files.createDirectories(Paths.get(appDir.getAbsolutePath(), "logs")); - assertTrue(app.buildAndRunCmds.cmds.length > 1); if (QUARKUS_VERSION.compareTo(QuarkusVersion.V_3_9_0) >= 0) { patch = "quarkus_3.9.x.patch"; @@ -167,13 +166,13 @@ public void testQuarkusJSONParseOnce(TestInfo testInfo) throws IOException, Inte } // Build executables - builderRoutine(3, app, null, null, null, appDir, processLog, null, getSwitches1()); + builderRoutine(app, null, null, null, appDir, processLog, null, getSwitches1()); assertTrue(processLog.exists()); int line = 0; - for (int i = 3; i >= 1; i--) { + for (int i = 0; i < app.buildAndRunCmds.runCommands.length; i++) { final Map report = populateHeader(new TreeMap<>()); - final List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - i]); + final List cmd = getRunCommand(app.buildAndRunCmds.runCommands[i]); Files.writeString(processLog.toPath(), String.join(" ", cmd) + '\n', StandardOpenOption.APPEND, StandardOpenOption.CREATE); process = runCommand(cmd, appDir, processLog, app); line = waitForFileToMatch(Pattern.compile(".*Events enabled.*"), processLog.toPath(), line, 20, 1, TimeUnit.SECONDS); @@ -204,7 +203,7 @@ public void testQuarkusJSONParseOnce(TestInfo testInfo) throws IOException, Inte System.out.println(); report.put("rssKb", Long.toString(getRSSkB(process.children().sorted().findFirst().get().pid()))); processStopper(process, false, true); - final String statsFor = Arrays.stream(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - i]) + final String statsFor = Arrays.stream(app.buildAndRunCmds.runCommands[i]) // skipping first 4 perf tool conf .skip(4).collect(Collectors.joining(" ")).trim(); waitForFileToMatch(Pattern.compile(".*Performance counter stats for\\s+'\\Q" + statsFor + "\\E':.*"), processLog.toPath(), 0, 5, 1, TimeUnit.SECONDS); @@ -293,7 +292,6 @@ public void testQuarkusJSON(TestInfo testInfo) throws IOException, InterruptedEx // Cleanup cleanTarget(app); Files.createDirectories(Paths.get(appDir.getAbsolutePath(), "logs")); - assertTrue(app.buildAndRunCmds.cmds.length > 1); if (QUARKUS_VERSION.compareTo(QuarkusVersion.V_3_9_0) >= 0) { patch = "quarkus_3.9.x.patch"; @@ -306,12 +304,12 @@ public void testQuarkusJSON(TestInfo testInfo) throws IOException, InterruptedEx } // Build executables - builderRoutine(2, app, null, null, null, appDir, processLog, null, getSwitches2()); + builderRoutine(app, null, null, null, appDir, processLog, null, getSwitches2()); int line = 0; - for (int i = 2; i >= 1; i--) { + for (int i = 0; i < app.buildAndRunCmds.runCommands.length; i++) { final Map report = populateHeader(new TreeMap<>()); - final List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - i]); + final List cmd = getRunCommand(app.buildAndRunCmds.runCommands[i]); Files.writeString(processLog.toPath(), String.join(" ", cmd) + '\n', StandardOpenOption.APPEND, StandardOpenOption.CREATE); process = runCommand(cmd, appDir, processLog, app); line = waitForFileToMatch(Pattern.compile(".*Events enabled.*"), processLog.toPath(), line, 20, 1, TimeUnit.SECONDS); @@ -342,7 +340,7 @@ public void testQuarkusJSON(TestInfo testInfo) throws IOException, InterruptedEx System.out.println(); report.put("rssKb", Long.toString(getRSSkB(process.children().sorted().findFirst().get().pid()))); processStopper(process, false, true); - final String statsFor = Arrays.stream(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - i]) + final String statsFor = Arrays.stream(app.buildAndRunCmds.runCommands[i]) // skipping first 4 perf tool conf .skip(4).collect(Collectors.joining(" ")).trim(); waitForFileToMatch(Pattern.compile(".*Performance counter stats for\\s+'\\Q" + statsFor + "\\E':.*"), processLog.toPath(), 0, 5, 1, TimeUnit.SECONDS); @@ -433,20 +431,19 @@ public void testQuarkusFullMicroProfile(TestInfo testInfo) throws IOException, I // Cleanup cleanTarget(app); Files.createDirectories(Paths.get(appDir.getAbsolutePath(), "logs")); - assertTrue(app.buildAndRunCmds.cmds.length > 1); if (patch != null) { runCommand(getRunCommand("git", "apply", patch), appDir); } // Build executables - builderRoutine(2, app, null, null, null, appDir, processLog, null, getSwitches3()); + builderRoutine(app, null, null, null, appDir, processLog, null, getSwitches3()); int line = 0; - for (int i = 2; i >= 1; i--) { + for (int i = 0; i < app.buildAndRunCmds.runCommands.length; i++) { final Map report = populateHeader(new TreeMap<>()); report.replace("testApp", "https://github.com/Karm/mandrel-integration-tests/apps/quarkus-full-microprofile/"); - final List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - i]); + final List cmd = getRunCommand(app.buildAndRunCmds.runCommands[i]); Files.writeString(processLog.toPath(), String.join(" ", cmd) + '\n', StandardOpenOption.APPEND, StandardOpenOption.CREATE); process = runCommand(cmd, appDir, processLog, app); final long timeToFirstOKRequestMs = WebpageTester.testWeb(app.urlContent.urlContent[0][0], 10, app.urlContent.urlContent[0][1], true); @@ -468,7 +465,7 @@ public void testQuarkusFullMicroProfile(TestInfo testInfo) throws IOException, I System.out.println(); report.put("rssKb", Long.toString(getRSSkB(process.children().sorted().findFirst().get().pid()))); processStopper(process, false, true); - final String statsFor = Arrays.stream(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - i]) + final String statsFor = Arrays.stream(app.buildAndRunCmds.runCommands[i]) // skipping first 2: `perf stat' .skip(2).collect(Collectors.joining(" ")).trim(); waitForFileToMatch(Pattern.compile(".*Performance counter stats for\\s+'\\Q" + statsFor + "\\E':.*"), processLog.toPath(), 0, 5, 1, TimeUnit.SECONDS); @@ -578,7 +575,6 @@ public void testQuarkusMPOrmAwt(TestInfo testInfo, boolean inContainer) throws I // Cleanup cleanTarget(app); Files.createDirectories(Paths.get(appDir.getAbsolutePath(), "logs")); - assertTrue(app.buildAndRunCmds.cmds.length > 1); if (patch != null) { runCommand(getRunCommand("git", "apply", patch), appDir); @@ -601,7 +597,7 @@ public void testQuarkusMPOrmAwt(TestInfo testInfo, boolean inContainer) throws I } }; - builderRoutine(1, app, null, null, null, appDir, processLog, null, switches); + builderRoutine(app, null, null, null, appDir, processLog, null, switches); findExecutable(Path.of(appDir.getAbsolutePath(), "target"), Pattern.compile(".*mp-orm-dbs-awt.*")); if (PERF_APP_REPORT) { diff --git a/testsuite/src/it/java/org/graalvm/tests/integration/RuntimesSmokeTest.java b/testsuite/src/it/java/org/graalvm/tests/integration/RuntimesSmokeTest.java index 92a655e..754ff2f 100644 --- a/testsuite/src/it/java/org/graalvm/tests/integration/RuntimesSmokeTest.java +++ b/testsuite/src/it/java/org/graalvm/tests/integration/RuntimesSmokeTest.java @@ -93,13 +93,13 @@ public void testRuntime(TestInfo testInfo, Apps app, Map switchR Files.createDirectories(Paths.get(appDir.getAbsolutePath() + File.separator + "logs")); long buildStarts = System.currentTimeMillis(); - builderRoutine(app.buildAndRunCmds.cmds.length - 1, app, report, cn, mn, appDir, processLog, null, switchReplacements); + builderRoutine(app, report, cn, mn, appDir, processLog, null, switchReplacements); long buildEnds = System.currentTimeMillis(); findExecutable(Path.of(appDir.getAbsolutePath(), "target"), Pattern.compile(".*")); // Run LOGGER.info("Running..."); - final List cmd = getRunCommand(app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1]); + final List cmd = getRunCommand(app.buildAndRunCmds.runCommands[0]); process = runCommand(cmd, appDir, processLog, app); Logs.appendln(report, appDir.getAbsolutePath()); Logs.appendlnSection(report, String.join(" ", cmd)); @@ -120,8 +120,7 @@ public void testRuntime(TestInfo testInfo, Apps app, Map switchR long executableSizeKb; // Running without a container if (app.runtimeContainer == ContainerNames.NONE) { - executableSizeKb = Files.size(Path.of(appDir.getAbsolutePath(), - app.buildAndRunCmds.cmds[app.buildAndRunCmds.cmds.length - 1][0])) / 1024L; + executableSizeKb = Files.size(Path.of(appDir.getAbsolutePath(), app.buildAndRunCmds.runCommands[0][0])) / 1024L; rssKb = getRSSkB(process.pid()); final long openedFiles = getOpenedFDs(process.pid()); processStopper(process, false); diff --git a/testsuite/src/it/java/org/graalvm/tests/integration/utils/Apps.java b/testsuite/src/it/java/org/graalvm/tests/integration/utils/Apps.java index 985d248..87f40c5 100755 --- a/testsuite/src/it/java/org/graalvm/tests/integration/utils/Apps.java +++ b/testsuite/src/it/java/org/graalvm/tests/integration/utils/Apps.java @@ -174,15 +174,25 @@ public enum Apps { WhitelistLogLines.RESLOCATIONS, BuildAndRunCmds.RESLOCATIONS, ContainerNames.NONE), - MONITOR_OFFSET("apps" + File.separator + "monitor-field-offset", + MONITOR_OFFSET_OK("apps" + File.separator + "monitor-field-offset", URLContent.NONE, WhitelistLogLines.MONITOR_OFFSET, - BuildAndRunCmds.MONITOR_OFFSET, + BuildAndRunCmds.MONITOR_OFFSET_OK, ContainerNames.NONE), - MONITOR_OFFSET_BUILDER_IMAGE("apps" + File.separator + "monitor-field-offset", + MONITOR_OFFSET_OK_BUILDER_IMAGE("apps" + File.separator + "monitor-field-offset", URLContent.NONE, WhitelistLogLines.MONITOR_OFFSET, - BuildAndRunCmds.MONITOR_OFFSET_BUILDER_IMAGE, + BuildAndRunCmds.MONITOR_OFFSET_OK_BUILDER_IMAGE, + ContainerNames.MONITOR_OFFSET_BUILDER_IMAGE), + MONITOR_OFFSET_NOK("apps" + File.separator + "monitor-field-offset", + URLContent.NONE, + WhitelistLogLines.MONITOR_OFFSET, + BuildAndRunCmds.MONITOR_OFFSET_NOK, + ContainerNames.NONE), + MONITOR_OFFSET_NOK_BUILDER_IMAGE("apps" + File.separator + "monitor-field-offset", + URLContent.NONE, + WhitelistLogLines.MONITOR_OFFSET, + BuildAndRunCmds.MONITOR_OFFSET_NOK_BUILDER_IMAGE, ContainerNames.MONITOR_OFFSET_BUILDER_IMAGE), FOR_SERIALIZATION("apps" + File.separator + "for-serialization", URLContent.NONE, 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 314cfac..1436e1c 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 @@ -65,391 +65,444 @@ public enum BuildAndRunCmds { // // export DOCKER_HOST=unix:///run/user/${UID}/podman/podman.sock // export TESTCONTAINERS_RYUK_DISABLED=true - QUARKUS_MP_ORM_DBS_AWT(new String[][] { - new String[] { "mvn", "verify", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), - "-Dquarkus.profile=test", - "-DBuildOutputJSONFile=" + GRAALVM_BUILD_OUTPUT_JSON_FILE, - "-DUnlockExperimentalBEGIN=" + GRAALVM_EXPERIMENTAL_BEGIN, - "-DUnlockExperimentalEND=" + GRAALVM_EXPERIMENTAL_END, - "-Dquarkus.native.native-image-xmx=" + NATIVE_IMAGE_XMX_GB + "g", - "-DfinalName=" + FINAL_NAME_TOKEN - }, - new String[] { IS_THIS_WINDOWS ? "target\\" + FINAL_NAME_TOKEN + ".exe" : "./target/" + FINAL_NAME_TOKEN } - }), - QUARKUS_BUILDER_IMAGE_MP_ORM_DBS_AWT(new String[][] { - new String[] { "mvn", "verify", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), + QUARKUS_MP_ORM_DBS_AWT( + new String[][] { + { "mvn", "verify", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), + "-Dquarkus.profile=test", + "-DBuildOutputJSONFile=" + GRAALVM_BUILD_OUTPUT_JSON_FILE, + "-DUnlockExperimentalBEGIN=" + GRAALVM_EXPERIMENTAL_BEGIN, + "-DUnlockExperimentalEND=" + GRAALVM_EXPERIMENTAL_END, + "-Dquarkus.native.native-image-xmx=" + NATIVE_IMAGE_XMX_GB + "g", + "-DfinalName=" + FINAL_NAME_TOKEN + } }, + new String[][] { + { IS_THIS_WINDOWS ? "target\\" + FINAL_NAME_TOKEN + ".exe" : "./target/" + FINAL_NAME_TOKEN } } + ), + QUARKUS_BUILDER_IMAGE_MP_ORM_DBS_AWT( + new String[][] { + { "mvn", "verify", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), - "-Dquarkus.native.container-build=true", - "-Dquarkus.container-image.build=true", - "-Dquarkus.native.container-runtime=" + CONTAINER_RUNTIME, - "-Dquarkus.native.builder-image=" + BUILDER_IMAGE, + "-Dquarkus.native.container-build=true", + "-Dquarkus.container-image.build=true", + "-Dquarkus.native.container-runtime=" + CONTAINER_RUNTIME, + "-Dquarkus.native.builder-image=" + BUILDER_IMAGE, - "-Dquarkus.profile=test", - "-DBuildOutputJSONFile=" + GRAALVM_BUILD_OUTPUT_JSON_FILE, - "-DUnlockExperimentalBEGIN=" + GRAALVM_EXPERIMENTAL_BEGIN, - "-DUnlockExperimentalEND=" + GRAALVM_EXPERIMENTAL_END, - "-Dquarkus.native.native-image-xmx=" + NATIVE_IMAGE_XMX_GB + "g", - "-DfinalName=" + FINAL_NAME_TOKEN - }, - new String[] { IS_THIS_WINDOWS ? "target\\" + FINAL_NAME_TOKEN + ".exe" : "./target/" + FINAL_NAME_TOKEN } - }), - QUARKUS_FULL_MICROPROFILE(new String[][]{ - new String[]{"mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), - "-Dquarkus.native.additional-build-args=" + - "-H:Log=registerResource:," + - "--trace-object-instantiation=java.util.Random" - }, - new String[]{IS_THIS_WINDOWS ? "target\\quarkus-runner.exe" : "./target/quarkus-runner"} - }), - DEBUG_QUARKUS_FULL_MICROPROFILE(new String[][]{ - new String[]{"mvn", "package", "-Pnative", "-Dquarkus.native.debug.enabled=true", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), - "-Dquarkus.native.additional-build-args=" + - "-H:Log=registerResource:," + - "--trace-object-instantiation=java.util.Random" - }, - new String[]{"mvn", "dependency:sources", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString()}, - new String[]{IS_THIS_WINDOWS ? "target\\quarkus-runner.exe" : "./target/quarkus-runner"} - }), - QUARKUS_FULL_MICROPROFILE_PERF(new String[][]{ - new String[]{"mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), - "-Dquarkus.native.additional-build-args=" + - "-H:Log=registerResource:," + - "--trace-object-instantiation=java.util.Random," + - "-R:MaxHeapSize=" + MX_HEAP_MB + "m" + - GRAALVM_BUILD_OUTPUT_JSON_FILE - }, - new String[]{"mvn", "package", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString()}, - // GC: https://github.com/Karm/mandrel-integration-tests/pull/127#discussion_r1066802872 - // -XX:+UseShenandoahGC - // -XX:+UseSerialGC - // -XX:+UseG1GC - // Profile capture: - // No "--delay", "2000", for perf o capture startup too... - new String[]{"perf", "stat", "java", "-Xlog:gc", "-XX:+UseSerialGC", "-Xmx" + MX_HEAP_MB + "m", "-jar", "target/quarkus-app/quarkus-run.jar"}, - new String[]{"perf", "stat", "./target/quarkus-runner", "-XX:+PrintGC"} - }), - QUARKUS_JSON_PERF_PARSEONCE(new String[][]{ - // TODO tune and report: https://www.graalvm.org/22.0/reference-manual/native-image/MemoryManagement/ - new String[]{"mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), - "-Dquarkus.native.additional-build-args=" + - "-R:MaxHeapSize=" + MX_HEAP_MB + "m," + - "-H:-ParseOnce" + - GRAALVM_BUILD_OUTPUT_JSON_FILE + "-ParseOnce", - "-Dcustom.final.name=quarkus-json_-ParseOnce"}, - new String[]{"mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), - "-Dquarkus.native.additional-build-args=" + - "-R:MaxHeapSize=" + MX_HEAP_MB + "m," + - "-H:+ParseOnce" + - GRAALVM_BUILD_OUTPUT_JSON_FILE + "+ParseOnce", - "-Dcustom.final.name=quarkus-json_+ParseOnce"}, - new String[]{"mvn", "package", "-Dcustom.final.name=quarkus-json", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString()}, - //-XX:+UseShenandoahGC - //-XX:+UseSerialGC - //-XX:+UseG1GC - new String[]{"perf", "stat", "--delay", "2000", "java", "-Xlog:gc", "-XX:+UseSerialGC", "-Xmx" + MX_HEAP_MB + "m", "-jar", "target/quarkus-app/quarkus-run.jar"}, - new String[]{"perf", "stat", "--delay", "1000", "./target/quarkus-json_-ParseOnce-runner", "-XX:+PrintGC"}, - new String[]{"perf", "stat", "--delay", "1000", "./target/quarkus-json_+ParseOnce-runner", "-XX:+PrintGC"} - }), - QUARKUS_JSON_PERF(new String[][]{ - // TODO tune and report: https://www.graalvm.org/22.0/reference-manual/native-image/MemoryManagement/ - new String[]{"mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), - "-Dquarkus.native.additional-build-args=" + - "-R:MaxHeapSize=" + MX_HEAP_MB + "m" + - GRAALVM_BUILD_OUTPUT_JSON_FILE, - "-Dcustom.final.name=quarkus-json"}, - new String[]{"mvn", "package", "-Dcustom.final.name=quarkus-json", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString()}, - new String[]{"perf", "stat", "--delay", "2000", "java", "-Xlog:gc", "-XX:+UseSerialGC", "-Xmx" + MX_HEAP_MB + "m", "-jar", "target/quarkus-app/quarkus-run.jar"}, - new String[]{"perf", "stat", "--delay", "1000", "./target/quarkus-json-runner", "-XX:+PrintGC"}, - }), - QUARKUS_BUILDER_IMAGE_ENCODING(new String[][]{ - new String[]{"mvn", "package", "-Pnative", "-Dquarkus.native.container-build=true", - "-Dquarkus.native.container-runtime=" + CONTAINER_RUNTIME, - "-Dquarkus.native.builder-image=" + BUILDER_IMAGE, "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString()}, - new String[]{CONTAINER_RUNTIME, "build", "-f", "src/main/docker/Dockerfile.native", "-t", "my-quarkus-mandrel-app", "."}, - new String[]{CONTAINER_RUNTIME, "run", "-i", "--rm", "-p", "8080:8080", - "--name", ContainerNames.QUARKUS_BUILDER_IMAGE_ENCODING.name, "my-quarkus-mandrel-app"} - }), - DEBUG_QUARKUS_BUILDER_IMAGE_VERTX(new String[][]{ - new String[]{"mvn", "dependency:sources", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString()}, - new String[]{"mvn", "package", "-Pnative", "-Dquarkus.native.container-build=true", - "-Dquarkus.native.container-runtime=" + CONTAINER_RUNTIME, - "-Dquarkus.native.builder-image=" + BUILDER_IMAGE, - "-Dquarkus.native.debug.enabled=true", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString()}, - new String[]{CONTAINER_RUNTIME, "build", "--network=host", "-f", "src/main/docker/Dockerfile.native", "-t", "my-quarkus-mandrel-app", "."}, - new String[]{CONTAINER_RUNTIME, "run", "--network=host", "--ulimit", "memlock=-1:-1", "-it", "-d", "--rm=true", - "--name", "quarkus_test_db", "-e", "POSTGRES_USER=quarkus_test", "-e", "POSTGRES_PASSWORD=quarkus_test", - "-e", "POSTGRES_DB=quarkus_test", "quay.io/debezium/postgres:15"}, - new String[]{CONTAINER_RUNTIME, "run", "--network=host", "--cap-add=SYS_PTRACE", "--security-opt=seccomp=unconfined", - "-i", "-d", "--rm", "--name", ContainerNames.DEBUG_QUARKUS_BUILDER_IMAGE_VERTX.name, "my-quarkus-mandrel-app"} - }), - RANDOM_NUMBERS(new String[][]{ - new String[]{"mvn", "package"}, - new String[]{"native-image", "-jar", "target/random-numbers.jar", "target/random-numbers"}, - new String[]{IS_THIS_WINDOWS ? "target\\random-numbers.exe" : "./target/random-numbers"} - }), - HELIDON_QUICKSTART_SE(new String[][]{ - new String[]{"mvn", "package"}, - new String[]{IS_THIS_WINDOWS ? "target\\helidon-quickstart-se.exe" : "./target/helidon-quickstart-se"} - }), - TIMEZONES(new String[][]{ - new String[]{"mvn", "package"}, - 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[][]{ - new String[]{"mvn", "package"}, - new String[]{"native-image", "--link-at-build-time=calendar.Main", "-jar", "target/calendars.jar", "target/calendars"}, - new String[]{IS_THIS_WINDOWS ? "target\\calendars.exe" : "./target/calendars"} - }), - RECORDANNOTATIONS(new String[][]{ - new String[]{"mvn", "package"}, - new String[]{"native-image", "--no-fallback", "-jar", "target/recordannotations.jar", "target/recordannotations"}, - new String[]{IS_THIS_WINDOWS ? "target\\recordannotations.exe" : "./target/recordannotations"} - }), - VERSIONS(new String[][]{ - new String[]{"mvn", "package"}, - new String[]{"native-image", "--features=org.graalvm.home.HomeFinderFeature", "-jar", "target/version.jar", "target/version"}, - new String[]{IS_THIS_WINDOWS ? "target\\version.exe" : "./target/version"} - }), - IMAGEIO(new String[][]{ - new String[]{"mvn", "clean", "package"}, - new String[]{"java", "-Djava.awt.headless=true", "-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image", "-jar", "target/imageio.jar"}, - new String[]{"jar", "uf", "target/imageio.jar", "-C", "src/main/resources/", "META-INF"}, - new String[]{"native-image", UnlockExperimentalVMOptions_23_1.token, ForeignAPISupport_24_2.token, LockExperimentalVMOptions_23_1.token, - "-J-Djava.awt.headless=true", "--no-fallback", "-jar", "target/imageio.jar", "target/imageio"}, - new String[]{IS_THIS_WINDOWS ? "target\\imageio.exe" : "./target/imageio", "-Djava.home=.", "-Djava.awt.headless=true"} - }), - IMAGEIO_BUILDER_IMAGE(new String[][]{ - // Bring Your Own Maven (not a part of the builder image toolchain) - new String[]{"mvn", "package"}, - // TODO: Ad -u: Test access rights with -u on Windows, Docker Desktop Hyper-V backend vs. WSL2 backend. - // Java from Builder image container is used for the sake of consistence. - new String[]{CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "--entrypoint", "java", "-v", BASE_DIR + File.separator + "apps" + File.separator + "imageio:/project:z", - BUILDER_IMAGE, "-Djava.awt.headless=true", - "-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image", "-jar", "target/imageio.jar"}, - // Jar could be used locally, but we use the one from container too. - new String[]{CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "--entrypoint", "jar", "-v", BASE_DIR + File.separator + "apps" + File.separator + "imageio:/project:z", - BUILDER_IMAGE, - "uf", "target/imageio.jar", "-C", "src/main/resources/", "META-INF"}, - // Native image build itself (jar was updated with properties in the previous step) - new String[]{CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "imageio:/project:z", - BUILDER_IMAGE, UnlockExperimentalVMOptions_23_1.token, ForeignAPISupport_24_2.token, LockExperimentalVMOptions_23_1.token, - "-J-Djava.awt.headless=true", "--no-fallback", "-jar", "target/imageio.jar", "target/imageio"}, - // We build a runtime image, ubi 8 minimal based, runtime dependencies installed - new String[]{CONTAINER_RUNTIME, "build", "--network=host", "-t", ContainerNames.IMAGEIO_BUILDER_IMAGE.name, "."}, - // We have to run in the same env as we run the java part above, i.e. in the same container base. - // Hashsums of font rotations would differ otherwise as your linux host might have different freetype native libs. - new String[]{CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "imageio:/work:z", - ContainerNames.IMAGEIO_BUILDER_IMAGE.name, "/work/target/imageio", "-Djava.home=.", "-Djava.awt.headless=true"} - }), - DEBUG_SYMBOLS_SMOKE(new String[][]{ - new String[]{"mvn", "package"}, - IS_THIS_WINDOWS ? - new String[]{"powershell", "-c", "\"Expand-Archive -Path test_data.txt.zip -DestinationPath target -Force\""} - : - new String[]{"unzip", "test_data.txt.zip", "-d", "target"}, + "-Dquarkus.profile=test", + "-DBuildOutputJSONFile=" + GRAALVM_BUILD_OUTPUT_JSON_FILE, + "-DUnlockExperimentalBEGIN=" + GRAALVM_EXPERIMENTAL_BEGIN, + "-DUnlockExperimentalEND=" + GRAALVM_EXPERIMENTAL_END, + "-Dquarkus.native.native-image-xmx=" + NATIVE_IMAGE_XMX_GB + "g", + "-DfinalName=" + FINAL_NAME_TOKEN + } }, + new String[][] { + { IS_THIS_WINDOWS ? "target\\" + FINAL_NAME_TOKEN + ".exe" : "./target/" + FINAL_NAME_TOKEN } } + ), + QUARKUS_FULL_MICROPROFILE( + new String[][] { + { "mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), + "-Dquarkus.native.additional-build-args=" + + "-H:Log=registerResource:," + + "--trace-object-instantiation=java.util.Random" + } }, + new String[][] { + { IS_THIS_WINDOWS ? "target\\quarkus-runner.exe" : "./target/quarkus-runner" } } + ), + DEBUG_QUARKUS_FULL_MICROPROFILE( + new String[][] { + { "mvn", "package", "-Pnative", "-Dquarkus.native.debug.enabled=true", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), + "-Dquarkus.native.additional-build-args=" + + "-H:Log=registerResource:," + + "--trace-object-instantiation=java.util.Random" + }, + { "mvn", "dependency:sources", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString() } }, + new String[][] { { IS_THIS_WINDOWS ? "target\\quarkus-runner.exe" : "./target/quarkus-runner" } } + ), + QUARKUS_FULL_MICROPROFILE_PERF( + new String[][] { + { "mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), + "-Dquarkus.native.additional-build-args=" + + "-H:Log=registerResource:," + + "--trace-object-instantiation=java.util.Random," + + "-R:MaxHeapSize=" + MX_HEAP_MB + "m" + + GRAALVM_BUILD_OUTPUT_JSON_FILE + }, + { "mvn", "package", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString() } }, + new String[][] { + // GC: https://github.com/Karm/mandrel-integration-tests/pull/127#discussion_r1066802872 + // -XX:+UseShenandoahGC + // -XX:+UseSerialGC + // -XX:+UseG1GC + // Profile capture: + // No "--delay", "2000", for perf o capture startup too... + { "perf", "stat", "java", "-Xlog:gc", "-XX:+UseSerialGC", "-Xmx" + MX_HEAP_MB + "m", "-jar", "target/quarkus-app/quarkus-run.jar" }, + { "perf", "stat", "./target/quarkus-runner", "-XX:+PrintGC" } } + ), + QUARKUS_JSON_PERF_PARSEONCE( + new String[][] { + // TODO tune and report: https://www.graalvm.org/22.0/reference-manual/native-image/MemoryManagement/ + { "mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), + "-Dquarkus.native.additional-build-args=" + + "-R:MaxHeapSize=" + MX_HEAP_MB + "m," + + "-H:-ParseOnce" + + GRAALVM_BUILD_OUTPUT_JSON_FILE + "-ParseOnce", + "-Dcustom.final.name=quarkus-json_-ParseOnce" }, + { "mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), + "-Dquarkus.native.additional-build-args=" + + "-R:MaxHeapSize=" + MX_HEAP_MB + "m," + + "-H:+ParseOnce" + + GRAALVM_BUILD_OUTPUT_JSON_FILE + "+ParseOnce", + "-Dcustom.final.name=quarkus-json_+ParseOnce" }, + { "mvn", "package", "-Dcustom.final.name=quarkus-json", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString() } }, + new String[][] { + //-XX:+UseShenandoahGC + //-XX:+UseSerialGC + //-XX:+UseG1GC + { "perf", "stat", "--delay", "2000", "java", "-Xlog:gc", "-XX:+UseSerialGC", "-Xmx" + MX_HEAP_MB + "m", "-jar", "target/quarkus-app/quarkus-run.jar" }, + { "perf", "stat", "--delay", "1000", "./target/quarkus-json_-ParseOnce-runner", "-XX:+PrintGC" }, + { "perf", "stat", "--delay", "1000", "./target/quarkus-json_+ParseOnce-runner", "-XX:+PrintGC" } } + ), + QUARKUS_JSON_PERF( + new String[][] { + // TODO tune and report: https://www.graalvm.org/22.0/reference-manual/native-image/MemoryManagement/ + { "mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), + "-Dquarkus.native.additional-build-args=" + + "-R:MaxHeapSize=" + MX_HEAP_MB + "m" + + GRAALVM_BUILD_OUTPUT_JSON_FILE, + "-Dcustom.final.name=quarkus-json" }, + { "mvn", "package", "-Dcustom.final.name=quarkus-json", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString() } }, + new String[][] { + { "perf", "stat", "--delay", "2000", "java", "-Xlog:gc", "-XX:+UseSerialGC", "-Xmx" + MX_HEAP_MB + "m", "-jar", "target/quarkus-app/quarkus-run.jar" }, + { "perf", "stat", "--delay", "1000", "./target/quarkus-json-runner", "-XX:+PrintGC" } } + ), + QUARKUS_BUILDER_IMAGE_ENCODING( + new String[][] { + { "mvn", "package", "-Pnative", "-Dquarkus.native.container-build=true", + "-Dquarkus.native.container-runtime=" + CONTAINER_RUNTIME, + "-Dquarkus.native.builder-image=" + BUILDER_IMAGE, "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString() }, + { CONTAINER_RUNTIME, "build", "-f", "src/main/docker/Dockerfile.native", "-t", "my-quarkus-mandrel-app", "." } }, + new String[][] { - new String[] { "native-image", UnlockExperimentalVMOptions_23_1.token, - "-H:GenerateDebugInfo=" + (IS_THIS_MACOS ? "0" : "1"), "-H:+PreserveFramePointer", "-H:-DeleteLocalSymbols", - TrackNodeSourcePosition_23_0.token, - DebugCodeInfoUseSourceMappings_23_0.token, - OmitInlinedMethodDebugLineInfo_23_0.token, - LockExperimentalVMOptions_23_1.token, - "-jar", "target/debug-symbols-smoke.jar", "target/debug-symbols-smoke" }, - new String[]{"java", "-jar", "./target/debug-symbols-smoke.jar"}, - new String[]{IS_THIS_WINDOWS ? "target\\debug-symbols-smoke.exe" : "./target/debug-symbols-smoke"} - }), - JFR_PERFORMANCE(new String[][]{ - // Why do you need -H:+SignalHandlerBasedExecutionSampler? - // The recurring callback sampler runs by default and is biased. It also tends to sample a lot more than the - // SIGPROF based one (even though you can technically specify a desired rate). The SIGPROF one is what people - // should generally be using for now so I decided it was best to test that one. - // I don't think the difference between the two will be that huge anyway though. - // Source: https://github.com/Karm/mandrel-integration-tests/pull/179#discussion_r1295933521 - new String[]{"mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), "-Dquarkus.native.monitoring=jfr", - "-Dquarkus.native.additional-build-args=-H:+SignalHandlerBasedExecutionSampler", - "-DfinalName=jfr-perf"}, - new String[]{"./target/jfr-perf-runner", - "-XX:+FlightRecorder", - "-XX:StartFlightRecording=settings=" + BASE_DIR + File.separator + "apps" + File.separator + "jfr-native-image-performance/jfr-perf.jfc,filename=logs/flight-native.jfr", - "-XX:FlightRecorderLogging=jfr"}, - hyperfoil() - }), - PLAINTEXT_PERFORMANCE(new String[][]{ - new String[]{"mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), - "-DfinalName=jfr-plaintext"}, - new String[]{"./target/jfr-plaintext-runner"}, - hyperfoil() - }), - JFR_PERFORMANCE_BUILDER_IMAGE(new String[][]{ - new String[]{"mvn", "clean", "package", "-Pnative", "-Dquarkus.native.container-build=true", - "-Dquarkus.native.container-runtime=" + CONTAINER_RUNTIME, - "-Dquarkus.native.builder-image=" + BUILDER_IMAGE, "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), "-Dquarkus.native.monitoring=jfr", - "-Dquarkus.native.additional-build-args=-H:+SignalHandlerBasedExecutionSampler", - "-DfinalName=jfr-perf"}, - new String[]{CONTAINER_RUNTIME, "build", "-f", "src/main/docker/Dockerfile.native", "-t", "jfr-performance-app", "."}, - new String[]{CONTAINER_RUNTIME, "run", "--rm", "--network=host", - "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", - "-v", BASE_DIR + File.separator + "apps" + File.separator + "jfr-native-image-performance/logs:/tmp:z", - "--name", ContainerNames.JFR_PERFORMANCE_BUILDER_IMAGE.name, "jfr-performance-app", "-XX:+FlightRecorder", - "-XX:StartFlightRecording=settings=/work/jfr-perf.jfc,filename=/tmp/flight-native.jfr", - "-XX:FlightRecorderLogging=jfr"}, - hyperfoil() - }), - PLAINTEXT_PERFORMANCE_BUILDER_IMAGE(new String[][]{ - new String[]{"mvn", "clean", "package", "-Pnative", "-Dquarkus.native.container-build=true", - "-Dquarkus.native.container-runtime=" + CONTAINER_RUNTIME, - "-Dquarkus.native.builder-image=" + BUILDER_IMAGE, "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), - "-DfinalName=jfr-plaintext"}, - new String[]{CONTAINER_RUNTIME, "build", "-f", "src/main/docker/Dockerfile.native", "-t", "jfr-plaintext-app", "."}, - new String[]{CONTAINER_RUNTIME, "run", "--rm", "--network=host", - "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", - //"-v", BASE_DIR + File.separator + "apps" + File.separator + "jfr-native-image-performance/logs:/tmp:z", - "--name", ContainerNames.JFR_PLAINTEXT_BUILDER_IMAGE.name, "jfr-plaintext-app"}, - hyperfoil() - }), - JFR_SMOKE(new String[][]{ - new String[]{"mvn", "package"}, - IS_THIS_WINDOWS ? - new String[]{"powershell", "-c", "\"Expand-Archive -Path test_data.txt.zip -DestinationPath target -Force\""} - : - new String[]{"unzip", "test_data.txt.zip", "-d", "target"}, - new String[]{"native-image", JFR_MONITORING_SWITCH_TOKEN, "-jar", "target/debug-symbols-smoke.jar", "target/debug-symbols-smoke"}, - new String[]{"java", "-jar", "./target/debug-symbols-smoke.jar"}, - new String[]{"java", - JFR_FLIGHT_RECORDER_HOTSPOT_TOKEN, - "-XX:StartFlightRecording=filename=logs/flight-java.jfr", - "-Xlog:jfr", "-jar", "./target/debug-symbols-smoke.jar"}, - new String[]{IS_THIS_WINDOWS ? "target\\debug-symbols-smoke.exe" : "./target/debug-symbols-smoke"}, - new String[]{IS_THIS_WINDOWS ? "target\\debug-symbols-smoke.exe" : "./target/debug-symbols-smoke", - "-XX:+FlightRecorder", - "-XX:StartFlightRecording=filename=logs/flight-native.jfr", - "-XX:FlightRecorderLogging=jfr"} - }), - JFR_SMOKE_BUILDER_IMAGE(new String[][]{ - new String[]{"mvn", "package"}, - new String[]{"unzip", "test_data.txt.zip", "-d", "target"}, - new String[]{ - CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "debug-symbols-smoke:/project:z", - "--name", ContainerNames.JFR_SMOKE_BUILDER_IMAGE.name + "-build", - BUILDER_IMAGE, JFR_MONITORING_SWITCH_TOKEN, "-jar", "target/debug-symbols-smoke.jar", "target/debug-symbols-smoke"}, - new String[]{ - CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-i", - "--entrypoint", "java", "-v", BASE_DIR + File.separator + "apps" + File.separator + "debug-symbols-smoke:/project:z", - "--name", ContainerNames.JFR_SMOKE_BUILDER_IMAGE.name + "-run-java", - BUILDER_IMAGE, "-jar", "./target/debug-symbols-smoke.jar"}, - new String[]{ - CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-i", - "--entrypoint", "java", "-v", BASE_DIR + File.separator + "apps" + File.separator + "debug-symbols-smoke:/project:z", - "--name", ContainerNames.JFR_SMOKE_BUILDER_IMAGE.name + "-run-java-jfr", - BUILDER_IMAGE, - JFR_FLIGHT_RECORDER_HOTSPOT_TOKEN, - "-XX:StartFlightRecording=filename=logs/flight-java.jfr", - "-Xlog:jfr", "-jar", "./target/debug-symbols-smoke.jar"}, - new String[]{"./target/debug-symbols-smoke"}, - new String[]{ - "./target/debug-symbols-smoke", - "-XX:+FlightRecorder", - "-XX:StartFlightRecording=filename=logs/flight-native.jfr", - "-XX:FlightRecorderLogging=jfr"} - }), - JFR_OPTIONS(new String[][]{ - new String[]{"mvn", "package"}, - new String[]{"native-image", JFR_MONITORING_SWITCH_TOKEN, "-jar", "target/timezones.jar", "target/timezones"} - // @see JFRTest.java - }), - JFR_OPTIONS_BUILDER_IMAGE(new String[][]{ - new String[]{"mvn", "package"}, - new String[]{ - CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "timezones:/project:z", - "--name", ContainerNames.JFR_SMOKE_BUILDER_IMAGE.name + "-build", - BUILDER_IMAGE, JFR_MONITORING_SWITCH_TOKEN, "-jar", "target/timezones.jar", "target/timezones"} - // @see JFRTest.java - }), - RESLOCATIONS(new String[][]{ - new String[]{"mvn", "package"}, - new String[]{"native-image", "--initialize-at-build-time=.", "--no-fallback", - "-J--add-opens=java.desktop/com.sun.imageio.plugins.common=ALL-UNNAMED", - "-J--add-exports=java.desktop/com.sun.imageio.plugins.common=ALL-UNNAMED", - "-jar", "./target/reslocations.jar", "target/reslocations"}, - new String[]{IS_THIS_WINDOWS ? "target\\reslocations.exe" : "./target/reslocations"} - }), - MONITOR_OFFSET(new String[][] { - new String[] { "mvn", "package", "-POK" }, - new String[] { "native-image", "-R:-InstallSegfaultHandler", "-march=native", "--gc=serial", "--no-fallback", - "-jar", "target/monitor-field-offsets-ok.jar", "target/monitor-field-offsets-ok" }, - new String[] { IS_THIS_WINDOWS ? "target\\monitor-field-offsets-ok" : "./target/monitor-field-offsets-ok" }, - new String[] { "mvn", "package", "-PNOK" }, - new String[] { "native-image", "-R:-InstallSegfaultHandler", "-march=native", "--gc=serial", "--no-fallback", - "-jar", "target/monitor-field-offsets-nok.jar", "target/monitor-field-offsets-nok" } - }), - MONITOR_OFFSET_BUILDER_IMAGE(new String[][] { - new String[] { "mvn", "package", "-POK" }, - new String[] { - CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "monitor-field-offset:/project:z", - "--name", ContainerNames.MONITOR_OFFSET_BUILDER_IMAGE.name, - BUILDER_IMAGE, "-R:-InstallSegfaultHandler", "-march=native", "--gc=serial", "--no-fallback", - "-jar", "target/monitor-field-offsets-ok.jar", "target/monitor-field-offsets-ok" }, - new String[]{CONTAINER_RUNTIME, "build", "--network=host", "-t", ContainerNames.MONITOR_OFFSET_BUILDER_IMAGE.name, "."}, - new String[] { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "monitor-field-offset:/work:z", - ContainerNames.MONITOR_OFFSET_BUILDER_IMAGE.name, "target/monitor-field-offsets-ok" }, - new String[] { "mvn", "package", "-PNOK" }, - new String[] { - CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "monitor-field-offset:/project:z", - "--name", ContainerNames.MONITOR_OFFSET_BUILDER_IMAGE.name, - BUILDER_IMAGE, "-R:-InstallSegfaultHandler", "-march=native", "--gc=serial", "--no-fallback", - "-jar", "target/monitor-field-offsets-nok.jar", "target/monitor-field-offsets-nok" }, - }), - FOR_SERIALIZATION(new String[][] { - new String[] { "mvn", "package" }, - new String[] { "java", "-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image", - "-jar", "target/for-serialization.jar" }, - new String[] { "native-image", "-ea", "-march=native", "--no-fallback", "--link-at-build-time", - "-H:ConfigurationFileDirectories=src/main/resources/META-INF/native-image", - "-jar", "target/for-serialization.jar", "target/for-serialization" }, - new String[] { "java", "-jar", "target/for-serialization.jar" }, - new String[] { IS_THIS_WINDOWS ? "target\\for-serialization.exe" : "./target/for-serialization" } - }), - FOR_SERIALIZATION_BUILDER_IMAGE(new String[][] { - // Maven build - new String[] { "mvn", "package" }, - // Collect agent info - new String[] { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "--entrypoint", "java", "-v", BASE_DIR + File.separator + "apps" + File.separator + "for-serialization:/project:z", - BUILDER_IMAGE, "-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image", - "-jar", "target/for-serialization.jar" }, - // Native image build - new String[] { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "for-serialization:/project:z", - BUILDER_IMAGE, "-ea", "-march=native", "--no-fallback", "--link-at-build-time", - "-H:ConfigurationFileDirectories=src/main/resources/META-INF/native-image", - "-jar", "target/for-serialization.jar", "target/for-serialization" }, - // Build runtime container for native executable - new String[] { CONTAINER_RUNTIME, "build", "--network=host", "-t", ContainerNames.FOR_SERIALIZATION_BUILDER_IMAGE.name, "." }, - // Run Java, HotSpot version in container, uses our builder image - new String[] { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "--entrypoint", "java", "-v", BASE_DIR + File.separator + "apps" + File.separator + "for-serialization:/project:z", - BUILDER_IMAGE, "-jar", "target/for-serialization.jar" }, - // Run native executable in container, uses a plain UBI image - new String[] { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), - "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "for-serialization:/work:z", - ContainerNames.FOR_SERIALIZATION_BUILDER_IMAGE.name, "target/for-serialization" }, - }); - - public final String[][] cmds; + { CONTAINER_RUNTIME, "run", "-i", "--rm", "-p", "8080:8080", + "--name", ContainerNames.QUARKUS_BUILDER_IMAGE_ENCODING.name, "my-quarkus-mandrel-app" } } + ), + DEBUG_QUARKUS_BUILDER_IMAGE_VERTX( + new String[][] { + { "mvn", "dependency:sources", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString() }, + { "mvn", "package", "-Pnative", "-Dquarkus.native.container-build=true", + "-Dquarkus.native.container-runtime=" + CONTAINER_RUNTIME, + "-Dquarkus.native.builder-image=" + BUILDER_IMAGE, + "-Dquarkus.native.debug.enabled=true", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString() }, + { CONTAINER_RUNTIME, "build", "--network=host", "-f", "src/main/docker/Dockerfile.native", "-t", "my-quarkus-mandrel-app", "." }, + { CONTAINER_RUNTIME, "run", "--network=host", "--ulimit", "memlock=-1:-1", "-it", "-d", "--rm=true", + "--name", "quarkus_test_db", "-e", "POSTGRES_USER=quarkus_test", "-e", "POSTGRES_PASSWORD=quarkus_test", + "-e", "POSTGRES_DB=quarkus_test", "quay.io/debezium/postgres:15" } }, + new String[][] { + { CONTAINER_RUNTIME, "run", "--network=host", "--cap-add=SYS_PTRACE", "--security-opt=seccomp=unconfined", + "-i", "-d", "--rm", "--name", ContainerNames.DEBUG_QUARKUS_BUILDER_IMAGE_VERTX.name, "my-quarkus-mandrel-app" } } + ), + RANDOM_NUMBERS( + new String[][] { + { "mvn", "package" }, + { "native-image", "-jar", "target/random-numbers.jar", "target/random-numbers" } }, + new String[][] { + { IS_THIS_WINDOWS ? "target\\random-numbers.exe" : "./target/random-numbers" } } + ), + HELIDON_QUICKSTART_SE( + new String[][] { + { "mvn", "package" } }, + new String[][] { + { IS_THIS_WINDOWS ? "target\\helidon-quickstart-se.exe" : "./target/helidon-quickstart-se" } } + ), + TIMEZONES( + new String[][] { + { "mvn", "package" }, + { "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[][] { + { "mvn", "package" }, + { "native-image", "--link-at-build-time=calendar.Main", "-jar", "target/calendars.jar", "target/calendars" } }, + new String[][] { + { IS_THIS_WINDOWS ? "target\\calendars.exe" : "./target/calendars" } } + ), + RECORDANNOTATIONS( + new String[][] { + { "mvn", "package" }, + { "native-image", "--no-fallback", "-jar", "target/recordannotations.jar", "target/recordannotations" } }, + new String[][] { + { IS_THIS_WINDOWS ? "target\\recordannotations.exe" : "./target/recordannotations" } } + ), + VERSIONS( + new String[][] { + { "mvn", "package" }, + { "native-image", "--features=org.graalvm.home.HomeFinderFeature", "-jar", "target/version.jar", "target/version" } }, + new String[][] { + { IS_THIS_WINDOWS ? "target\\version.exe" : "./target/version" } } + ), + IMAGEIO( + new String[][] { + { "mvn", "clean", "package" }, + { "java", "-Djava.awt.headless=true", "-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image", "-jar", "target/imageio.jar" }, + { "jar", "uf", "target/imageio.jar", "-C", "src/main/resources/", "META-INF" }, + { "native-image", UnlockExperimentalVMOptions_23_1.token, ForeignAPISupport_24_2.token, LockExperimentalVMOptions_23_1.token, + "-J-Djava.awt.headless=true", "--no-fallback", "-jar", "target/imageio.jar", "target/imageio" } }, + new String[][] { + { IS_THIS_WINDOWS ? "target\\imageio.exe" : "./target/imageio", "-Djava.home=.", "-Djava.awt.headless=true" } } + ), + IMAGEIO_BUILDER_IMAGE( + new String[][] { + // Bring Your Own Maven (not a part of the builder image toolchain) + { "mvn", "package" }, + // TODO: Ad -u: Test access rights with -u on Windows, Docker Desktop Hyper-V backend vs. WSL2 backend. + // Java from Builder image container is used for the sake of consistence. + { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "--entrypoint", "java", "-v", BASE_DIR + File.separator + "apps" + File.separator + "imageio:/project:z", + BUILDER_IMAGE, "-Djava.awt.headless=true", + "-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image", "-jar", "target/imageio.jar" }, + // Jar could be used locally, but we use the one from container too. + { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "--entrypoint", "jar", "-v", BASE_DIR + File.separator + "apps" + File.separator + "imageio:/project:z", + BUILDER_IMAGE, + "uf", "target/imageio.jar", "-C", "src/main/resources/", "META-INF" }, + // Native image build itself (jar was updated with properties in the previous step) + { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "imageio:/project:z", + BUILDER_IMAGE, UnlockExperimentalVMOptions_23_1.token, ForeignAPISupport_24_2.token, LockExperimentalVMOptions_23_1.token, + "-J-Djava.awt.headless=true", "--no-fallback", "-jar", "target/imageio.jar", "target/imageio" }, + // We build a runtime image, ubi 8 minimal based, runtime dependencies installed + { CONTAINER_RUNTIME, "build", "--network=host", "-t", ContainerNames.IMAGEIO_BUILDER_IMAGE.name, "." } }, + new String[][] { + // We have to run in the same env as we run the java part above, i.e. in the same container base. + // Hashsums of font rotations would differ otherwise as your linux host might have different freetype native libs. + { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "imageio:/work:z", + ContainerNames.IMAGEIO_BUILDER_IMAGE.name, "/work/target/imageio", "-Djava.home=.", "-Djava.awt.headless=true" } } + ), + DEBUG_SYMBOLS_SMOKE( + new String[][] { + { "mvn", "package" }, + IS_THIS_WINDOWS ? + new String[] { "powershell", "-c", "\"Expand-Archive -Path test_data.txt.zip -DestinationPath target -Force\"" } + : new String[] { "unzip", "test_data.txt.zip", "-d", "target" }, + { "native-image", UnlockExperimentalVMOptions_23_1.token, + "-H:GenerateDebugInfo=" + (IS_THIS_MACOS ? "0" : "1"), "-H:+PreserveFramePointer", "-H:-DeleteLocalSymbols", + TrackNodeSourcePosition_23_0.token, + DebugCodeInfoUseSourceMappings_23_0.token, + OmitInlinedMethodDebugLineInfo_23_0.token, + LockExperimentalVMOptions_23_1.token, + "-jar", "target/debug-symbols-smoke.jar", "target/debug-symbols-smoke" } }, + new String[][] { + { "java", "-jar", "./target/debug-symbols-smoke.jar" }, + { IS_THIS_WINDOWS ? "target\\debug-symbols-smoke.exe" : "./target/debug-symbols-smoke" } } + ), + JFR_PERFORMANCE( + new String[][] { + // Why do you need -H:+SignalHandlerBasedExecutionSampler? + // The recurring callback sampler runs by default and is biased. It also tends to sample a lot more than the + // SIGPROF based one (even though you can technically specify a desired rate). The SIGPROF one is what people + // should generally be using for now so I decided it was best to test that one. + // I don't think the difference between the two will be that huge anyway though. + // Source: https://github.com/Karm/mandrel-integration-tests/pull/179#discussion_r1295933521 + { "mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), "-Dquarkus.native.monitoring=jfr", + "-Dquarkus.native.additional-build-args=-H:+SignalHandlerBasedExecutionSampler", + "-DfinalName=jfr-perf" } }, + new String[][] { + { "./target/jfr-perf-runner", + "-XX:+FlightRecorder", + "-XX:StartFlightRecording=settings=" + BASE_DIR + File.separator + "apps" + File.separator + "jfr-native-image-performance/jfr-perf.jfc,filename=logs/flight-native.jfr", + "-XX:FlightRecorderLogging=jfr" }, + hyperfoil() } + ), + PLAINTEXT_PERFORMANCE( + new String[][] { + { "mvn", "package", "-Pnative", "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), + "-DfinalName=jfr-plaintext" } }, + new String[][] { + { "./target/jfr-plaintext-runner" }, + hyperfoil() } + ), + JFR_PERFORMANCE_BUILDER_IMAGE( + new String[][] { + { "mvn", "clean", "package", "-Pnative", "-Dquarkus.native.container-build=true", + "-Dquarkus.native.container-runtime=" + CONTAINER_RUNTIME, + "-Dquarkus.native.builder-image=" + BUILDER_IMAGE, "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), "-Dquarkus.native.monitoring=jfr", + "-Dquarkus.native.additional-build-args=-H:+SignalHandlerBasedExecutionSampler", + "-DfinalName=jfr-perf" }, + { CONTAINER_RUNTIME, "build", "-f", "src/main/docker/Dockerfile.native", "-t", "jfr-performance-app", "." } }, + new String[][] { + { CONTAINER_RUNTIME, "run", "--rm", "--network=host", + "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", + "-v", BASE_DIR + File.separator + "apps" + File.separator + "jfr-native-image-performance/logs:/tmp:z", + "--name", ContainerNames.JFR_PERFORMANCE_BUILDER_IMAGE.name, "jfr-performance-app", "-XX:+FlightRecorder", + "-XX:StartFlightRecording=settings=/work/jfr-perf.jfc,filename=/tmp/flight-native.jfr", + "-XX:FlightRecorderLogging=jfr" }, + hyperfoil() + } + ), + PLAINTEXT_PERFORMANCE_BUILDER_IMAGE( + new String[][] { + { "mvn", "clean", "package", "-Pnative", "-Dquarkus.native.container-build=true", + "-Dquarkus.native.container-runtime=" + CONTAINER_RUNTIME, + "-Dquarkus.native.builder-image=" + BUILDER_IMAGE, "-Dquarkus.version=" + QUARKUS_VERSION.getVersionString(), + "-DfinalName=jfr-plaintext" }, + { CONTAINER_RUNTIME, "build", "-f", "src/main/docker/Dockerfile.native", "-t", "jfr-plaintext-app", "." } }, + new String[][] { + { CONTAINER_RUNTIME, "run", "--rm", "--network=host", + "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", + //"-v", BASE_DIR + File.separator + "apps" + File.separator + "jfr-native-image-performance/logs:/tmp:z", + "--name", ContainerNames.JFR_PLAINTEXT_BUILDER_IMAGE.name, "jfr-plaintext-app" }, + hyperfoil() } + ), + JFR_SMOKE( + new String[][] { + { "mvn", "package" }, + IS_THIS_WINDOWS ? + new String[] { "powershell", "-c", "\"Expand-Archive -Path test_data.txt.zip -DestinationPath target -Force\"" } + : new String[] { "unzip", "test_data.txt.zip", "-d", "target" }, + { "native-image", JFR_MONITORING_SWITCH_TOKEN, "-jar", "target/debug-symbols-smoke.jar", "target/debug-symbols-smoke" } }, + new String[][] { + { "java", "-jar", "./target/debug-symbols-smoke.jar" }, + { "java", + JFR_FLIGHT_RECORDER_HOTSPOT_TOKEN, + "-XX:StartFlightRecording=filename=logs/flight-java.jfr", + "-Xlog:jfr", "-jar", "./target/debug-symbols-smoke.jar" }, + { IS_THIS_WINDOWS ? "target\\debug-symbols-smoke.exe" : "./target/debug-symbols-smoke" }, + { IS_THIS_WINDOWS ? "target\\debug-symbols-smoke.exe" : "./target/debug-symbols-smoke", + "-XX:+FlightRecorder", + "-XX:StartFlightRecording=filename=logs/flight-native.jfr", + "-XX:FlightRecorderLogging=jfr" } } + ), + JFR_SMOKE_BUILDER_IMAGE( + new String[][] { + { "mvn", "package" }, + { "unzip", "test_data.txt.zip", "-d", "target" }, + { CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "debug-symbols-smoke:/project:z", + "--name", ContainerNames.JFR_SMOKE_BUILDER_IMAGE.name + "-build", + BUILDER_IMAGE, JFR_MONITORING_SWITCH_TOKEN, "-jar", "target/debug-symbols-smoke.jar", "target/debug-symbols-smoke" } }, + new String[][] { + { CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-i", + "--entrypoint", "java", "-v", BASE_DIR + File.separator + "apps" + File.separator + "debug-symbols-smoke:/project:z", + "--name", ContainerNames.JFR_SMOKE_BUILDER_IMAGE.name + "-run-java", + BUILDER_IMAGE, "-jar", "./target/debug-symbols-smoke.jar" }, + { CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-i", + "--entrypoint", "java", "-v", BASE_DIR + File.separator + "apps" + File.separator + "debug-symbols-smoke:/project:z", + "--name", ContainerNames.JFR_SMOKE_BUILDER_IMAGE.name + "-run-java-jfr", + BUILDER_IMAGE, + JFR_FLIGHT_RECORDER_HOTSPOT_TOKEN, + "-XX:StartFlightRecording=filename=logs/flight-java.jfr", + "-Xlog:jfr", "-jar", "./target/debug-symbols-smoke.jar" }, + { "./target/debug-symbols-smoke" }, + { "./target/debug-symbols-smoke", + "-XX:+FlightRecorder", + "-XX:StartFlightRecording=filename=logs/flight-native.jfr", + "-XX:FlightRecorderLogging=jfr" } } + ), + JFR_OPTIONS( + new String[][] { + { "mvn", "package" }, + { "native-image", JFR_MONITORING_SWITCH_TOKEN, "-jar", "target/timezones.jar", "target/timezones" }/* @see JFRTest.java */ } + ), + JFR_OPTIONS_BUILDER_IMAGE( + new String[][] { + { "mvn", "package" }, + { CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "timezones:/project:z", + "--name", ContainerNames.JFR_SMOKE_BUILDER_IMAGE.name + "-build", + BUILDER_IMAGE, JFR_MONITORING_SWITCH_TOKEN, "-jar", "target/timezones.jar", "target/timezones" }/* @see JFRTest.java */ } + ), + RESLOCATIONS( + new String[][] { + { "mvn", "package" }, + { "native-image", "--initialize-at-build-time=.", "--no-fallback", + "-J--add-opens=java.desktop/com.sun.imageio.plugins.common=ALL-UNNAMED", + "-J--add-exports=java.desktop/com.sun.imageio.plugins.common=ALL-UNNAMED", + "-jar", "./target/reslocations.jar", "target/reslocations" } }, + new String[][] { + { IS_THIS_WINDOWS ? "target\\reslocations.exe" : "./target/reslocations" } } + ), + MONITOR_OFFSET_OK( + new String[][] { + { "mvn", "package", "-POK" }, + { "native-image", "-R:-InstallSegfaultHandler", "-march=native", "--gc=serial", "--no-fallback", + "-jar", "target/monitor-field-offsets-ok.jar", "target/monitor-field-offsets-ok" } }, + new String[][] { + { IS_THIS_WINDOWS ? "target\\monitor-field-offsets-ok" : "./target/monitor-field-offsets-ok" } } + ), + MONITOR_OFFSET_NOK( + new String[][] { + { "mvn", "package", "-PNOK" }, + { "native-image", "-R:-InstallSegfaultHandler", "-march=native", "--gc=serial", "--no-fallback", + "-jar", "target/monitor-field-offsets-nok.jar", "target/monitor-field-offsets-nok" } } + ), + MONITOR_OFFSET_OK_BUILDER_IMAGE( + new String[][] { + { "mvn", "package", "-POK" }, + { CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "monitor-field-offset:/project:z", + "--name", ContainerNames.MONITOR_OFFSET_BUILDER_IMAGE.name, + BUILDER_IMAGE, "-R:-InstallSegfaultHandler", "-march=native", "--gc=serial", "--no-fallback", + "-jar", "target/monitor-field-offsets-ok.jar", "target/monitor-field-offsets-ok" }, + { CONTAINER_RUNTIME, "build", "--network=host", "-t", ContainerNames.MONITOR_OFFSET_BUILDER_IMAGE.name, "." } }, + new String[][] { + { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "monitor-field-offset:/work:z", + ContainerNames.MONITOR_OFFSET_BUILDER_IMAGE.name, "target/monitor-field-offsets-ok" } } + ), + MONITOR_OFFSET_NOK_BUILDER_IMAGE( + new String[][] { + { "mvn", "package", "-PNOK" }, + { CONTAINER_RUNTIME, "run", "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "monitor-field-offset:/project:z", + "--name", ContainerNames.MONITOR_OFFSET_BUILDER_IMAGE.name, + BUILDER_IMAGE, "-R:-InstallSegfaultHandler", "-march=native", "--gc=serial", "--no-fallback", + "-jar", "target/monitor-field-offsets-nok.jar", "target/monitor-field-offsets-nok" } } + ), + FOR_SERIALIZATION( + new String[][] { + { "mvn", "package" }, + { "java", "-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image", + "-jar", "target/for-serialization.jar" }, + { "native-image", "-ea", "-march=native", "--no-fallback", "--link-at-build-time", + "-H:ConfigurationFileDirectories=src/main/resources/META-INF/native-image", + "-jar", "target/for-serialization.jar", "target/for-serialization" } }, + new String[][] { + { "java", "-jar", "target/for-serialization.jar" }, + { IS_THIS_WINDOWS ? "target\\for-serialization.exe" : "./target/for-serialization" } } + ), + FOR_SERIALIZATION_BUILDER_IMAGE( + new String[][] { + // Maven build + { "mvn", "package" }, + // Collect agent info + { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "--entrypoint", "java", "-v", BASE_DIR + File.separator + "apps" + File.separator + "for-serialization:/project:z", + BUILDER_IMAGE, "-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image", + "-jar", "target/for-serialization.jar" }, + // Native image build + { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "for-serialization:/project:z", + BUILDER_IMAGE, "-ea", "-march=native", "--no-fallback", "--link-at-build-time", + "-H:ConfigurationFileDirectories=src/main/resources/META-INF/native-image", + "-jar", "target/for-serialization.jar", "target/for-serialization" }, + // Build runtime container for native executable + { CONTAINER_RUNTIME, "build", "--network=host", "-t", ContainerNames.FOR_SERIALIZATION_BUILDER_IMAGE.name, "." } }, + new String[][] { + // Run Java, HotSpot version in container, uses our builder image + { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "--entrypoint", "java", "-v", BASE_DIR + File.separator + "apps" + File.separator + "for-serialization:/project:z", + BUILDER_IMAGE, "-jar", "target/for-serialization.jar" }, + // Run native executable in container, uses a plain UBI image + { CONTAINER_RUNTIME, "run", IS_THIS_WINDOWS ? "" : "-u", IS_THIS_WINDOWS ? "" : getUnixUIDGID(), + "-t", "-v", BASE_DIR + File.separator + "apps" + File.separator + "for-serialization:/work:z", + ContainerNames.FOR_SERIALIZATION_BUILDER_IMAGE.name, "target/for-serialization" } } + ); private static String[] hyperfoil() { if (IS_THIS_MACOS) { @@ -466,7 +519,17 @@ private static String[] hyperfoil() { } } - BuildAndRunCmds(String[][] cmds) { - this.cmds = cmds; + final String[][] buildCommands; + public final String[][] runCommands; + + BuildAndRunCmds(String[][] buildCommands, String[][] runCommands) + { + this.buildCommands = buildCommands; + this.runCommands = runCommands; + } + + BuildAndRunCmds(String[][] buildCommands) + { + this(buildCommands, null); } } diff --git a/testsuite/src/it/java/org/graalvm/tests/integration/utils/Commands.java b/testsuite/src/it/java/org/graalvm/tests/integration/utils/Commands.java index 1c1d65a..3cfc766 100644 --- a/testsuite/src/it/java/org/graalvm/tests/integration/utils/Commands.java +++ b/testsuite/src/it/java/org/graalvm/tests/integration/utils/Commands.java @@ -1117,22 +1117,22 @@ public static boolean waitForBufferToMatch(StringBuilder report, StringBuffer st * "-Dcustom.final.name=quarkus-json_-ParseOnce"}, * //@formatter:on */ - public static void builderRoutine(int startIndexInclusive, int endIndexExclusive, Apps app, StringBuilder report, String cn, String mn, File appDir, + public static void builderRoutine(Apps app, StringBuilder report, String cn, String mn, File appDir, File processLog, Map env, Map switchReplacements) throws IOException { - // The last command is reserved for running it - assertTrue(app.buildAndRunCmds.cmds.length > 1); + String[][] buildCommands = app.buildAndRunCmds.buildCommands; + assertTrue(buildCommands.length > 0); if (report != null) { Logs.appendln(report, "# " + cn + ", " + mn); } - for (int i = startIndexInclusive; i < endIndexExclusive; i++) { + for (int i = 0; i < buildCommands.length; i++) { // We cannot run commands in parallel, we need them to follow one after another final ExecutorService buildService = Executors.newFixedThreadPool(1); final List cmd; // Replace possible placeholders with actual switches if (switchReplacements != null && !switchReplacements.isEmpty()) { - cmd = replaceSwitchesInCmd(getRunCommand(app.buildAndRunCmds.cmds[i]), switchReplacements); + cmd = replaceSwitchesInCmd(getRunCommand(buildCommands[i]), switchReplacements); } else { - cmd = getRunCommand(app.buildAndRunCmds.cmds[i]); + cmd = getRunCommand(buildCommands[i]); } Files.writeString(processLog.toPath(), String.join(" ", cmd) + "\n", StandardOpenOption.APPEND, StandardOpenOption.CREATE); buildService.submit(new Commands.ProcessRunner(appDir, processLog, cmd, 20, env)); // might take a long time.... @@ -1147,25 +1147,11 @@ public static void builderRoutine(int startIndexInclusive, int endIndexExclusive } public static void builderRoutine(Apps app, StringBuilder report, String cn, String mn, File appDir, File processLog) throws IOException { - builderRoutine(0, app.buildAndRunCmds.cmds.length - 1, app, report, cn, mn, appDir, processLog, null, null); + builderRoutine(app, report, cn, mn, appDir, processLog, null, null); } public static void builderRoutine(Apps app, StringBuilder report, String cn, String mn, File appDir, File processLog, Map env) throws IOException { - builderRoutine(0, app.buildAndRunCmds.cmds.length - 1, app, report, cn, mn, appDir, processLog, env, null); - } - - public static void builderRoutine(int endIndexExclusive, Apps app, StringBuilder report, String cn, String mn, File appDir, File processLog) throws IOException { - builderRoutine(0, endIndexExclusive, app, report, cn, mn, appDir, processLog, null, null); - } - - public static void builderRoutine(int endIndexExclusive, Apps app, StringBuilder report, String cn, String mn, File appDir, - File processLog, Map env, Map switchReplacements) throws IOException { - builderRoutine(0, endIndexExclusive, app, report, cn, mn, appDir, processLog, env, switchReplacements); - - } - - public static void builderRoutine(int startIndexInclusive, int endIndexExclusive, Apps app, StringBuilder report, String cn, String mn, File appDir, File processLog) throws IOException { - builderRoutine(startIndexInclusive, endIndexExclusive, app, report, cn, mn, appDir, processLog, null, null); + builderRoutine(app, report, cn, mn, appDir, processLog, env, null); } public static List replaceSwitchesInCmd(final List cmd, final Map switchReplacements) {