bazelbuild / bazelbuild/bazel-skylib

Feature Request: unittest - Support target_under_test with cfg="exec"

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

Description

I would like to write an analysis test for a rule that is intended to be used for build tool targets. I.e. targets that will be depended upon with `cfg = "exec"`. However, AFAICT, the current API exposed by `analysistest.make` does not allow to define the `target_under_test` as a dependency with `cfg = "exec"`.

Notably, it does support changed settings for the target. However, I'm not aware of a way achieve the same effect as `cfg = "exec"` through this mechanism. If there is one, please do let me know.

My current work around is to simply leave the `target_under_test` as the default `cfg = "target"`, and also set any other attributes that I may want to compare the `target_under_test` with as `cfg = "target"`.

Contributor guide

Open the contributing guide

Research direction

Start by locating the analysistest.make API and reading how it currently defines target_under_test and changed settings. Trace the existing analysis-test setup for configuration handling, then determine the smallest documented behavior needed for an exec-configured target_under_test. Done means analysis tests can compare a target under cfg = "exec" while preserving existing target-configuration behavior.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.