Skip to content
This repository was archived by the owner on Dec 4, 2026. It is now read-only.

xcodebuild stand-in and Swift Build glue as Xcode 27.2 (XCTest parity) - #12

Merged
designgears merged 32 commits into
x86simfrom
t3/xctest-parity
Dec 1, 2026
Merged

designgears merged 32 commits into
x86simfrom
t3/xctest-parity

Conversation

@designgears

Copy link
Copy Markdown

The xcodebuild stand-in and Swift Build glue as Xcode 27.2 behaves, measured against Apple's xcodebuild / simulator / xcresulttool on a Mac with the parity suite (x86sim tests/xctest-parity, all four platforms). Goes with x86sim's t3/xctest-parity PR.

  • .xctestrun and test plans: Xcode's files (FormatVersion 1 / per plan v2, per-target keys), -showTestPlans, newer test options, a plan's configurations and options on tvOS / watchOS / visionOS, a plan without codeCoverage collects coverage.
  • Console and verdicts: "Build settings from command line:", repetition notes and verdicts where xcodebuild prints them, refused runs (no matching destination, unknown plan) as Xcode refuses them, build-for-testing test-without-building on one line.
  • Builds through Swift Build's events: build log, console and failures from Swift Build's own events (swiftbuild/buildlog.py, swbuild-events); a failed build ends as Xcode's (test action, cancelled scheduling); Apple's tool lines around sweetpad's stand-ins.
  • Provisioning: Xcode's provisioning answers for simulator builds (entitlements only for the app and the UI runner, $(AppIdentifierPrefix) resolved) and its entitlements text.
  • Packages: optionally built as Xcode builds one, over SwiftPM's PIF (XCODEBUILD_PACKAGE_ENGINE=swiftbuild), run destination line and test target order as Xcode's.
  • A phone boot fails fast (stopped while booting, or 300 s).

Facts and remaining differences: x86sim docs/TESTING.md and tests/xctest-parity/allowlist.py.

🤖 Generated with Claude Code

designgears and others added 30 commits November 30, 2026 08:30
… test options

build-for-testing now leaves the .xctestrun files Xcode 27.2 writes instead of Swift Build's
(swiftbuild/xctestrun.py): <Scheme>_<sdk><version>-<arch>.xctestrun (FormatVersion 1) for a scheme
without test plans, one <Scheme>_<Plan>_... (FormatVersion 2) per test plan of the scheme (only
-testPlan's with it), each target with Xcode's keys (every product, the bundle ids and process names
for crash reports, Xcode's environment, the runtime's Main Thread Checker, the defaults), the
CodeCoverageBuildableInfos with each target's sources and toolchains (the Metal toolchain when
installed), sorted test identifiers; the derived data's info.plist (WorkspacePath).
test-without-building -scheme picks the plan's file. Equal to Xcode's for XCTestDemo and a
four-plan project but for the machine's paths.

-showTestPlans prints the scheme's plans as Xcode does; -maximum-parallel-testing-workers,
-enablePerformanceTestsDiagnostics and -maximum-concurrent-test-device-destinations are accepted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…verdicts on stderr

"Running tests repeatedly N times." (and the retry / until-failure notes) before "Writing result
bundle at path:", as Xcode 27.2; x86sim test learns whether the container is a project or a
workspace (its exit-70 message); a stopped run's "** TEST FAILED **" on stderr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ld prints it; test actions fail on an unsupported deployment target as Xcode does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…command line as Xcode runs it

The build is its own action (its bundle line, its verdict; a failed one's "Building project X for testing"
block on stderr), then the run into the same bundle, which goes ahead after a failed build as Xcode's does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… them, without sweetpad's build lock

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… destination, unknown test plan)

A destination no device matches: Xcode 27.2's error (no echo of the specifier; the scheme's destinations with
the placeholders, its incompatible ones' header) and the bundle of a run that failed to start. An -testPlan the
scheme does not have: exit 64, Xcode's error, the same bundle titled with the scheme. The scheme's first
testable names such a bundle (x86sim test --start-error / --start-title).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ects coverage, as Xcode's

Xcode 27.2's runs and .xctestrun files of a plan with empty options have coverage (CodeCoverageBuildableInfos,
the coverage report); only "codeCoverage": false turns it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e and default plan

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Xcode's build log

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…b) still gets its log

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- test's verdict after a failed build on stderr (Testing failed:, ** TEST FAILED **, the failed commands), the
  bundle line on stdout; failed commands listed inner step first, as they failed
- a task with tasks of its own (a Swift driver job, the build description): its command, a blank line, its tasks,
  then its output with the next task straight after it
- compiler diagnostics as the Swift compiler prints them: two source lines after, numbered to the width of the
  file's last line, a blank line between diagnostics, one link per diagnostic group at the end; the message on the
  file's own Compile step of a batch
- the streamed build: a blank line after CreateBuildDescription, none after the build description path

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t plan's .xctestrun, each with its plan's targets

Swift Build's .xctestrun generator (sweetpad) is iOS-only; the stand-in wrote its own for the run's plan but none
for the scheme's other plans ("Swift Build wrote none"), and listed every test bundle in it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or after 300 s, not 900, naming its logs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sweetpad runs Swift Build's swbuild, which prints every build operation
message (task started / output / diagnostic / completed with metrics,
target started) as JSON. swbuild-events sits in its place
(SWEETPAD_SWBUILD), passes the stream through and keeps the events;
buildlog.py makes Xcode's build log from them the way Xcode does: one
section per task (execution description, rule info and target, the
command line for display, its output, notes appended, diagnostics as
messages, TaskMetrics attachments, interestingPath as location, result),
child tasks nested (driver jobs, the build description's tool queries),
the failed commands in the order they failed.

Replaces the reconstruction from task-store.msgpack, build.db and file
times: the compiler's whole output, tool version discovery, notes and
metrics now come through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s events

run_sweetpad points sweetpad at swiftbuild/swbuild-events for every
attempt; write_build_log builds the log, issues and failed commands
from the events (sweetpad's own errors when Swift Build never started).
"The following build commands failed:" lists Swift Build's failed
tasks as they failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Xcode 27.2 (checked on a Mac) prints on stderr "** BUILD FAILED **" /
"** TEST BUILD FAILED **", then "The following build commands failed:"
with each failed command, "Building project P [for testing ]with scheme
S" and the count; the stand-in printed the verdict alone. Also:
XCODEBUILD_SWBUILD_EVENTS keeps Swift Build's events at a path, and
swbuild-events' X86SIM_SWBUILD_CONTINUE sets the request's
continueBuildingAfterErrors (experiments).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…failed builds)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ionOS has the plan's configurations and target order

As Xcode's (and Swift Build's on iOS): one TestConfiguration per plan configuration ("Test Scheme Action" for the
default one), not one named after the build configuration; the test targets in the plan's order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sionOS .xctestrun

The plan's (and each configuration's) environment, arguments, language and region (-AppleLanguages ...),
time allowance, timeouts and each target's selected / skipped tests, as Swift Build writes them on iOS: the
stand-in's own .xctestrun for the other simulators left them out, so a plan's run ignored them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 27.2

- the run after the build is test-without-building's (** TEST EXECUTE FAILED / SUCCEEDED **)
- the build log's title is the build's ("Building project X for testing with scheme S")
- after a failed build, the .xctestrun of what did build (sweetpad writes none then), so the tests that built run
- the stand-in's own progress lines (booting a phone) go to $X86SIM_XCODEBUILD_NOTES when set, not stderr
- continueBuildingAfterErrors stays off, as Xcode's; X86SIM_XCODEBUILD_CONTINUE_AFTER_ERRORS=1 turns it on (the
  swbuild wrapper sets the build request's key)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s (codesign's replacing existing signature, the App Intents processors' log lines), under the conditions Xcode 27.2 prints them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the destination's device, with the test targets it would have run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s entitlements text

swbuild asks $SWEETPAD_PROVISIONING for each target's entitlements; provisioning/xcode-provisioning sits in between
(swbuild-events puts it there) and answers as Xcode 27.2 does for an ad hoc simulator build: a unit-test bundle gets
no simulated entitlements (no Write Entitlements-Simulated.plist / Process product packaging / Generate DER
entitlements tasks), a UI-test runner its project's with $(AppIdentifierPrefix) resolved and without get-task-allow.
The packaging task's Entitlements: text quoted as Apple's Foundation prints it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…PACKAGE_ENGINE=swiftbuild)

swiftbuild/pkgbuild.py: SwiftPM's package PIF (swift package dump-pif) built by Swift Build with the parameters,
tools and environment sweetpad gives an Xcode project (taken from sweetpad's run of pkgtemplate/ with a recording
swbuild), the configured targets in Xcode's scheme order; the build log and console from Swift Build's events; each
test target's bundle (Xcode's layout) run on the phone. multi-swt: 4120 -> 423 differences from Apple.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
designgears and others added 2 commits December 1, 2026 01:05
…test targets in Xcode's order

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@designgears
designgears merged commit 4da9e2a into x86sim Dec 1, 2026
1 check passed
@designgears
designgears deleted the t3/xctest-parity branch December 3, 2026 01:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant