fix: Skip untargeted tests when --target is specified#23
Open
germainh512 wants to merge 1 commit intogvsoc:mainfrom
Open
fix: Skip untargeted tests when --target is specified#23germainh512 wants to merge 1 commit intogvsoc:mainfrom
germainh512 wants to merge 1 commit intogvsoc:mainfrom
Conversation
When --target X is given on the CLI, only tests that belong to a real target (defined in gvtest.yaml) should run. Tests without any target definition are silently excluded. The filtering happens at enqueue time in TestCommon.enqueue(): targets resolved from gvtest.yaml are real targets; the fallback target (used when no gvtest.yaml defines targets) is marked with _is_fallback=True and filtered out when --target is active. This approach ensures the full testset hierarchy is still loaded (so sub-testsets with their own targets are discovered), while untargeted tests at any level are excluded. New behavior: - gvtest --target X: runs only tests with target X from gvtest.yaml. Untargeted tests are silently excluded. - gvtest (no --target): runs everything. Added 5 tests covering target filtering behavior.
337842b to
855422c
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.