summaryrefslogtreecommitdiff
path: root/ci/build_test_suites_test.py
diff options
context:
space:
mode:
author Luca Farsi <lucafarsi@google.com> 2024-08-06 13:35:28 -0700
committer Luca Farsi <lucafarsi@google.com> 2024-08-12 09:59:11 -0700
commit99d40d7554ae912f09673bd46aafa9c929e47eb7 (patch)
treed9f7ce390f52ca810e343e14f6bddef525ae434d /ci/build_test_suites_test.py
parent944fa4f8134dfd2bd11b939dfd62f18eadf811ab (diff)
Change artifact matching to be more strict
The current artifact matching logic will cause any test target that uses something like .*-tests.zip to be way too broad in what it causes to build. Change the logic to look for the target name in the artifact matching regex to make it so that only tests that look for a specific target to match. Test: atest build_test_suites_test Bug: 348489774 Change-Id: Ia75e38b676607f45f2b1c8fcf948045c248f1729
Diffstat (limited to 'ci/build_test_suites_test.py')
-rw-r--r--ci/build_test_suites_test.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/ci/build_test_suites_test.py b/ci/build_test_suites_test.py
index 25c072e2b0..463bdd0d73 100644
--- a/ci/build_test_suites_test.py
+++ b/ci/build_test_suites_test.py
@@ -380,6 +380,25 @@ class BuildPlannerTest(unittest.TestCase):
self.assertSetEqual(build_plan.build_targets, set())
+ def test_target_regex_matching_not_too_broad(self):
+ build_target = 'test_target'
+ test_context = self.get_test_context(build_target)
+ test_context['testInfos'][0]['extraOptions'] = [{
+ 'key': 'additional-files-filter',
+ 'values': [f'.*a{build_target}.*\.zip'],
+ }]
+ build_planner = self.create_build_planner(
+ build_targets={build_target},
+ build_context=self.create_build_context(
+ test_context=test_context,
+ enabled_build_features={'test_target_unused_exclusion'},
+ ),
+ )
+
+ build_plan = build_planner.create_build_plan()
+
+ self.assertSetEqual(build_plan.build_targets, set())
+
def create_build_planner(
self,
build_targets: set[str],