tools: fix unit test filter

The TestFilter.exclude and TestFilter.include methods won't mutate the
test filter. They return new test filter object instead. Therefore, the
old code leaves the unit test filter unmodified by mistake.

Test: ./tools/dev_container tools/presubmit crosvm_tests_mingw64 and see filter generated
Change-Id: Ib760665ead5b5fa7a141dc96426ce63b2645a808
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4881277
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Kaiyi Li <kaiyili@google.com>
This commit is contained in:
Kaiyi Li 2023-09-20 17:07:50 -07:00 committed by crosvm LUCI
parent aaeaffce4c
commit 3a846cdbc8

View file

@ -336,9 +336,7 @@ def main(
sys.exit(returncode)
if not no_unit_tests:
unit_test_filter = copy.deepcopy(test_filter)
unit_test_filter.include("kind(bench)")
unit_test_filter.exclude(*E2E_TESTS)
unit_test_filter = copy.deepcopy(test_filter).exclude(*E2E_TESTS).include("kind(bench)")
console.print()
console.rule("Running unit tests")
with record_time("Unit Tests"):