Skip to content

Conversation

@keith
Copy link
Member

@keith keith commented Aug 15, 2022

rules_apple handles bundling sanitizers with test bundles that it
creates, swift_test does not handle this as it creates a very minimal
xctest bundle (ideally it wouldn't have to create that bundle at all and
you could run tests directly). Because of this we don't have the
sanitizer libs easily extracted into the bundle. Sanitizers require us
to load them when launching the binary with DYLD_INSERT_LIBRARIES, to
know which to load we can inspect the binary for these. Clang inserts an
absolute rpath to the Xcode directory containing the libraries, as well
as the library loads for each we depend on.

rules_apple handles bundling sanitizers with test bundles that it
creates, swift_test does not handle this as it creates a very minimal
xctest bundle (ideally it wouldn't have to create that bundle at all and
you could run tests directly). Because of this we don't have the
sanitizer libs easily extracted into the bundle. Sanitizers require us
to load them when launching the binary with DYLD_INSERT_LIBRARIES, to
know which to load we can inspect the binary for these. Clang inserts an
absolute rpath to the Xcode directory containing the libraries, as well
as the library loads for each we depend on.
Copy link
Contributor

@jpsim jpsim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 works in my testing with tsan & SwiftLint

Catches races when present, passes tests otherwise.

@keith keith force-pushed the ks/add-basic-sanitizer-support-for-swift_test branch from 137d72a to 908ff17 Compare August 16, 2022 21:03
@keith keith enabled auto-merge (squash) August 16, 2022 21:05
@keith keith merged commit a4f1712 into master Aug 17, 2022
@keith keith deleted the ks/add-basic-sanitizer-support-for-swift_test branch August 17, 2022 13:22
dierksen pushed a commit to dierksen/rules_swift that referenced this pull request Sep 6, 2022
rules_apple handles bundling sanitizers with test bundles that it
creates, swift_test does not handle this as it creates a very minimal
xctest bundle (ideally it wouldn't have to create that bundle at all and
you could run tests directly). Because of this we don't have the
sanitizer libs easily extracted into the bundle. Sanitizers require us
to load them when launching the binary with DYLD_INSERT_LIBRARIES, to
know which to load we can inspect the binary for these. Clang inserts an
absolute rpath to the Xcode directory containing the libraries, as well
as the library loads for each we depend on.
dierksen added a commit to dierksen/rules_swift that referenced this pull request Sep 6, 2022
* master:
  Update README with new URL (bazelbuild#893)
  Don't error if worker runfiles aren't present (bazelbuild#892)
  Supporting Swift 5.7 Bare Slash Regex Literal (bazelbuild#886)
  Use runfiles for `index-import` path (bazelbuild#889)
  Add additional outputs to the swift module in `SwiftInfo` (bazelbuild#888)
  Add missing swift_import params to objc_provider (bazelbuild#885)
  Fix typo in docs (bazelbuild#887)
  Update README with new URLs (bazelbuild#883)
  Add `apple.swizzle_absolute_xcttestsourcelocation` feature (bazelbuild#878)
  Require cacheable swiftmodules for -no-clang-module-breadcrumbs
  Update apple_support (bazelbuild#880)
  Add basic sanitizer support for swift_test (bazelbuild#877)
  Remove compatibility readme section
  Moves compile_outputs.symbol_graph_directory under all_derived_outputs
tymurmustafaiev pushed a commit to tymurmustafaiev/rules_swift that referenced this pull request Jul 19, 2023
rules_apple handles bundling sanitizers with test bundles that it
creates, swift_test does not handle this as it creates a very minimal
xctest bundle (ideally it wouldn't have to create that bundle at all and
you could run tests directly). Because of this we don't have the
sanitizer libs easily extracted into the bundle. Sanitizers require us
to load them when launching the binary with DYLD_INSERT_LIBRARIES, to
know which to load we can inspect the binary for these. Clang inserts an
absolute rpath to the Xcode directory containing the libraries, as well
as the library loads for each we depend on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants