Skip to content

Commit

Permalink
Use canonical label string for some more analysis tests (#2306)
Browse files Browse the repository at this point in the history
Needed when Bzlmod becomes enabled in Bazel 7.

Signed-off-by: Brentley Jones <[email protected]>
  • Loading branch information
brentleyjones authored Oct 18, 2023
1 parent d17e534 commit 73c1c47
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions test/starlark_tests/rules/analysis_mismatched_platform_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ load(

def _analysis_incoming_watchos_platform_mismatch_test_impl(ctx):
env = analysistest.begin(ctx)
asserts.expect_failure(env, """
asserts.expect_failure(
env,
"""
ERROR: Unexpected resolved platform:
Expected Apple platform type of \"{0}\", but that was not found in @build_bazel_apple_support//platforms:watchos_x86_64.
""".format(ctx.attr.expected_platform_type))
Expected Apple platform type of \"{expected}\", but that was not found in {platform}.
""".format(
expected = ctx.attr.expected_platform_type,
platform = Label("@build_bazel_apple_support//platforms:watchos_x86_64"),
),
)
return analysistest.end(env)

analysis_incoming_watchos_platform_mismatch_test = analysistest.make(
Expand All @@ -41,16 +47,24 @@ analysis_incoming_watchos_platform_mismatch_test = analysistest.make(
},
config_settings = {
"//command_line_option:incompatible_enable_apple_toolchain_resolution": True,
"//command_line_option:platforms": ["@build_bazel_apple_support//platforms:watchos_x86_64"],
"//command_line_option:platforms": [
str(Label("@build_bazel_apple_support//platforms:watchos_x86_64")),
],
},
)

def _analysis_incoming_ios_platform_mismatch_test_impl(ctx):
env = analysistest.begin(ctx)
asserts.expect_failure(env, """
asserts.expect_failure(
env,
"""
ERROR: Unexpected resolved platform:
Expected Apple platform type of \"{0}\", but that was not found in @build_bazel_apple_support//platforms:ios_sim_arm64.
""".format(ctx.attr.expected_platform_type))
Expected Apple platform type of \"{expected}\", but that was not found in {platform}.
""".format(
expected = ctx.attr.expected_platform_type,
platform = Label("@build_bazel_apple_support//platforms:ios_sim_arm64"),
),
)
return analysistest.end(env)

analysis_incoming_ios_platform_mismatch_test = analysistest.make(
Expand All @@ -64,6 +78,8 @@ analysis_incoming_ios_platform_mismatch_test = analysistest.make(
},
config_settings = {
"//command_line_option:incompatible_enable_apple_toolchain_resolution": True,
"//command_line_option:platforms": ["@build_bazel_apple_support//platforms:ios_sim_arm64"],
"//command_line_option:platforms": [
str(Label("@build_bazel_apple_support//platforms:ios_sim_arm64")),
],
},
)

0 comments on commit 73c1c47

Please sign in to comment.