EarlGrey does not work with Address Sanitizer.
- Dominant language
- Objective-C
- Stars
- 5.7k
- Forks
- 737
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 5
Description
As is documents in our [known issues](https://github.com/google/EarlGrey/blob/master/docs/known-issues.md), EarlGrey does not work if you are using Address Sanitizer with your test app.
Some simple repro steps for this are:
- Go to the FunctionalTest.xcodeproj file.
- In the `FunctionalTestRig` Scheme, under Diagnostics, turn on `Enable Address Sanitizer` for both the Run and Test Options.

Now, on running the tests (CMD+U) on the FunctionalTestRig, you should get a crash from a recursive call, similar to:
```
Thread 1Queue : com.apple.main-thread (serial)
#0 0x000000010141b332 in bool objc::DenseMapBase, unsigned long, true, objc::DenseMapInfo > >, DisguisedPtr, unsigned long, objc::DenseMapInfo >, true>::LookupBucketFor >(DisguisedPtr const&, std::__1::pair, unsigned long> const*&) const ()
#1 0x000000010141b2fe in objc::DenseMapBase, unsigned long, true, objc::DenseMapInfo > >, DisguisedPtr, unsigned long, objc::DenseMapInfo >, true>::FindAndConstruct(DisguisedPtr const&) ()
#2 0x0000000101419691 in objc_object::sidetable_retain() ()
#3 0x00000001012a0c9e in grey_getIdlingResourceForQueue at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:61
#4 0x00000001012a022c in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:94
#5 0x000000010044b530 in wrap_dispatch_async ()
#6 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
#7 0x000000010044b530 in wrap_dispatch_async ()
#8 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
#9 0x000000010044b530 in wrap_dispatch_async ()
#10 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
#11 0x000000010044b530 in wrap_dispatch_async ()
#12 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
#13 0x000000010044b530 in wrap_dispatch_async ()
#14 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
#15 0x000000010044b530 in wrap_dispatch_async ()
#16 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
#17 0x000000010044b530 in wrap_dispatch_async ()
#18 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
#19 0x000000010044b530 in wrap_dispatch_async ()
#20 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
#21 0x000000010044b530 in wrap_dispatch_async ()
#22 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
#23 0x000000010044b530 in wrap_dispatch_async ()
#24 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
#25 0x000000010044b530 in wrap_dispatch_async ()
#26 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
#27 0x000000010044b530 in wrap_dispatch_async ()
#28 0x00000001012a03df in grey_dispatch_async at EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m:98
```
Contributor guide
Research direction
Reproduce the crash from FunctionalTest.xcodeproj using the FunctionalTestRig scheme with Address Sanitizer enabled for Run and Test, then inspect EarlGrey/Synchronization/GREYDispatchQueueIdlingResource.m around lines 61, 94, and 98. The work is done when the recursive dispatch crash no longer occurs and the FunctionalTestRig tests run successfully with Address Sanitizer enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, objective-c
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100