From 3bef401b056d417a72c87deab586ebc49612b934 Mon Sep 17 00:00:00 2001 From: David Nestorovic Date: Thu, 21 Mar 2024 15:48:57 +0100 Subject: [PATCH] Prevent --- .../org.graalvm.internal.tck-harness.gradle | 22 ++++++++++++++----- .../internal/tck/harness/TckExtension.java | 7 ++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/tests/tck-build-logic/src/main/groovy/org.graalvm.internal.tck-harness.gradle b/tests/tck-build-logic/src/main/groovy/org.graalvm.internal.tck-harness.gradle index 18053b5f8..e6f86c486 100644 --- a/tests/tck-build-logic/src/main/groovy/org.graalvm.internal.tck-harness.gradle +++ b/tests/tck-build-logic/src/main/groovy/org.graalvm.internal.tck-harness.gradle @@ -74,6 +74,7 @@ Provider diff = tasks.register("diff", DefaultTask) { task -> } List diffCoordinates = new ArrayList<>() +boolean testAll = false if (project.hasProperty("baseCommit")) { String baseCommit = project.findProperty("baseCommit") String newCommit = Objects.requireNonNullElse(project.findProperty("newCommit"), "HEAD") @@ -87,6 +88,8 @@ if (project.hasProperty("baseCommit")) { dependsOn(taskTaskName) } } + + testAll = tck.shouldTestAll() } def matrixDefault = [ @@ -136,13 +139,22 @@ Provider generateMatrixDiffCoordinates = tasks.register("generateMatrixDif ] matrix.putAll(matrixDefault) + /** - * when we are introducing a new metadata, we should test it against all versions, - * not just the oldest and the newest one (which we are testing by default) + * if we changed some files from tck-build-logic or github workflows, we must run all tests + * to check if we accidentally broke something. In this case, we will have a lots of tests, so we can't + * run them with all possible JDK versions, because we will hit the following error: + * Strategy expansion exceeded 256 results for job 'test-changed-metadata' */ - matrix.version.add("21") - matrix.version.add("22") - matrix.version.add("dev") + if (!testAll) { + /** + * when we are introducing a new metadata, we should test it against all versions, + * not just the oldest and the newest one (which we are testing by default) + */ + matrix.version.add("21") + matrix.version.add("22") + matrix.version.add("dev") + } println "::set-output name=matrix::${JsonOutput.toJson(matrix)}" println "::set-output name=none-found::false" } diff --git a/tests/tck-build-logic/src/main/groovy/org/graalvm/internal/tck/harness/TckExtension.java b/tests/tck-build-logic/src/main/groovy/org/graalvm/internal/tck/harness/TckExtension.java index f58f402e0..2cff195d9 100644 --- a/tests/tck-build-logic/src/main/groovy/org/graalvm/internal/tck/harness/TckExtension.java +++ b/tests/tck-build-logic/src/main/groovy/org/graalvm/internal/tck/harness/TckExtension.java @@ -119,6 +119,12 @@ Path getTestDir(String coordinates) { throw new RuntimeException("Missing test-directory for coordinates `" + coordinates + "`"); } + private boolean shouldTestAll = false; + + public boolean shouldTestAll() { + return shouldTestAll; + } + /** * Returns a list of coordinates that match changed files between baseCommit and newCommit. * @@ -154,6 +160,7 @@ List diffCoordinates(String baseCommit, String newCommit) { })); if (testAll.get()) { + shouldTestAll = true; // If tck was changed we should retest everything, just to be safe. return getMatchingCoordinates(""); }