Skip to content

Commit 0967279

Browse files
nglevinluispadron
authored andcommitted
Remove some Starlark test script environment variables that we no longer have a need for.
These date back to Xcode 14's use of DER entitlements. We only support Xcode 16+ now, so these can go away. Cherry-pick: - 7af7f02 - cf78e20 - 043d9cd
1 parent ae83cd7 commit 0967279

5 files changed

Lines changed: 24 additions & 24 deletions

File tree

apple/internal/testing/apple_test_bundle_support.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ _TEST_BUNDLE_NAME_SUFFIX = ".__internal__.__test_bundle"
103103
# between the test bundle and test host, to avoid debugging issues and redundant build activity.
104104
_LOWEST_MINIMUM_OS_VERSION_FOR_TEST_MISMATCH_WARNING = "17.4"
105105

106+
_ERROR_ON_IOS_TEST_BUNDLE_MISMATCH_PACKAGE_PREFIXES = []
107+
106108
def _collect_files(rule_attr, attr_names):
107109
"""Collects files from given attr_names (when present) into a depset."""
108110
transitive_files = []
@@ -313,11 +315,16 @@ Please assign "{rule_attribute_name}" a value of {test_host_rule_attribute} on t
313315
test_host_label_name = test_host.label.name,
314316
)
315317

318+
test_label_package_name = label.package
319+
316320
# TODO(b/337080510): Apply this failure case to all Apple platforms.
317321
if platform_prerequisites.platform_type != "ios" or (
318322
apple_common.dotted_version(test_min_os) > apple_common.dotted_version(
319323
_LOWEST_MINIMUM_OS_VERSION_FOR_TEST_MISMATCH_WARNING,
320-
)
324+
) or any([
325+
test_label_package_name.startswith(package_prefix)
326+
for package_prefix in _ERROR_ON_IOS_TEST_BUNDLE_MISMATCH_PACKAGE_PREFIXES
327+
])
321328
):
322329
fail("\nERROR: " + test_attribute_min_os_mismatch_message)
323330

test/starlark_tests/common.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# their actions executed) when running `bazel test` to do analysis testing.
1919
_fixture_tags = [
2020
"manual",
21+
"nobuilder",
2122
"notap",
2223
]
2324

@@ -46,6 +47,7 @@ _min_os_ios = struct(
4647
_min_os_macos = struct(
4748
app_intents_support = "13.0",
4849
arm64_support = "11.0",
50+
concurrency_sleep_support = "10.15",
4951
baseline = "10.13",
5052
icon_bundle_required = "26.0",
5153
requires_concurrency_stdlib = "10.14",

test/starlark_tests/rules/apple_verification_test.bzl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,9 @@ def _apple_verification_test_impl(ctx):
225225
is_executable = True,
226226
)
227227

228-
# Apply knowledge of the Xcode version to the test environnment
229-
xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]
230-
xcode_version_split = str(xcode_config.xcode_version()).split(".")
231-
xcode_versions_separated = len(xcode_version_split)
232-
233228
# Extra test environment to set during the test.
234229
test_env = {
235230
"BUILD_TYPE": ctx.attr.build_type,
236-
"XCODE_VERSION_MAJOR": xcode_version_split[0] if xcode_versions_separated >= 1 else 0,
237-
"XCODE_VERSION_MINOR": xcode_version_split[1] if xcode_versions_separated >= 2 else 0,
238231
}
239232

240233
# Create APPLE_TEST_ENV_# environmental variables for each `env` attribute that are transformed
@@ -245,6 +238,8 @@ def _apple_verification_test_impl(ctx):
245238
for num, value in enumerate(ctx.attr.env[key]):
246239
test_env["APPLE_TEST_ENV_{}_{}".format(key, num)] = value
247240

241+
xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]
242+
248243
return [
249244
testing.ExecutionInfo(xcode_config.execution_info()),
250245
testing.TestEnvironment(dicts.add(

test/starlark_tests/verifier_scripts/app_clip_entitlements_verifier.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@ if [[ "$BUILD_TYPE" == "simulator" ]]; then
3030

3131
assert_contains "<key>$TEST_APP_CLIP_ENTITLEMENT_KEY</key>" "$TEMP_OUTPUT"
3232

33-
if [[ "$XCODE_VERSION_MAJOR" -ge "14" ]]; then
34-
# Then check the new DER encoded section.
35-
xcrun llvm-objdump --macho --section=__TEXT,__ents_der "$BINARY" | \
36-
sed -e 's/^[0-9a-f][0-9a-f]*[[:space:]][[:space:]]*//' \
37-
-e 'tx' -e 'd' -e ':x' | xxd -r -p > "$TEMP_DER_OUTPUT"
33+
# Then check the DER encoded section.
34+
xcrun llvm-objdump --macho --section=__TEXT,__ents_der "$BINARY" | \
35+
sed -e 's/^[0-9a-f][0-9a-f]*[[:space:]][[:space:]]*//' \
36+
-e 'tx' -e 'd' -e ':x' | xxd -r -p > "$TEMP_DER_OUTPUT"
3837

39-
assert_contains "$TEST_APP_CLIP_ENTITLEMENT_KEY" "$TEMP_DER_OUTPUT"
40-
fi
38+
assert_contains "$TEST_APP_CLIP_ENTITLEMENT_KEY" "$TEMP_DER_OUTPUT"
4139

4240
elif [[ "$BUILD_TYPE" == "device" ]]; then
4341
# First check the legacy xml plist section.
@@ -46,7 +44,7 @@ elif [[ "$BUILD_TYPE" == "device" ]]; then
4644

4745
assert_contains "<key>$TEST_APP_CLIP_ENTITLEMENT_KEY</key>" "$TEMP_OUTPUT"
4846

49-
# Then check the new DER encoded section.
47+
# Then check the DER encoded section.
5048
codesign --display --der --entitlements "$TEMP_DER_OUTPUT" "$BUNDLE_ROOT"
5149

5250
assert_contains "$TEST_APP_CLIP_ENTITLEMENT_KEY" "$TEMP_DER_OUTPUT"

test/starlark_tests/verifier_scripts/entitlements_verifier.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ if [[ "$BUILD_TYPE" == "simulator" ]]; then
3333

3434
assert_contains "<key>$TEST_ENTITLEMENT_KEY</key>" "$TEMP_OUTPUT"
3535

36-
if [[ "$XCODE_VERSION_MAJOR" -ge "14" ]]; then
37-
# Then check the new DER encoded section.
38-
xcrun llvm-objdump --macho --section=__TEXT,__ents_der "$BINARY" | \
39-
sed -e 's/^[0-9a-f][0-9a-f]*[[:space:]][[:space:]]*//' \
40-
-e 'tx' -e 'd' -e ':x' | xxd -r -p > "$TEMP_DER_OUTPUT"
41-
42-
assert_contains "$TEST_ENTITLEMENT_KEY" "$TEMP_DER_OUTPUT"
43-
fi
36+
# Then check the new DER encoded section.
37+
xcrun llvm-objdump --macho --section=__TEXT,__ents_der "$BINARY" | \
38+
sed -e 's/^[0-9a-f][0-9a-f]*[[:space:]][[:space:]]*//' \
39+
-e 'tx' -e 'd' -e ':x' | xxd -r -p > "$TEMP_DER_OUTPUT"
40+
41+
assert_contains "$TEST_ENTITLEMENT_KEY" "$TEMP_DER_OUTPUT"
4442

4543
elif [[ "$BUILD_TYPE" == "device" ]]; then
4644
# First check the legacy xml plist section.

0 commit comments

Comments
 (0)