Repository navigation
feat: add cwm ws test and cwm ws test-result - #19
Merged
Merged
Conversation
…uild) Add diff-based testing that mirrors `cwm ws build`: - `cwm ws test [-w BRANCH] [--dry-run] [--no-rdeps]`: runs `colcon test` on the change set (changed packages + their ABI reverse deps). The activate path inherits the environment; `-w` sources underlay+overlay so an overlay worktree can be tested without a missing-`package.sh` failure. - `cwm ws test-result [-w BRANCH]`: runs `colcon test-result --all --return-code-on-test-failure` so agents/CI get a meaningful exit code (plain `colcon test` exits 0 even on test failures). Shared infrastructure: - Extract `resolve_worktree` and a `run_workspace_colcon` orchestration helper into `cwm/cli/_workspace.py`, used by both `ws build` and `ws test` so the scan/detect/dry-run/run flow lives in one place. - Add `ColconDiscoveryController.generate_test_args` (`--packages-select` only; test has no `--allow-overriding`/`--symlink-install`). - Add `run_colcon_test_result`; reuse the generic `run_colcon` / `run_colcon_sourced` (parameterised over the subcommand) for execution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds diff-based testing symmetric with
cwm ws build(roadmap R5, → v6.2.0).cwm ws test [-w BRANCH] [--dry-run] [--no-rdeps]— runscolcon teston the change set (changed packages + their ABI reverse deps). The activate path inherits the environment;-wsources underlay+overlay so an overlay worktree can be tested without a missing-package.shfailure.cwm ws test-result [-w BRANCH]— runscolcon test-result --all --return-code-on-test-failureso agents/CI get a meaningful exit code (plaincolcon testexits 0 even when tests fail).Motivation
Running
colcon testin an overlay worktree alone fails because the underlay isn't sourced (review §3.2), and the passthroughcwm testrequires activation and doesn't source the underlay.ws testresolves both by mirroringws build's sourcing behaviour.Decisions confirmed up front: test target = changed + ABI reverse deps (narrow with
--no-rdeps); failure detection kept as a separatews test-resultstep.Shared infrastructure
resolve_worktree+ arun_workspace_colconorchestration helper intocwm/cli/_workspace.py, used by bothws buildandws test, so the scan → detect → dry-run → run flow lives in one place.ColconDiscoveryController.generate_test_args(--packages-selectonly — test has no--allow-overriding/--symlink-install).run_colcon_test_result; execution reuses the genericrun_colcon/run_colcon_sourced(already parameterised over the subcommand).Test plan
uv run python -m pytest tests/→ all green (newtests/unit/test_test_cmd.pycovers dry-run, activate path,-wsourced path, no-changes,--no-rdeps, and test-result exit-code propagation;test_cdc.py/test_colcon_runner.py/test_cli_structure.pyupdated).cwm ws --helplistsbuild / test / test-result / clean / status.