fix: Skip untargeted tests when --target is specified#23
Merged
haugoug merged 1 commit intogvsoc:mainfrom Mar 15, 2026
Merged
Conversation
337842b to
855422c
Compare
Two issues fixed: 1. When --target is specified, untargeted tests (from testsets without a targets section in gvtest.yaml) were still running. Now they are silently excluded at enqueue time by checking the _is_fallback flag on the target. 2. When multiple --target values are specified and they come from different gvtest.yaml files in different sub-directories, only targets from the first matching yaml were discovered. Root cause: import_testset() only fanned out to a sub-testset's targets if the parent's target matched the sub's targets. When targets come from different scopes (e.g. root has spatz, sub has pulp-open), the parent's spatz didn't match the sub's pulp-open, so the sub was skipped. Fix: sub-testsets with their own targets section always fan out independently of the parent's target. A _fanned_out set on the runner prevents duplication when multiple parent targets import the same sub-testset. Behavior: - gvtest --target X: runs only tests with target X - gvtest --target X --target Y: runs tests for both, even if X and Y come from different gvtest.yaml files - gvtest (no --target): runs everything Added 6 tests covering all target filtering scenarios.
855422c to
00355ac
Compare
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.
Problem
When
--target Xis specified on the CLI, tests without any target definition (notargets:in their gvtest.yaml) still run with the default target. This meansgvtest --target Xruns both targeted tests for X and all untargeted tests, which is not the expected behavior.Expected Behavior
gvtest --target X→ runs only tests belonging to target Xgvtest(no --target) → runs everything (targeted + untargeted)Fix
Two changes in the testset loading path:
Runner.add_testset(): When--targetis specified and the testset directory has no YAML targets, skip loading it entirely (instead of falling back to the default target).TestsetImpl.import_testset(): Same logic for sub-testsets — only inherit the parent target if either no--targetfilter was specified, or the parent already carries a real (non-default) target from higher up.Tests
Added 4 new tests:
test_cli_target_skips_untargeted_tests—--target Xskips testsets with no targetstest_no_cli_target_runs_all— no--targetruns untargeted teststest_cli_target_runs_only_matching—--target target_aruns only target_a, not target_btest_no_cli_target_runs_all_yaml_targets— no--targetruns all YAML targetsAll 140 tests pass.