From 73c1c47f02913b9f92432df240abbf19258c190e Mon Sep 17 00:00:00 2001 From: Brentley Jones Date: Wed, 18 Oct 2023 10:32:40 -0500 Subject: [PATCH] Use canonical label string for some more analysis tests (#2306) Needed when Bzlmod becomes enabled in Bazel 7. Signed-off-by: Brentley Jones --- .../analysis_mismatched_platform_test.bzl | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/test/starlark_tests/rules/analysis_mismatched_platform_test.bzl b/test/starlark_tests/rules/analysis_mismatched_platform_test.bzl index 2d164de236..d4cb9b95f0 100644 --- a/test/starlark_tests/rules/analysis_mismatched_platform_test.bzl +++ b/test/starlark_tests/rules/analysis_mismatched_platform_test.bzl @@ -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( @@ -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( @@ -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")), + ], }, )