Skip to content

Commit

Permalink
Migrate the rest of the Xcode tests from Bazel core (Java) to Starlar…
Browse files Browse the repository at this point in the history
…k (except those that can't be migrated because they use experimental flags).

PiperOrigin-RevId: 630133992
(cherry picked from commit d5a60a6)
  • Loading branch information
allevato authored and brentleyjones committed May 31, 2024
1 parent 85792ef commit 288cfc0
Show file tree
Hide file tree
Showing 3 changed files with 1,732 additions and 52 deletions.
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

0 comments on commit 288cfc0

Please sign in to comment.