Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for adding back tests #2017

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions buildkite/bazelci.py
Original file line number Diff line number Diff line change
Expand Up @@ -2318,7 +2318,7 @@ def expand_test_target_patterns(bazel_binary, test_targets, test_flags):


def get_test_query(test_targets, test_flags):
included_targets, excluded_targets = partition_list(test_targets)
included_targets, excluded_targets, added_back = partition_list(test_targets)

def FormatTargetList(targets):
return " ".join("'{}'".format(t) for t in targets)
Expand All @@ -2328,6 +2328,9 @@ def FormatTargetList(targets):
if excluded_targets:
query += " except tests(set({}))".format(FormatTargetList(excluded_targets))

if added_back:
query += " union tests(set({}))".format(FormatTargetList(added_back))

included_tags, excluded_tags = get_test_tags(test_flags)

for t in excluded_tags:
Expand Down Expand Up @@ -2567,14 +2570,16 @@ def run_bazel_diff(bazel_diff_path, old_workspace_dir, new_workspace_dir, bazel_


def partition_list(items):
included, excluded = [], []
included, excluded, added_back = [], [], []
for i in items:
if i.startswith("-"):
excluded.append(i[1:])
elif i.startswith("+"):
added_back.append(i[1:])
else:
included.append(i)

return included, excluded
return included, excluded, added_back


def get_targets_for_shard(test_targets, shard_id, shard_count):
Expand Down