Skip to content

Commit 9cdde56

Browse files
committed
Add native-image build to the failure type
1 parent 39f9b88 commit 9cdde56

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

.github/workflows/run-consecutive-tests.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,18 @@ for VERSION in "${VERSIONS[@]}"; do
2929
GVM_TCK_LV="$VERSION" ./gradlew clean javac -Pcoordinates="$TEST_COORDINATES"
3030
RESULT=$?
3131
if [ "$RESULT" -ne 0 ]; then
32-
echo "FAILED ['javac' Compile]:$VERSION"
32+
echo "FAILED [javac compile]:$VERSION"
3333
break
3434
fi
3535

36+
# check if native-image can be built
37+
GVM_TCK_LV="$VERSION" ./gradlew clean nativeTestCompile -Pcoordinates="$TEST_COORDINATES"
38+
RESULT=$?
39+
if [ "$RESULT" -ne 0 ]; then
40+
echo "FAILED [native-image build]:$VERSION"
41+
break
42+
fi
43+
3644
echo "Running test with GVM_TCK_LV=$VERSION and coordinates=$TEST_COORDINATES"
3745
GVM_TCK_LV="$VERSION" ./gradlew test -Pcoordinates="$TEST_COORDINATES"
3846
RESULT=$?
@@ -49,7 +57,7 @@ for VERSION in "${VERSIONS[@]}"; do
4957
if [ "$RESULT" -eq 0 ]; then
5058
echo "PASSED:$VERSION"
5159
else
52-
echo "FAILED ['native-image' Test Run]:$VERSION"
60+
echo "FAILED [native-image run]:$VERSION"
5361
break
5462
fi
5563
done

tests/tck-build-logic/src/main/groovy/org.graalvm.internal.tck-harness.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import org.graalvm.internal.tck.harness.tasks.CheckstyleInvocationTask
2121
import org.graalvm.internal.tck.harness.tasks.CleanInvocationTask
2222
import org.graalvm.internal.tck.harness.tasks.JavacInvocationTask
2323
import org.graalvm.internal.tck.harness.tasks.JavaTestInvocationTask
24+
import org.graalvm.internal.tck.harness.tasks.NativeTestCompileInvocationTask
2425
import org.graalvm.internal.tck.updaters.FetchExistingLibrariesWithNewerVersionsTask
2526
import org.graalvm.internal.tck.updaters.GroupUnsupportedLibraries
2627

@@ -51,6 +52,12 @@ Provider<Task> javac = tasks.register("javac") { task ->
5152
task.setGroup(LifecycleBasePlugin.BUILD_GROUP)
5253
}
5354

55+
// gradle nativeTestCompile -Pcoordinates=<maven-coordinates>
56+
Provider<Task> nativeTestCompile = tasks.register("nativeTestCompile") { task ->
57+
task.setDescription("Compiles native tests (nativeTestCompile) for all subprojects")
58+
task.setGroup(LifecycleBasePlugin.BUILD_GROUP)
59+
}
60+
5461
// gradle javaTest -Pcoordinates=<maven-coordinates>
5562
Provider<Task> javaTest = tasks.register("javaTest") { task ->
5663
task.setDescription("Runs JVM tests (Gradle 'test') for all subprojects")
@@ -95,6 +102,14 @@ for (String coordinates in matchingCoordinates) {
95102
dependsOn(javacTaskName)
96103
}
97104

105+
String nativeTestCompileTaskName = generateTaskName("nativeTestCompile", coordinates)
106+
if ((!tasks.getNames().contains(nativeTestCompileTaskName))) {
107+
tasks.register(nativeTestCompileTaskName, NativeTestCompileInvocationTask, coordinates)
108+
}
109+
nativeTestCompile.configure {
110+
dependsOn(nativeTestCompileTaskName)
111+
}
112+
98113
String javaTestTaskName = generateTaskName("javaTest", coordinates)
99114
if ((!tasks.getNames().contains(javaTestTaskName))) {
100115
tasks.register(javaTestTaskName, JavaTestInvocationTask, coordinates)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
7+
8+
package org.graalvm.internal.tck.harness.tasks
9+
10+
import org.gradle.api.tasks.Input
11+
12+
import javax.inject.Inject
13+
/**
14+
* Task that is used to compile native tests (Gradle 'nativeTestCompile') on subprojects.
15+
*/
16+
@SuppressWarnings("unused")
17+
abstract class NativeTestCompileInvocationTask extends AbstractSubprojectTask {
18+
19+
@Inject
20+
NativeTestCompileInvocationTask(String coordinates) {
21+
super(coordinates)
22+
}
23+
24+
@Override
25+
@Input
26+
List<String> getCommand() {
27+
return [tckExtension.repoRoot.get().asFile.toPath().resolve("gradlew").toString(), "nativeTestCompile"]
28+
}
29+
30+
@Override
31+
protected String getErrorMessage(int exitCode) {
32+
"Native test compilation failed"
33+
}
34+
35+
}

0 commit comments

Comments
 (0)