Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dependency pruning (unused_inputs_list) to tests #12504

Open
pauldraper opened this issue Nov 18, 2020 · 4 comments
Open

Add dependency pruning (unused_inputs_list) to tests #12504

pauldraper opened this issue Nov 18, 2020 · 4 comments
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: feature request

Comments

@pauldraper
Copy link
Contributor

pauldraper commented Nov 18, 2020

Description of the problem / feature request:

Allow tests to be dependency pruned, for better caching.

Feature requests: what underlying problem are you trying to solve with this feature?

unused_input_list in actions addresses the problem of over-declared inputs. https://docs.bazel.build/versions/1.2.0/skylark/lib/actions.html#run

Tests have this same problem. Testing performance could be improved if unused inputs could be listed.

A number of testing frameworks have this feature (JS and Go).

Workaround

One workaround to achieve this is to convert tests into actions with unused_input_list, and use bazel build to "test." But this gives up a lot of the ergonomics around bazel test.

@brandjon brandjon added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Build-Language and removed team-Starlark untriaged labels Feb 19, 2021
@brandjon brandjon added untriaged team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts and removed team-Build-Language labels Nov 4, 2022
@comius comius removed the untriaged label Aug 22, 2023
@comius
Copy link
Contributor

comius commented Aug 22, 2023

cc @lberki

@lberki
Copy link
Contributor

lberki commented Aug 23, 2023

I think it's a reasonable addition, although I haven't gamed out all the possible implications in my head.

@fmeum
Copy link
Collaborator

fmeum commented Mar 22, 2024

I found some references to such a feature in the code (https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/buildeventstream/TestFileNameConstants.java;l=37;drc=38117d4072df3c8d76591b39e36167b9fde66662). Is this available with the Google-internal test runner implementation?

@lberki
Copy link
Contributor

lberki commented Mar 27, 2024

No, it's not that (if we had this feature internally, we'd just open source it!)

It's a way to automatically detect which input files of a test were unused (IIRC by looking at atimes) to facilitate dependency pruning in BUILD files. It doesn't change what Blaze considers the action graph, it's only for diagnostics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-API API for writing rules/aspects: providers, runfiles, actions, artifacts type: feature request
Projects
None yet
Development

No branches or pull requests

6 participants