Skip to content

Verify wasmkit is a universal binary #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 24, 2025

Conversation

wti
Copy link
Contributor

@wti wti commented Jun 23, 2025

Requested in swift PR-82393

lit.cfg: To configure wasmkit, this adds substitution variable and checks path exists

test....py: To check wasmkit executable binary is universal, this uses file tool from the OS

  • Runs only on Darwin
  • file should be available on all macOS (and also available on Linux)
  • Verifies output (is universal) with FileCheck, but does not verify formats

Test put in test-snapshot-binaries as peer of rpath tests (instead of in wasmkit dir)

  • b/c the invariants (rpath, universal) apply to many files per platform
  • b/c platform-specific format logic is also relatively consolidated in the swift repo
    • e.g., swift/utils/swift_build_support/swift_build_support/products
    • wasmkit.py#run_swift_build() handles both rpath and universal-binary

PR could work as-is, or be extended:

  1. Make universal checks require the two target arch
    • (but avoid false negatives from overfitting file output)
  2. Include universal checks for other binaries
    • I couldn't find a canonical list or BOM for package contents or executables
    • I can check all current products (or perhaps just those without symlinks?)
    • Coordinate with docc fix to emit as universal binary

(Also please let me know if a swift-integration-test issue is preferred before this PR, to handle issue/PR scope discussions)

wti added 2 commits June 23, 2025 12:07
- Test runs only on Darwin
- Check compares output of 'file' tool (exists on macOS and Linux)
- Similar test could verify other executables (but need BOM list?)
@MaxDesiatov
Copy link
Contributor

@swift-ci test

@MaxDesiatov
Copy link
Contributor

I kicked off tests on this one in the toolchain repo on main, but it also needs a cherry-pick for 6.2 branch so that we can test swiftlang/swift#82406

@wti
Copy link
Contributor Author

wti commented Jun 24, 2025

Cherry-picked for 6.2 branch in #164

@MaxDesiatov MaxDesiatov requested a review from bnbarham June 24, 2025 16:34
@MaxDesiatov
Copy link
Contributor

[2025-06-24T14:47:53.531Z] PASS: swift-package-tests :: test-snapshot-binaries/test-universal-darwin.py (22 of 40)

in https://ci.swift.org/job/swift-PR-toolchain-macos/1995/consoleText

LGTM, thanks!

@MaxDesiatov MaxDesiatov merged commit c920730 into swiftlang:main Jun 24, 2025
MaxDesiatov pushed a commit that referenced this pull request Jun 26, 2025
**Explanation**: for release in 6.2, test wasmkit, a new toolchain executable, as universal binary on macOS using file | FileCheck.

**Scope**: Runs on Darwin only. 

**Issues**: Resolves swiftlang/swift#82390

**Original PRs**: #163 

**Risk**: Depends on 'file' tool in OS (in macOS and Linux).  False positive possible after universal architecture changes since only checking text "universal binary".

**Testing**: kateinoigakukun manually verified wasmkit is universal after change in swift main swiftlang/swift#82390, and this tests it in CI.

**Reviewers**: @MaxDesiatov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants