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

xcodebuild stand-in: the build in test's result bundles (status, log, errors and warnings) - #11

Merged
designgears merged 25 commits into
x86simfrom
t3/xcresult-build-status
Nov 29, 2026
Merged

designgears merged 25 commits into
x86simfrom
t3/xcresult-build-status

Conversation

@designgears

@designgears designgears commented Nov 28, 2026 •

Copy link
Copy Markdown

xcodebuild test -resultBundlePath now puts the build in the bundle as Xcode 27.2 does (compared with Apple's bundles on the Mac through xcresulttool):

  • Build action status: x86sim test --built / --build-log (test-without-building stays "notRequested").

  • Build log (swiftbuild/buildlog.py): one section per Swift Build task that ran, with Xcode's titles ("Link XCTestDemoTests (arm64)", "Sign XCTestDemo.app"), command details (" (in target 'T' from project 'P')", cd, command line), times. Read from the build's own XCBuildData: task-store.msgpack (Swift Build's MsgPack: 0xe0 XX is a UInt8) and llbuild's build.db (commands of the latest iteration, start/end). Swift driver per-file jobs are not in either and are left out.

  • Errors and warnings from sweetpad's diagnostics: capitalized message, issue type, 0-based location and Timestamp as Xcode writes them.

  • Failed build: the bundle Xcode writes then (build failed, testing cancelled, "Testing cancelled because the build failed.").

  • Console and default bundle: "Command line invocation:" first; test / test-without-building end with xcodebuild's closing lines ("Test session results, code coverage, and logs:", "Failing tests:" as Xcode names them, ** TEST [EXECUTE ]SUCCEEDED / FAILED **) and print the test processes' whole output (x86sim test --xcodebuild); without -resultBundlePath the bundle goes where xcodebuild puts it (<derived data>/Logs/Test/Test-<Scheme>-<time>.xcresult); test-without-building -xctestrun F runs without a project in the directory.

  • Build console: build, build-for-testing and test print Xcode's log of the build instead of sweetpad's task lines (each task's command and output, the service steps; XCTestDemo fresh: 264 blocks vs Xcode's 262), diagnostics as Swift prints them (source excerpt, [#Group] and its link from the .dia), and a failed test build ends with Xcode's "Testing failed:" / "The following build commands failed:" block.

  • Baselines: X86SIM_RECORD_BASELINES=YES on test / test-without-building is Xcode's Set Baseline (no xcodebuild flag exists): the performance tests' averages become the project's xcbaselines for this machine and device.

  • Selection and order: an exit 70 from x86sim test (Xcode's refusal of an -only-testing naming no target) passes through without a ** TEST FAILED ** line; build-for-testing puts the .xctestrun's targets in the scheme's order (sweetpad sorts them by name), as Xcode runs them.

  • More test options: -enumerate-tests (+ -test-enumeration-style / -format / -output-path), -testLanguage / -testRegion (scheme runs only, as Xcode), -collect-test-diagnostics; test-without-building -scheme finds the scheme's .xctestrun from its build-for-testing.

  • Test plans and packages: a plan with code coverage, random order, repetitions or attachment lifetimes got no .xctestrun (sweetpad refuses those options): it builds with the plan without them (the file put back after) and the stand-in writes Xcode's keys for them (CodeCoverageBuildableInfos, TestExecutionOrdering, TestRepetitionPolicy, lifetimes); the plan's coverage turns coverage on; a plan's targets in its order. xcodebuild test / test-without-building / build-for-testing in a Swift package's directory now run its tests (x86sim test --spm), with Xcode's "Resolve Package Graph" lines.

  • Destinations: -destination matches x86Sim devices as Xcode matches simulators (platform, OS= or latest, id= the UDID, name= the device's name or its model), boots one that is off, and fails with Xcode's "Unable to find a device matching the provided destination specifier" (exit 70); -showdestinations lists the placeholders and every device in Xcode's format.

  • More plan options: a configuration's own options over the plan's; a target's Swift Testing selectedTags / skippedTags (sweetpad refuses them) become Xcode's OnlyTestingTags / SkipTestingTags.

  • Sanitizers: -enableUndefinedBehaviorSanitizer YES (the Darwin SDK's runtime; Swift Build finds it through a clang wrapper whose resource directory has the SDK's lib/darwin); -enableAddressSanitizer / -enableThreadSanitizer refused (their shadow memory does not map under x86Sim's translator yet). Also: xcodebuild test without -resultBundlePath keeps its build log until the test run has read it.

Needs x86sim's x86sim test --build-log (x86sim/x86sim#74, which pins this). Merge this first.

🤖 Generated with Claude Code

…e result bundle's build action succeeded)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
designgears and others added 2 commits November 28, 2026 10:31
…lt bundle

swiftbuild/buildlog.py reads Swift Build's own record of the build (the build description's task-store.msgpack:
each task's execution description, rule info, command line, directory and target; llbuild's build.db: which
commands ran in this build and when) and writes it in the shape of `xcresulttool get log --type build`, with
sweetpad's diagnostics as the build's errors and warnings (Xcode's issue types, capitalized messages, times).
test passes it to x86sim test --build-log; when the build fails and a -resultBundlePath is given, x86sim test
writes the bundle Xcode writes then (the errors, testing cancelled) without running anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le without a build log

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@designgears designgears changed the title xcodebuild stand-in: test tells x86sim test it built the products xcodebuild stand-in: the build in test's result bundles (status, log, errors and warnings) Nov 28, 2026
designgears and others added 22 commits November 28, 2026 10:48
…s from the compilers' .dia

- Issue types: a bitstream reader for serialized diagnostics (Objects-normal/<arch>/*.dia) gives Xcode's
  issue type: Swift's diagnostic group ("NoUsage@url" -> NoUsage), clang's category.
- The Swift driver's dynamic tasks, which the task store does not keep: "Planning Swift module T" (build.db's
  swift-driver-invocation), "Emitting module for T", "Compiling A.swift" > "Compile A.swift", "Discovering
  Swift tasks after ...", "Compiling Clang/Swift module M" (explicit modules), from the files this build wrote,
  timed by build.db's driver jobs; then "Prune stale explicit modules".
- The build service's own steps before the first task (target dependency graph from target-graph.txt, the
  build description's signature and path).
- A diagnostic goes on its file's "Compiling A.swift" section, which fails with it.
XCTestDemo fresh build: 256 sections against Xcode 27.2's 251.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- "Command line invocation:" first, as xcodebuild prints it (CI log parsers start a run there).
- x86sim test --xcodebuild test / test-without-building: xcodebuild's closing lines ("Test session results,
  code coverage, and logs:", "Failing tests:" as Xcode names them, ** TEST [EXECUTE ]SUCCEEDED / FAILED **) and
  the test processes' whole output, not x86sim test's progress lines.
- Without -resultBundlePath, the bundle where xcodebuild writes one: <derived data>/Logs/Test/
  Test-<Scheme>-<time>.xcresult.
- test-without-building -xctestrun F runs without a project in the directory, as on a Mac.

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

- build / build-for-testing / test: Swift Build's lines are held back and the build's log (buildlog.py) printed
  as xcodebuild prints it: each task's command (rule info, target, cd, command line) and output, a blank line
  after each, the service steps first (XCTestDemo fresh build: 264 blocks against Xcode 27.2's 262).
- Diagnostics as the Swift compiler prints them in a compile's output: "path:line:col: severity: message
  [#Group]", the source lines with the marker, the group's documentation link (from the .dia).
- A test whose build failed ends as xcodebuild's: the bundle (the default one in -derivedDataPath without
  -resultBundlePath), "Testing failed:" with the errors and the cancel, ** TEST FAILED **, "The following build
  commands failed:" with each failed step and the count.
- sweetpad's "path:line:col" diagnostic locations kept in the held lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tests-until-failure and the test time limits

Passed to x86sim test, which sets XCTest's repetition policy and time limits as Xcode 27.2 does.
-retry-tests-on-failure is a flag, not an option with a value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ion to x86sim test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m test --also-on)

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…current destinations' options

-testPlan NAME goes to Swift Build (sweetpad), which then writes that plan's .xctestrun instead of the scheme's
default plan's. -disable-concurrent-destination-testing and -maximum-concurrent-test-simulator-destinations go
to x86sim test (--serial-destinations, --max-concurrent-destinations).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rker-count to x86sim test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (Xcode's Set Baseline, which has no flag)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or line said it), no TEST FAILED line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…heme's order, as Xcode runs them

sweetpad writes them sorted by name: XCTestDemo's logic tests ran before its
hosted tests, where Xcode runs the scheme's Testables in order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…thout-building -scheme finds the scheme's .xctestrun

As Xcode 27.2: the language and region apply to a scheme's run (not to an
-xctestrun given on the command line), and test-without-building with
-scheme / -derivedDataPath runs the .xctestrun its build-for-testing wrote.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…put-path): the tests listed, none run

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

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

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

sweetpad's .xctestrun generator refuses these test-plan options ("the test plan
collects code coverage, which a generated .xctestrun doesn't", "unsupported
test-plan option 'maximumTestRepetitions'", ...) and wrote no .xctestrun. It now
gets the plan without them (the file put back after the build) and the stand-in
writes what Xcode 27.2 writes: CodeCoverageBuildableInfos (IncludeInReport for
the plan's coverage targets), each target's TestExecutionOrdering,
TestRepetitionPolicy and attachment lifetimes. The plan's code coverage turns
coverage on as in Xcode (the plan is read once, before the swap). Plans are
found next to the project (project_files gives the pbxproj).

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

They went to xcbuild.py, which has no test action ("unexpected argument test").
Now, as on a Mac: "Resolve Package Graph" / "Resolved source packages:", the
result bundle line, then x86sim test --spm with xcodebuild's test options (the
command assembly shared with project runs: run_x86sim_test); build-for-testing
builds alone (--build-only).

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

-destination 'platform=iOS Simulator,name=iPhone 17 Pro,OS=27.2' needed an x86Sim
phone named so, running. Now, as Xcode matches simulators: platform, OS (a
version or latest), id (the UDID result bundles give the device; also the
device's folder or name), name (the device's name, else its model, as Apple's
simulators are named after theirs), a running one first; a device that is off
is booted (x86sim-aot sim start, then its home screen), as Xcode boots a
simulator; none matching is Xcode 27.2's "Unable to find a device matching the
provided destination specifier" with the compatible destinations (exit 70).
-showdestinations lists the placeholders and every device in Xcode's format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ns, coverage, lifetimes) over the plan's

They were stripped for sweetpad from every configuration but written back from
defaultOptions only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sting), as Xcode's OnlyTestingTags / SkipTestingTags

sweetpad refuses them ("unsupported test-plan target option 'skippedTags'");
the plan goes to it without them and the .xctestrun gets Xcode 27.2's keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nitizer refused with the reason

UndefinedBehaviorSanitizer as on a Mac: ENABLE_UNDEFINED_BEHAVIOR_SANITIZER,
the Darwin SDK's libclang_rt.ubsan_<platform>sim_dynamic.dylib linked and
copied into the products. Swift Build looks for a sanitizer's library next to
the clang it runs (<clang>/../../lib/clang/<version>/lib/darwin), which on
Linux has none ("Unable to copy Undefined Behavior Sanitizer library: Could
not determine where it lives"): CC is a wrapper whose resource directory adds
the SDK's lib/darwin. Address / Thread Sanitizer build and their runtime
starts, but their shadow memory does not map under x86Sim's translator yet:
refused with that reason. Also: buildlog.py no longer fails on a section
without command details; xcodebuild test without -resultBundlePath keeps the
build log until x86sim test has read it (it was removed first: "No such
file").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@designgears
designgears merged commit eb87f32 into x86sim Nov 29, 2026
1 check passed
@designgears
designgears deleted the t3/xcresult-build-status 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