Skip to content

Commit 0f7ab5f

Browse files
Remove the need for DEVELOPER_DIR in ios_xctestrun_runner (#2795)
This enables `bazel run`ing the tests. We still use `xcode-select -p` in the script. Signed-off-by: Brentley Jones <github@brentleyjones.com>
1 parent 2fff2ec commit 0f7ab5f

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

apple/testing/default_runner/ios_xctestrun_runner.template.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ if [[ -n "${TEST_PREMATURE_EXIT_FILE:-}" ]]; then
88
touch "$TEST_PREMATURE_EXIT_FILE"
99
fi
1010

11-
if [[ -z "${DEVELOPER_DIR:-}" ]]; then
12-
echo "error: Missing \$DEVELOPER_DIR" >&2
13-
exit 1
14-
fi
15-
1611
if [[ -n "${DEBUG_XCTESTRUNNER:-}" ]]; then
1712
set -x
1813
fi
@@ -177,12 +172,14 @@ xcrun_is_xctrunner_hosted_bundle="false"
177172
xcrun_is_ui_test_bundle="false"
178173
test_type="%(test_type)s"
179174
if [[ -n "$test_host_path" ]]; then
175+
developer_dir=$(xcode-select -p)
176+
180177
xctestrun_test_host_path="__TESTROOT__/$test_host_name.app"
181178
xctestrun_test_host_based=true
182179
# If this is set in the case there is no test host, some tests hang indefinitely
183180
xctestrun_env+="<key>XCInjectBundleInto</key><string>$(escape "__TESTHOST__/$test_host_name.app/$test_host_name")</string>"
184181

185-
developer_path="$(xcode-select -p)/Platforms/$test_execution_platform/Developer"
182+
developer_path="$developer_dir/Platforms/$test_execution_platform/Developer"
186183
libraries_path="$developer_path/Library"
187184

188185
# Added in Xcode 16.0
@@ -212,7 +209,7 @@ if [[ -n "$test_host_path" ]]; then
212209
# We need this dylib for 14.x OSes. This intentionally doesn't use `test_execution_platform`
213210
# since this file isn't present in the `iPhoneSimulator.platform`.
214211
# No longer necessary starting in Xcode 15 - hence the `-f` file existence check
215-
libswift_concurrency_path="$(xcode-select -p)/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/libswift_Concurrency.dylib"
212+
libswift_concurrency_path="$developer_dir/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/libswift_Concurrency.dylib"
216213
if [[ -f "$libswift_concurrency_path" ]]; then
217214
cp "$libswift_concurrency_path" "$plugins_path/$test_bundle_name.xctest/Frameworks/libswift_Concurrency.dylib"
218215
fi
@@ -532,7 +529,8 @@ if [[ "$should_use_xcodebuild" == true ]]; then
532529
xcodebuild test-without-building "${args[@]}" \
533530
2>&1 | tee -i "$testlog" || test_exit_code=$?
534531
else
535-
platform_developer_dir="$(xcode-select -p)/Platforms/$test_execution_platform/Developer"
532+
developer_dir=$(xcode-select -p)
533+
platform_developer_dir="$developer_dir/Platforms/$test_execution_platform/Developer"
536534
xctest_binary="$platform_developer_dir/Library/Xcode/Agents/xctest"
537535
test_file=$(file "$test_tmp_dir/$test_bundle_name.xctest/$test_bundle_name")
538536
if [[ "$intel_simulator_hack" == true ]]; then

0 commit comments

Comments
 (0)