Skip to content

Fix Gradle nativeTest test resource detection#929

Draft
jormundur00 wants to merge 1 commit into
graalvm:masterfrom
jormundur00:rhei-try/issue-537
Draft

Fix Gradle nativeTest test resource detection#929
jormundur00 wants to merge 1 commit into
graalvm:masterfrom
jormundur00:rhei-try/issue-537

Conversation

@jormundur00

Copy link
Copy Markdown
Member

Fixes #537

Spec Fit

Issue 537 reports that Gradle nativeTest omits resources from src/test/resources, even though ordinary JVM test sees them. Existing native-test specs already require the Gradle test binary to derive classes, resources, classpath, test identifiers, and JUnit support from the Gradle test source set/task, so no spec change was needed.

Relevant behavior is covered by gradle/FS-gradle-native-tests.1, gradle/FS-gradle-native-image-tasks.1, and root/FS-native-tests.2.

Implementation Summary

  • Enables resource autodetection by convention for the Gradle native test binary.
  • Excludes generated junit-platform-unique-ids.* discovery-list files from detected test resources.
  • Adds a focused functional regression that creates src/test/resources/db/mysql_conf_override, runs nativeTest without explicit resource configuration, and verifies the native test executable can load the resource.
  • Adds a changelog entry for the nativeTest resource fix.

Validation Evidence

Passed locally:

  • JAVA_HOME=/home/jovan/.sdkman/candidates/java/17.0.12-graal GRAALVM_HOME=/home/jovan/.sdkman/candidates/java/21.0.11-graal ./gradlew :native-gradle-plugin:functionalTest --tests "org.graalvm.buildtools.gradle.JavaApplicationWithResourcesFunctionalTest.native tests include test resources without explicit resource configuration"
  • JAVA_HOME=/home/jovan/.sdkman/candidates/java/17.0.12-graal GRAALVM_HOME=/home/jovan/.sdkman/candidates/java/17.0.12-graal ./gradlew :native-gradle-plugin:inspections
  • git diff --check

Not completed locally:

  • grund check is currently blocked before patch-specific citation validation by repository-wide stale grund init blocks in AGENTS files.
  • Full repository CI, ./gradlew build, and the full :native-gradle-plugin:functionalTest suite were not run locally.
  • The external Testcontainers/MySQL reproducer from the issue was not run; the in-repository regression covers the missing classpath-resource behavior directly.

Review Readiness

Draft PR. Agent review found no requirements, spec/grounding, implementation, or validation blockers. Remaining validation gaps are documented above.

Remaining Human Follow-up

  • Review the behavioral default change for Gradle native-test resource autodetection.
  • Run full CI or full Gradle functional coverage if desired before marking ready for review.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement. rhei

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test resources are ignored during "nativeTest"

1 participant