bazelbuild / bazelbuild/bazel-skylib
analysistest should provide convenience functions for comparing action command-lines
- Dominant language
- Starlark
- Stars
- 444
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
Writing assertions on the command lines of actions of the target under test is complicated for a few reasons:
* Not all actions have argv, you want to pull out just the ones created with `ctx.actions.run` and `ctx.actions.run_shell`.
* Not all actions may be generated by the code under test (for example, you might not care about the exact command-lines of actions generated by `cc_common.compile/link), so you might want to pull out just the actions with a specific mnemonic, or with mnemonics that begin with a specific prefix.
* `Action.argv` contains paths that are long. It would be nice if there was an easy way of abbreviating the bin dir path of the target under test, the relative path to the package of the target under test, and the path to the shell binary (for `run_shell`) so that the expected values for assertions could abbreviate those as well (e.g. a function that takes argv and replaces those with "bin", "package", and "sh", respectively).
Contributor guide
Research direction
Start by reading the analysistest API and the Action.argv behavior described here, then inspect how ctx.actions.run and ctx.actions.run_shell actions and mnemonics are exposed. No files or tests are named; done means comparisons can select relevant actions and abbreviate the target and shell paths in expected command lines.
Written by the indexing model from the issue text.
Assessment
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100