Description of the bug:
Generating the undeclared outputs manifest can become noticeably slow when tests generate a large number of undeclared outputs.
XCResult files from xcodebuild contain hundreds, or even thousands, of files within them for large test bundles and can take over 10 seconds to traverse with the current implantation.
Our project has a unit test bundle that takes roughly 12 seconds for the tests to complete, but then another 10-12 seconds is consumed by generating the undeclared output manifest for the XCResult file it creates.
Which category does this issue belong to?
Performance
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create a sh_test target that writes 2,000 files.
#!/usr/bin/env bash
set -euo pipefail
for i in $(seq 1 2000); do
printf 'content %d\n' "$i" > "${TEST_UNDECLARED_OUTPUTS_DIR}/output_${i}.txt"
done
echo "Writing files finished"
Run the test with --test_output=streamed and observe the delay between "Writing files finished" being printed to the console and the test finishing.
Which operating system are you running Bazel on?
macOS 26.4.1
What is the output of bazel info release?
release 9.1.0
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse HEAD ?
https://github.com/bazelbuild/bazel.git
42b1f15e1063cffdf9711394bbf8020c0d72e24a
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
Description of the bug:
Generating the undeclared outputs manifest can become noticeably slow when tests generate a large number of undeclared outputs.
XCResult files from
xcodebuildcontain hundreds, or even thousands, of files within them for large test bundles and can take over 10 seconds to traverse with the current implantation.Our project has a unit test bundle that takes roughly 12 seconds for the tests to complete, but then another 10-12 seconds is consumed by generating the undeclared output manifest for the XCResult file it creates.
Which category does this issue belong to?
Performance
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create a
sh_testtarget that writes 2,000 files.Run the test with
--test_output=streamedand observe the delay between "Writing files finished" being printed to the console and the test finishing.Which operating system are you running Bazel on?
macOS 26.4.1
What is the output of
bazel info release?release 9.1.0
If
bazel info releasereturnsdevelopment versionor(@non-git), tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD?If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response