Skip to content

Speculative: emit test XML from diff/cmp validate for Bazel 9#47

Closed
alexeagle wants to merge 1 commit into
mainfrom
bazel9-test-xml
Closed

Speculative: emit test XML from diff/cmp validate for Bazel 9#47
alexeagle wants to merge 1 commit into
mainfrom
bazel9-test-xml

Conversation

@alexeagle

@alexeagle alexeagle commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

This is speculative. It explores what it would take for diff.bzl to emit JUnit XML under Bazel 9 (bazelbuild/bazel#28111), where test runners must write $XML_OUTPUT_FILE themselves.

Scoped to the public API only (diff and cmp with validate=1), not internal build_test targets:

  • tools/test/emit-test-xml.sh — shared helper matching Bazel's generate-xml.sh contract
  • tools/test/run_with_xml.sh — generic wrapper for future test entrypoints
  • diff/private/validate.sh + validate.bzl — shared validation script used by diff and cmp that emits XML when $XML_OUTPUT_FILE is set

build_test is left on @bazel_skylib unchanged.

Caveat: If every test implementation across the ecosystem has to do this individually, that's an awful lot of work. This PR only covers the validate=1 path in the public diff/cmp rules. Note that validation actions are build-time assertions (OutputGroupInfo(_validation=...)), not bazel test actions — so $XML_OUTPUT_FILE is only emitted when that env var is present (e.g. if validations are ever run as test actions). Internal build_test targets will still fail to produce test.xml under figma/8.7.0-figma2.

Test plan

  • USE_BAZEL_VERSION=figma/8.7.0-figma2 bazel build //:validate in e2e/smoke — passes
  • bazel test //:smoke_test under figma Bazel — expected to fail (build_test doesn't write XML; out of scope)
  • //diff/tests:build_test — blocked on macOS by pre-existing GNU diff3 / BSD diff toolchain issue

Bazel 9 drops the flag that generates test XML in a follow-up spawn, so
test runners must write $XML_OUTPUT_FILE themselves. Add a shared helper
matching Bazel's generate-xml.sh and a build_test rule that emits XML.
@alexeagle

Copy link
Copy Markdown
Collaborator Author

OH I am dumb, the whole point here is validation actions, not tests. no xml

@alexeagle alexeagle closed this Jul 10, 2026
@alexeagle alexeagle changed the title Speculative: emit test XML from build_test for Bazel 9 Speculative: emit test XML from diff/cmp validate for Bazel 9 Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant