Skip to content

Commit 2db52f3

Browse files
committed
Pass test-ids from test configuration
1 parent 3763517 commit 2db52f3

File tree

6 files changed

+7
-16
lines changed

6 files changed

+7
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

common/junit-platform-native/src/main/java/org/graalvm/junit/platform/NativeImageJUnitLauncher.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ private static Stream<Path> findFiles(Path dir, String prefix) throws IOExceptio
193193
}
194194

195195
private static Path getTestIDsFromDefaultLocations() {
196-
System.out.println("[junit-platform-native] WARNING: Trying to find test-ids on default locations.");
196+
System.out.println("[junit-platform-native] WARNING: Trying to find test-ids on default locations. " +
197+
"This should only happen if you are running tests executable manually.");
197198
Path defaultGradleTestIDsLocation = getGradleTestIdsDefaultLocation();
198199
Path defaultMavenTestIDsLocation = getMavenTestIDsDefaultLocation();
199200

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

native-gradle-plugin/src/main/java/org/graalvm/buildtools/gradle/NativeImagePlugin.java

+1-11
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,6 @@ public void registerTestBinary(Project project,
651651

652652
// Following ensures that required feature jar is on classpath for every project
653653
injectTestPluginDependencies(project, graalExtension.getTestSupport());
654-
655654
TaskProvider<BuildNativeImageTask> testImageBuilder = tasks.named(deriveTaskName(name, "native", "Compile"), BuildNativeImageTask.class, task -> {
656655
task.setOnlyIf(t -> graalExtension.getTestSupport().get() && testListDirectory.getAsFile().get().exists());
657656
task.getTestListDirectory().set(testListDirectory);
@@ -663,6 +662,7 @@ public void registerTestBinary(Project project,
663662
// Later this will be replaced by a dedicated task not requiring execution of tests
664663
testList.from(testListDirectory).builtBy(testTask);
665664
testOptions.getClasspath().from(testList);
665+
testOptions.getRuntimeArgs().add("-D" + JUNIT_PLATFORM_LISTENERS_UID_TRACKING_OUTPUT_DIR + "=" + testResultsDir.dir(testTask.getName() + "/testlist").get().getAsFile().getAbsolutePath());
666666
});
667667
if (isPrimaryTest) {
668668
tasks.register(DEPRECATED_NATIVE_TEST_BUILD_TASK, t -> {
@@ -770,16 +770,6 @@ private static NativeImageOptions createTestOptions(GraalVMExtension graalExtens
770770
runtimeArgs.add("--xml-output-dir");
771771
runtimeArgs.add(project.getLayout().getBuildDirectory().dir("test-results/" + binaryName + "-native").map(d -> d.getAsFile().getAbsolutePath()));
772772

773-
String testIds;
774-
String propertyBasedLocation = System.getProperty(UniqueIdTrackingListener.OUTPUT_DIR_PROPERTY_NAME);
775-
if (propertyBasedLocation != null) {
776-
testIds = Path.of(propertyBasedLocation).toAbsolutePath().toString();
777-
} else {
778-
testIds = project.getLayout().getBuildDirectory().dir("test-results/" + binaryName + "/testlist").map(d -> d.getAsFile().getAbsolutePath()).get();
779-
}
780-
781-
runtimeArgs.add("-Djunit.platform.listeners.uid.tracking.output.dir=" + testIds);
782-
783773
testExtension.buildArgs("--features=org.graalvm.junit.platform.JUnitPlatformFeature");
784774
ConfigurableFileCollection classpath = testExtension.getClasspath();
785775
classpath.from(configs.getImageClasspathConfiguration());
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)