xcode.sh (24697B)
1 #!/bin/bash 2 set -euo pipefail 3 4 for variable in XCODE_DERIVED_DATA XCODE_SOURCE_PACKAGES XCODE_PACKAGE_CACHE; do 5 if [[ -z "${!variable:-}" ]]; then 6 echo "error: $variable is required; run this command through cargo extbuild" >&2 7 exit 1 8 fi 9 done 10 11 output_args=( 12 -quiet 13 -derivedDataPath "$XCODE_DERIVED_DATA" 14 -clonedSourcePackagesDirPath "$XCODE_SOURCE_PACKAGES" 15 -packageCachePath "$XCODE_PACKAGE_CACHE" 16 ) 17 offline_args=( 18 -disableAutomaticPackageResolution 19 -onlyUsePackageVersionsFromResolvedFile 20 -skipPackagePluginValidation 21 ) 22 23 physical_child_pid= 24 physical_child_ready=0 25 physical_pending_signal= 26 27 physical_deliver_pending_signal() { 28 if [[ "$physical_child_ready" == 1 && -n "$physical_child_pid" && -n "$physical_pending_signal" ]]; then 29 kill -s "$physical_pending_signal" "$physical_child_pid" 2>/dev/null || true 30 physical_pending_signal= 31 fi 32 } 33 34 physical_forward_signal() { 35 physical_pending_signal=$1 36 physical_deliver_pending_signal 37 } 38 39 physical_wait_for_child() { 40 local status 41 while true; do 42 if wait "$physical_child_pid"; then status=0; else status=$?; fi 43 if ! kill -0 "$physical_child_pid" 2>/dev/null; then 44 # A trap can interrupt wait as the child settles. Read its retained 45 # real status rather than returning the trap's 128+signal status. 46 if wait "$physical_child_pid"; then status=0; else status=$?; fi 47 physical_child_pid= 48 return "$status" 49 fi 50 done 51 } 52 53 physical_cleanup() { 54 local status=$? 55 trap - EXIT 56 if [[ -n "$physical_child_pid" ]]; then 57 if physical_wait_for_child; then status=0; else status=$?; fi 58 fi 59 unlink "$lock_state_file" 2>/dev/null || true 60 return "$status" 61 } 62 63 physical_own_lock() { 64 trap 'physical_forward_signal INT' INT 65 trap 'physical_forward_signal TERM' TERM 66 trap 'physical_child_ready=1; physical_deliver_pending_signal' USR1 67 lock_state_file=$(mktemp "${TMPDIR:-/tmp}/tera-ios-lock-state.XXXXXX") 68 trap 'physical_cleanup' EXIT 69 } 70 71 supervise_physical_xcode_child() { 72 local repo_root python_executable status 73 repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) 74 if python_executable=$(uv run --project "$repo_root/scripts/persona-verifier" --offline --frozen \ 75 python -c 'import sys; print(sys.executable)'); then 76 : 77 else 78 status=$? 79 return "$status" 80 fi 81 if [[ -n "$physical_pending_signal" ]]; then 82 case "$physical_pending_signal" in INT) return 130 ;; TERM) return 143 ;; esac 83 fi 84 if [[ "$python_executable" != /* || ! -x "$python_executable" ]]; then 85 echo "error: locked physical-wrapper interpreter is unavailable" >&2 86 return 126 87 fi 88 "$python_executable" "$repo_root/scripts/xcode_child.py" "$@" & 89 physical_child_pid=$! 90 physical_deliver_pending_signal 91 physical_wait_for_child 92 } 93 94 operation=${1:-} 95 case "$operation" in 96 resolve) 97 exec xcodebuild \ 98 -resolvePackageDependencies \ 99 -project Tera.xcodeproj \ 100 -scheme Tera \ 101 "${output_args[@]}" 102 ;; 103 package-build) 104 exec xcodebuild \ 105 -scheme TeraApp \ 106 -destination 'generic/platform=iOS Simulator' \ 107 "${output_args[@]}" \ 108 "${offline_args[@]}" \ 109 ARCHS=arm64 \ 110 build 111 ;; 112 package-test) 113 destination=${2:?package-test requires a simulator destination} 114 exec xcodebuild \ 115 -scheme TeraAppPublicAPITests \ 116 -destination "$destination" \ 117 "${output_args[@]}" \ 118 "${offline_args[@]}" \ 119 test 120 ;; 121 project-build) 122 configuration=${2:?project-build requires a configuration} 123 case "$configuration" in 124 Debug|Release) ;; 125 *) echo "error: unsupported configuration: $configuration" >&2; exit 1 ;; 126 esac 127 exec xcodebuild \ 128 -project Tera.xcodeproj \ 129 -scheme Tera \ 130 -configuration "$configuration" \ 131 -destination 'generic/platform=iOS Simulator' \ 132 "${output_args[@]}" \ 133 "${offline_args[@]}" \ 134 build 135 ;; 136 project-test) 137 if [[ $# -lt 3 || $# -gt 4 ]]; then 138 echo "error: project-test requires destination, target and optional UI selector" >&2 139 exit 64 140 fi 141 destination=${2:?project-test requires a simulator destination} 142 test_target=${3:?project-test requires a test target} 143 case "$test_target" in 144 TeraTests|TeraUITests) ;; 145 *) echo "error: unsupported test target: $test_target" >&2; exit 1 ;; 146 esac 147 selector=${4:-} 148 selected_target=$test_target 149 if [[ -n "$selector" ]]; then 150 if [[ "$test_target" != TeraUITests || ! "$selector" =~ ^([A-Za-z][A-Za-z0-9]*UITests)(/(test[A-Za-z0-9]+))?$ ]]; then 151 echo "error: unsupported UI test selector" >&2 152 exit 64 153 fi 154 test_class=${BASH_REMATCH[1]} 155 test_method=${BASH_REMATCH[3]:-} 156 repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) 157 test_source="$repo_root/TeraUITests/$test_class.swift" 158 if [[ ! -f "$test_source" ]] || ! grep -Eq "^final class $test_class: XCTestCase" "$test_source"; then 159 echo "error: UI test class is not an owned test source" >&2 160 exit 64 161 fi 162 if [[ -n "$test_method" ]] && ! grep -Eq "^[[:space:]]+func $test_method\(\)" "$test_source"; then 163 echo "error: UI test method is not an owned test source" >&2 164 exit 64 165 fi 166 selected_target="$test_target/$selector" 167 fi 168 exec xcodebuild \ 169 -project Tera.xcodeproj \ 170 -scheme Tera \ 171 -destination "$destination" \ 172 "${output_args[@]}" \ 173 "${offline_args[@]}" \ 174 "-only-testing:$selected_target" \ 175 test 176 ;; 177 physical-app-build) 178 destination=${2:?physical app build requires a device destination} 179 xcconfig=${3:?physical app build requires an xcconfig} 180 physical_automation=${TERA_IOS_PHYSICAL_AUTOMATION:-} 181 development_team=${TERA_IOS_DEVELOPMENT_TEAM:?TERA_IOS_DEVELOPMENT_TEAM is required} 182 if [[ "$physical_automation" != "1" ]]; then 183 echo "error: physical app build requires TERA_IOS_PHYSICAL_AUTOMATION=1" >&2 184 exit 64 185 fi 186 if [[ ! "$destination" =~ ^id=[A-Fa-f0-9-]+$ ]]; then 187 echo "error: physical app build destination must be one exact device id" >&2 188 exit 64 189 fi 190 if [[ ! "$development_team" =~ ^[A-Z0-9]{10}$ ]]; then 191 echo "error: physical app build development team is invalid" >&2 192 exit 64 193 fi 194 if [[ "$xcconfig" != "$XCODE_DERIVED_DATA"/* || ! -f "$xcconfig" ]]; then 195 echo "error: physical app build xcconfig must be a regular file under XCODE_DERIVED_DATA" >&2 196 exit 64 197 fi 198 device_id=${destination#id=} 199 physical_own_lock 200 if ! xcrun devicectl device info lockState \ 201 --device "$device_id" \ 202 --quiet \ 203 --timeout 10 \ 204 --json-output "$lock_state_file" 205 then 206 echo "error: physical app build device lock state is unavailable" >&2 207 exit 1 208 fi 209 passcode_required=$(/usr/bin/plutil \ 210 -extract result.passcodeRequired raw -o - "$lock_state_file") 211 unlocked_since_boot=$(/usr/bin/plutil \ 212 -extract result.unlockedSinceBoot raw -o - "$lock_state_file") 213 if [[ "$passcode_required" != "false" || "$unlocked_since_boot" != "true" ]]; then 214 echo "error: physical app build device is locked; refusing to invoke Xcode" >&2 215 exit 1 216 fi 217 supervise_physical_xcode_child xcodebuild \ 218 -project Tera.xcodeproj \ 219 -scheme Tera \ 220 -configuration Debug \ 221 -destination "$destination" \ 222 -xcconfig "$xcconfig" \ 223 "${output_args[@]}" \ 224 "${offline_args[@]}" \ 225 "DEVELOPMENT_TEAM=$development_team" \ 226 CODE_SIGN_STYLE=Automatic \ 227 "CODE_SIGN_IDENTITY=Apple Development" \ 228 build 229 ;; 230 local-social-ui-test) 231 destination=${2:?local-social-ui-test requires a simulator destination} 232 result_name=${3:?local-social-ui-test requires a result name} 233 scenario=${4:-five-flow} 234 qualification_run_id=${TERA_IOS_UI_TEST_RUN_ID:?TERA_IOS_UI_TEST_RUN_ID is required} 235 relay_port=${TERA_IOS_LOCAL_SOCIAL_RELAY_PORT:-21000} 236 blossom_port=${TERA_IOS_LOCAL_SOCIAL_BLOSSOM_PORT:-21100} 237 if [[ ! "$destination" =~ ^platform=iOS\ Simulator,id=[A-Fa-f0-9-]+$ ]]; then 238 echo "error: local-social-ui-test destination must be one exact simulator id" >&2 239 exit 64 240 fi 241 if [[ ! "$result_name" =~ ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$ ]]; then 242 echo "error: local-social-ui-test result name is invalid" >&2 243 exit 64 244 fi 245 if [[ ! "$qualification_run_id" =~ ^[a-z0-9][a-z0-9-]{6,62}[a-z0-9]$ ]]; then 246 echo "error: local-social-ui-test run id is invalid" >&2 247 exit 64 248 fi 249 for port in "$relay_port" "$blossom_port"; do 250 if [[ ! "$port" =~ ^[0-9]+$ ]] || ((port < 1024 || port > 65535)); then 251 echo "error: local-social-ui-test port is invalid" >&2 252 exit 64 253 fi 254 done 255 if [[ "$relay_port" == "$blossom_port" ]]; then 256 echo "error: local-social-ui-test ports must be distinct" >&2 257 exit 64 258 fi 259 case "$scenario" in 260 five-flow) 261 test_selector=TeraUITests/TeraRemoteQualificationUITests/testLocalSocialFiveFlowScenario 262 evidence_command=verify 263 simulator_id=${destination##*id=} 264 previous_content_size= 265 requested_content_size=large 266 ;; 267 accessibility) 268 test_selector=TeraUITests/TeraRemoteQualificationUITests/testLocalSocialAccessibilitySemantics 269 evidence_command=verify-accessibility 270 simulator_id=${destination##*id=} 271 previous_content_size= 272 requested_content_size=accessibility-extra-extra-extra-large 273 persona_fixture= 274 persona_result= 275 ;; 276 persona) 277 test_selector=TeraUITests/TeraRemoteQualificationUITests/testLocalSocialDeterministicPersonas 278 evidence_command=verify-persona 279 simulator_id=${destination##*id=} 280 previous_content_size= 281 requested_content_size=accessibility-extra-extra-extra-large 282 persona_fixture=test-fixtures/local-social-personas.v1.json 283 persona_result="$XCODE_RESULTS/$result_name.persona-result.json" 284 ;; 285 *) 286 echo "error: unsupported local-social-ui-test scenario: $scenario" >&2 287 exit 64 288 ;; 289 esac 290 : "${XCODE_RESULTS:?XCODE_RESULTS is required}" 291 mkdir -p "$XCODE_RESULTS" 292 result_bundle="$XCODE_RESULTS/$result_name.xcresult" 293 evidence="$XCODE_RESULTS/$result_name.fixture.json" 294 ready="$XCODE_RESULTS/$result_name.ready.json" 295 control="$XCODE_RESULTS/$result_name.enable-uploads" 296 if [[ -e "$result_bundle" || -e "$evidence" || -e "$ready" || -e "$control" || ( -n "${persona_result:-}" && -e "$persona_result" ) ]]; then 297 echo "error: local-social-ui-test result already exists: $result_name" >&2 298 exit 1 299 fi 300 if [[ "$scenario" == persona ]]; then 301 if [[ -n "$(git status --porcelain --untracked-files=all)" ]]; then 302 echo "error: persona qualification requires one clean exact source tree" >&2 303 exit 1 304 fi 305 source_commit=$(git rev-parse HEAD) 306 source_tree=$(git rev-parse 'HEAD^{tree}') 307 upstream=$(git rev-parse '@{upstream}') 308 xcode_identity=$(xcodebuild -version | tr '\n' ' ') 309 simulator_sdk_build=$(xcrun --sdk iphonesimulator --show-sdk-build-version) 310 app_build_sha256=$( 311 printf 'radroots.ios.local-social.app-build.v1\0%s\0%s\0%s\0%s\0%s\0%s\0%s\0' \ 312 "$source_commit" "$source_tree" TeraUITests test Debug \ 313 "$xcode_identity" "$simulator_sdk_build" \ 314 | shasum -a 256 | awk '{print $1}' 315 ) 316 persona_repair_commit=${TERA_IOS_UI_TEST_FORWARD_REPAIR_COMMIT:-} 317 if [[ "$source_commit" != "$upstream" ]]; then 318 echo "error: persona qualification source is not equal to its configured upstream" >&2 319 exit 1 320 fi 321 if [[ -n "$persona_repair_commit" ]]; then 322 if [[ ! "$persona_repair_commit" =~ ^[0-9a-f]{40}$ ]] || \ 323 ! git merge-base --is-ancestor "$persona_repair_commit" "$source_commit" 324 then 325 echo "error: persona forward-repair commit is invalid" >&2 326 exit 1 327 fi 328 fi 329 sh scripts/persona-verifier.sh verify-persona-fixture \ 330 --fixture "$persona_fixture" \ 331 --fixture-schema test-fixtures/local-social-personas.v1.schema.json \ 332 --result-schema test-fixtures/local-social-persona-results.v1.schema.json \ 333 --attempt-schema test-fixtures/local-social-persona-attempt-evidence.v1.schema.json \ 334 --result-v2-schema test-fixtures/local-social-persona-results.v2.schema.json 335 sh scripts/persona-verifier.sh serve \ 336 --relay-port "$relay_port" \ 337 --blossom-port "$blossom_port" \ 338 --evidence "$evidence" \ 339 --ready "$ready" \ 340 --control "$control" \ 341 --persona-fixture "$persona_fixture" & 342 else 343 sh scripts/persona-verifier.sh serve \ 344 --relay-port "$relay_port" \ 345 --blossom-port "$blossom_port" \ 346 --evidence "$evidence" \ 347 --ready "$ready" \ 348 --control "$control" & 349 fi 350 fixture_pid=$! 351 cleanup_fixture() { 352 kill "$fixture_pid" 2>/dev/null || true 353 wait "$fixture_pid" 2>/dev/null || true 354 if [[ -n "$previous_content_size" ]]; then 355 xcrun simctl ui "$simulator_id" content_size "$previous_content_size" 356 previous_content_size= 357 fi 358 } 359 trap cleanup_fixture EXIT INT TERM 360 for _ in {1..100}; do 361 [[ -f "$ready" ]] && break 362 kill -0 "$fixture_pid" 2>/dev/null || { 363 echo "error: local-social fixture exited before readiness" >&2 364 exit 1 365 } 366 sleep 0.1 367 done 368 if [[ ! -f "$ready" ]]; then 369 echo "error: local-social fixture readiness timed out" >&2 370 exit 1 371 fi 372 xcrun simctl boot "$simulator_id" >/dev/null 2>&1 || true 373 xcrun simctl bootstatus "$simulator_id" -b >/dev/null 374 previous_content_size=$(xcrun simctl ui "$simulator_id" content_size) 375 case "$previous_content_size" in 376 extra-small|small|medium|large|extra-large|extra-extra-large|extra-extra-extra-large|accessibility-medium|accessibility-large|accessibility-extra-large|accessibility-extra-extra-large|accessibility-extra-extra-extra-large) ;; 377 *) 378 echo "error: simulator content-size state is unavailable" >&2 379 exit 1 380 ;; 381 esac 382 xcrun simctl ui "$simulator_id" content_size "$requested_content_size" 383 set +e 384 xcodebuild \ 385 -project Tera.xcodeproj \ 386 -scheme Tera \ 387 -configuration Debug \ 388 -destination "$destination" \ 389 "${output_args[@]}" \ 390 "${offline_args[@]}" \ 391 -resultBundlePath "$result_bundle" \ 392 "-only-testing:$test_selector" \ 393 "TERA_IOS_UI_TEST_RUN_ID=$qualification_run_id" \ 394 "TERA_IOS_UI_TEST_NOSTR_RELAY_URLS=ws://127.0.0.1:$relay_port" \ 395 "TERA_IOS_UI_TEST_BLOSSOM_ORIGINS=http://127.0.0.1:$blossom_port" \ 396 "TERA_IOS_UI_TEST_FIXTURE_CONTROL=$control" \ 397 "TERA_IOS_UI_TEST_FIXTURE_EVIDENCE=$evidence" \ 398 "TERA_IOS_UI_TEST_NETWORK_PROFILE=simulator" \ 399 "TERA_IOS_UI_TEST_SOURCE_COMMIT=${source_commit:-}" \ 400 "TERA_IOS_UI_TEST_SOURCE_TREE=${source_tree:-}" \ 401 "TERA_IOS_UI_TEST_APP_BUILD_SHA256=${app_build_sha256:-}" \ 402 "TERA_IOS_UI_TEST_SIMULATOR_ID=$simulator_id" \ 403 test 404 test_status=$? 405 set -e 406 cleanup_fixture 407 trap - EXIT INT TERM 408 if ((test_status != 0)); then 409 exit "$test_status" 410 fi 411 if [[ "$scenario" == persona ]]; then 412 persona_result_command=(sh scripts/persona-verifier.sh "$evidence_command" \ 413 --fixture "$persona_fixture" \ 414 --fixture-schema test-fixtures/local-social-personas.v1.schema.json \ 415 --result-schema test-fixtures/local-social-persona-results.v1.schema.json \ 416 --attempt-schema test-fixtures/local-social-persona-attempt-evidence.v1.schema.json \ 417 --result-v2-schema test-fixtures/local-social-persona-results.v2.schema.json \ 418 --evidence "$evidence" \ 419 --result-bundle "$result_bundle" \ 420 --output "$persona_result" \ 421 --source-commit "$source_commit" \ 422 --source-tree "$source_tree" \ 423 --run-id "$qualification_run_id" \ 424 --simulator-id "$simulator_id") 425 if [[ -n "$persona_repair_commit" ]]; then 426 persona_result_command+=(--forward-repair-commit "$persona_repair_commit") 427 fi 428 "${persona_result_command[@]}" 429 else 430 sh scripts/persona-verifier.sh "$evidence_command" --evidence "$evidence" 431 fi 432 ;; 433 remote-ui-test) 434 destination=${2:?remote-ui-test requires a simulator destination} 435 test_selector=${3:?remote-ui-test requires a TeraUITests selector} 436 result_name=${4:?remote-ui-test requires a result name} 437 qualification_run_id=${TERA_IOS_UI_TEST_RUN_ID:?TERA_IOS_UI_TEST_RUN_ID is required} 438 blossom_origins=${TERA_IOS_UI_TEST_BLOSSOM_ORIGINS:?TERA_IOS_UI_TEST_BLOSSOM_ORIGINS is required} 439 relay_urls=${TERA_IOS_UI_TEST_NOSTR_RELAY_URLS:-} 440 if [[ ! "$destination" =~ ^platform=iOS\ Simulator,id=[A-Fa-f0-9-]+$ ]]; then 441 echo "error: remote-ui-test destination must be one exact simulator id" >&2 442 exit 64 443 fi 444 if [[ ! "$test_selector" =~ ^TeraUITests(/[-A-Za-z0-9_]+){0,2}$ ]]; then 445 echo "error: remote-ui-test selector is invalid" >&2 446 exit 64 447 fi 448 if [[ ! "$result_name" =~ ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$ ]]; then 449 echo "error: remote-ui-test result name is invalid" >&2 450 exit 64 451 fi 452 if [[ ! "$qualification_run_id" =~ ^[a-z0-9][a-z0-9-]{6,62}[a-z0-9]$ ]]; then 453 echo "error: remote-ui-test run id is invalid" >&2 454 exit 64 455 fi 456 result_bundle="$XCODE_RESULTS/$result_name.xcresult" 457 if [[ -e "$result_bundle" ]]; then 458 echo "error: remote-ui-test result already exists: $result_bundle" >&2 459 exit 1 460 fi 461 mkdir -p "$XCODE_RESULTS" 462 exec xcodebuild \ 463 -project Tera.xcodeproj \ 464 -scheme Tera \ 465 -configuration Debug \ 466 -destination "$destination" \ 467 "${output_args[@]}" \ 468 "${offline_args[@]}" \ 469 -resultBundlePath "$result_bundle" \ 470 "-only-testing:$test_selector" \ 471 "TERA_IOS_UI_TEST_RUN_ID=$qualification_run_id" \ 472 "TERA_IOS_UI_TEST_NOSTR_RELAY_URLS=$relay_urls" \ 473 "TERA_IOS_UI_TEST_BLOSSOM_ORIGINS=$blossom_origins" \ 474 "TERA_IOS_UI_TEST_NETWORK_PROFILE=public" \ 475 test 476 ;; 477 physical-ui-build|physical-ui-test) 478 destination=${2:?physical UI qualification requires a device destination} 479 test_selector=${3:?physical UI qualification requires a TeraUITests selector} 480 result_name=${4:-} 481 physical_automation=${TERA_IOS_UI_TEST_PHYSICAL_AUTOMATION:-} 482 development_team=${TERA_IOS_DEVELOPMENT_TEAM:?TERA_IOS_DEVELOPMENT_TEAM is required} 483 qualification_run_id=${TERA_IOS_UI_TEST_RUN_ID:?TERA_IOS_UI_TEST_RUN_ID is required} 484 blossom_origins=${TERA_IOS_UI_TEST_BLOSSOM_ORIGINS:?TERA_IOS_UI_TEST_BLOSSOM_ORIGINS is required} 485 relay_urls=${TERA_IOS_UI_TEST_NOSTR_RELAY_URLS:-} 486 if [[ "$physical_automation" != "1" ]]; then 487 echo "error: physical UI qualification requires TERA_IOS_UI_TEST_PHYSICAL_AUTOMATION=1" >&2 488 exit 64 489 fi 490 if [[ ! "$destination" =~ ^id=[A-Fa-f0-9-]+$ ]]; then 491 echo "error: physical-ui-test destination must be one exact device id" >&2 492 exit 64 493 fi 494 if [[ ! "$test_selector" =~ ^TeraUITests(/[-A-Za-z0-9_]+){0,2}$ ]]; then 495 echo "error: physical-ui-test selector is invalid" >&2 496 exit 64 497 fi 498 if [[ ! "$development_team" =~ ^[A-Z0-9]{10}$ ]]; then 499 echo "error: physical-ui-test development team is invalid" >&2 500 exit 64 501 fi 502 if [[ ! "$qualification_run_id" =~ ^[a-z0-9][a-z0-9-]{6,62}[a-z0-9]$ ]]; then 503 echo "error: physical-ui-test run id is invalid" >&2 504 exit 64 505 fi 506 device_id=${destination#id=} 507 physical_own_lock 508 if ! xcrun devicectl device info lockState \ 509 --device "$device_id" \ 510 --quiet \ 511 --timeout 10 \ 512 --json-output "$lock_state_file" 513 then 514 echo "error: physical UI qualification device lock state is unavailable" >&2 515 exit 1 516 fi 517 passcode_required=$(/usr/bin/plutil \ 518 -extract result.passcodeRequired raw -o - "$lock_state_file") 519 unlocked_since_boot=$(/usr/bin/plutil \ 520 -extract result.unlockedSinceBoot raw -o - "$lock_state_file") 521 if [[ "$passcode_required" != "false" || "$unlocked_since_boot" != "true" ]]; then 522 echo "error: physical UI qualification device is locked; refusing to invoke Xcode" >&2 523 exit 1 524 fi 525 physical_args=( 526 -project Tera.xcodeproj \ 527 -scheme Tera \ 528 -configuration Debug \ 529 -destination "$destination" \ 530 "${output_args[@]}" \ 531 "${offline_args[@]}" \ 532 "-only-testing:$test_selector" \ 533 "DEVELOPMENT_TEAM=$development_team" \ 534 CODE_SIGN_STYLE=Automatic \ 535 "CODE_SIGN_IDENTITY=Apple Development" \ 536 "TERA_IOS_UI_TEST_RUN_ID=$qualification_run_id" \ 537 "TERA_IOS_UI_TEST_NOSTR_RELAY_URLS=$relay_urls" \ 538 "TERA_IOS_UI_TEST_BLOSSOM_ORIGINS=$blossom_origins" \ 539 "TERA_IOS_UI_TEST_NETWORK_PROFILE=public" 540 ) 541 if [[ "$operation" == "physical-ui-build" ]]; then 542 supervise_physical_xcode_child xcodebuild "${physical_args[@]}" build-for-testing 543 exit $? 544 fi 545 if [[ ! "$result_name" =~ ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$ ]]; then 546 echo "error: physical-ui-test result name is invalid" >&2 547 exit 64 548 fi 549 result_bundle="$XCODE_RESULTS/$result_name.xcresult" 550 if [[ -e "$result_bundle" ]]; then 551 echo "error: physical-ui-test result already exists: $result_bundle" >&2 552 exit 1 553 fi 554 mkdir -p "$XCODE_RESULTS" 555 supervise_physical_xcode_child xcodebuild \ 556 "${physical_args[@]}" \ 557 -resultBundlePath "$result_bundle" \ 558 test-without-building 559 ;; 560 *) 561 echo "usage: $0 {resolve|package-build|package-test|project-build|project-test|local-social-ui-test|remote-ui-test|physical-ui-build|physical-ui-test}" >&2 562 exit 64 563 ;; 564 esac