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

Migrate the rest of the Xcode tests from Bazel core (Java) to Starlark (except those that can't be migrated because they use experimental flags) #331

Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ bzl_library(
"//lib:xcode_support",
"//xcode:available_xcodes",
"//xcode:xcode_config",
"//xcode:xcode_config_alias",
"//xcode:xcode_version",
"@bazel_skylib//lib:unittest",
],
Expand Down
22 changes: 22 additions & 0 deletions test/test_helpers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

"""Common Starlark helpers used by apple_support tests."""

load("@bazel_skylib//lib:unittest.bzl", "analysistest")

visibility(["//test/..."])

# Common tags used for all test fixtures to ensure that they don't build unless
Expand All @@ -22,6 +24,26 @@ FIXTURE_TAGS = [
"manual",
]

def find_action(env, mnemonic):
"""Finds the first action with the given mnemonic in the target under test.

This generates an analysis test failure if no action was found.

Args:
env: The analysis test environment.
mnemonic: The mnemonic to find.

Returns:
The first action matching the mnemonic, or `None` if none was found.
"""
actions = analysistest.target_actions(env)
for action in actions:
if action.mnemonic == mnemonic:
return action

analysistest.fail(env, "No '{}' action found".format(mnemonic))
return None

def make_unique_namer(*, prefix, index):
"""Returns a function used to generate unique names in a package.

Expand Down
Loading