Skip to content

Inject sanitizer runtimes into UI test runners - #3149

Merged
keith merged 1 commit into
bazelbuild:mainfrom
louwers:fix-ui-test-sanitizers
Nov 21, 2026
Merged

keith merged 1 commit into
bazelbuild:mainfrom
louwers:fix-ui-test-sanitizers

Conversation

@louwers

@louwers louwers commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

ios_ui_test with --features=tsan aborts before any test runs:

==52935==ERROR: Interceptors are not working. This may be because ThreadSanitizer is loaded too late (e.g. via dlopen). Please launch the executable with:
DYLD_INSERT_LIBRARIES=.../uitest-Runner.app/PlugIns/uitest.xctest/Frameworks/libclang_rt.tsan_iossim_dynamic.dylib

For UI tests the xctestrun runner moves the test bundle into <name>-Runner.app/PlugIns, but it then looks for libclang_rt.*.dylib (and libMainThreadChecker.dylib) under the bundle's original path $test_tmp_dir/<name>.xctest/Frameworks. Nothing is found there, so DYLD_INSERT_LIBRARIES stays empty and XCTRunner loads the Thread Sanitizer runtime through dlopen with the test bundle.

This looks for them next to test_bundle_binary instead, which already follows the move. Unit tests are unaffected because their bundle stays where it was.

Adds test_ios_ui_test_pass_tsan, the UI test counterpart of test_ios_unit_test_pass_asan. I ran it locally with Xcode 27.2 and the iOS 26.4 simulator runtime: it passes with this change and fails without it, with the error above. test_ios_ui_test_pass still passes. To run it here I had to temporarily change the runners' device_type = "iPhone Xs" to "iPhone 17", because the iPhone Xs can't run iOS 26. I didn't include that change. The Main Thread Checker half of the fix isn't covered by a test.

Found while turning Thread Sanitizer back on for MapLibre Native's iOS UI tests (maplibre/maplibre-native#5075), which applies this as a patch on rules_apple 5.2.0.

🤖 Generated with Claude Code

The xctestrun runner moves UI test bundles into the XCTRunner app's
PlugIns before it looks for the sanitizer runtimes and the Main Thread
Checker, but it still looked for them at the bundle's original path.
They were never added to DYLD_INSERT_LIBRARIES, so the runner loaded the
bundle's Thread Sanitizer runtime through dlopen and aborted with
"Interceptors are not working".

Look for them next to the test bundle binary, which follows the move.

Assisted-by: Claude <noreply@anthropic.com>
@louwers

louwers commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

CI fail looks like a flake.

@keith
keith enabled auto-merge (squash) November 20, 2026 23:45
@keith
keith merged commit ece83eb into bazelbuild:main Nov 21, 2026
11 checks passed
@louwers

louwers commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks!

louwers added a commit to louwers/maplibre-native that referenced this pull request Nov 26, 2026
bazelbuild/rules_apple#3149 is merged but not yet released, so pin
rules_apple to its merge commit with a git_override and drop the local
patch.

Assisted-by: Claude <noreply@anthropic.com>
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.

2 participants