bazelbuild / bazelbuild/bazel-skylib

support accepting files in analysis_test.targets

Open
#116 0 comments 0 reactions 0 assignees View on GitHub
P4 type: feature request
Dominant language
Starlark
Stars
444
Forks
202
PR merge metrics
No merged PRs in 30d

Description

One may want to specify:

```
analysis_test(
name = "my_test",
targets = ["foo.o"],
```

But currently `targets` does not support files.
At first glance, this would seem easy to implement, using `attr.label_list.allow_files`, however, this approach poses a different problem: one can then specify a file that does not actually exist, and the analysis_test thus passes.
Thus, the above example test might fail if the rule generating `foo.o` fails, but the following would pass:

```
analysis_test(
name = "my_test",
targets = ["foo.o_oopsfatfinger"],
```

We'd need some way to ensure an input file actually exists to implement this feature.

Contributor guide

Open the contributing guide

Research direction

Start by locating the implementation of analysis_test and how its targets attribute is declared; the issue specifically mentions attr.label_list.allow_files. Investigate how the rule can distinguish an existing generated file from a misspelled target, and consider the examples in the issue as acceptance cases: valid files should be accepted while nonexistent files should fail.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.