EarlGrey icon indicating copy to clipboard operation
EarlGrey copied to clipboard

Couldn't run test on real device

Open yaphatak opened this issue 10 years ago • 10 comments

This is error that I see.

Device iPhone 6 with OS 10.01(14A403). its ios10 GM

[User Defaults] Failed to write value for key AutomationEnabled in CFPrefsPlistSource<0x1740f6c80> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null)): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access, switching to read-only 2016-09-09 13:39:20.592391 App[952:261015] [User Defaults] attempt to set for key in in read-only (due to a previous failed write) preferences domain CFPrefsPlistSource<0x1740f6c80> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null)) 2016-09-09 13:39:20.592859 App[952:261015] [User Defaults] attempt to set for key in in read-only (due to a previous failed write) preferences domain CFPrefsPlistSource<0x1740f6c80> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null)) Signal caught: Segmentation fault: 11 0 EarlGrey 0x00000001025bca50 grey_signalHandler + 128 1 libsystem_platform.dylib 0x000000018f727338 _sigtramp + 36 2 libswiftCore.dylib 0x00000001033c961c _TFsoi3neeFTGSqPs9AnyObject__GSqPS____Sb + 32 3 App 0x0000000100afed08 TZFE4AppCSo6UIView10initializefT_T + 132 4 App 0x0000000100aff294 TToZFE4AppCSo6UIView10initializefT_T + 24 5 libobjc.A.dylib 0x000000018f0d1440 + 24 6 libobjc.A.dylib 0x000000018f0d16ac + 612 7 libobjc.A.dylib 0x000000018f0d14a0 + 88 8 libobjc.A.dylib 0x000000018f0d8c1c + 184 9 libobjc.A.dylib 0x000000018f0e3258 + 56 10 EarlGrey 0x00000001025bc018 -[GREYAutomationSetup perform] + 72 11 EarlGrey 0x000000010259a858 +[EarlGreyImpl load] + 120 12 libobjc.A.dylib 0x000000018f0d28a8 + 656 13 libobjc.A.dylib 0x000000018f0d35c4 + 76 14 ??? 0x0000000102511ff0 0x0 + 4333838320 15 ??? 0x0000000102520f18 0x0 + 4333899544 16 ??? 0x000000010251ff50 0x0 + 4333895504 17 ??? 0x0000000102520004 0x0 + 4333895684 18 ??? 0x0000000102512438 0x0 + 4333839416 19 ??? 0x00000001025168f4 0x0 + 4333857012 20 ??? 0x0000000102511044 0x0 + 4333834308

yaphatak avatar Sep 09 '16 20:09 yaphatak

I wonder why the log is not symbolicated.

Looks like the crash is happening in Swift runtime in the not equal operator, which is called from your app binary.

$ xcrun swift-demangle _TFsoi3neeFTGSqPs9AnyObject__GSqPS____Sb _TFsoi3neeFTGSqPs9AnyObject__GSqPS____Sb ---> Swift.!== infix (Swift.AnyObject?, Swift.AnyObject?) -> Swift.Bool

For some reason I can't demangle the other 2 mangled names. They seem to refer to UIView initialize.

Did you implement/override this method in your app? Does it use the not equal operator, and is it being used correctly? Are you using Swift 2.3 or Swift 3?

I can't repro this issue running EarlGreyFunctionalTests or EarlGreyFunctionalSwiftTests on iPhone 5S with iOS 10.0.1 final, and Xcode 8 final. I can see the log messages for failed writes to User Defaults, but those are just warnings and don't crash the app, all tests continue normally.

It would be helpful if you could share code that can repro this issue.

axi0mX avatar Sep 15 '16 05:09 axi0mX

I can also run our functional tests just fine on my iPhone 6s running iOS 10.01

2016-09-15 01:17:04.969089 FunctionalTestRig[579:118552] Crash handler setup started.
2016-09-15 01:17:04.969325 FunctionalTestRig[579:118552] Crash handlers setup completed.
2016-09-15 01:17:04.973422 FunctionalTestRig[579:118603] [User Defaults] Failed to write value for key AutomationEnabled in CFPrefsPlistSource<0x1700ed680> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null)): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access, switching to read-only
2016-09-15 01:17:04.976638 FunctionalTestRig[579:118552] [User Defaults] attempt to set <private> for key in <private> in read-only (due to a previous failed write) preferences domain CFPrefsPlistSource<0x1700ed680> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null))
2016-09-15 01:17:04.976889 FunctionalTestRig[579:118552] [User Defaults] attempt to set <private> for key in <private> in read-only (due to a previous failed write) preferences domain CFPrefsPlistSource<0x1700ed680> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null))
2016-09-15 01:17:06.087497 FunctionalTestRig[579:118552] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2016-09-15 01:17:06.105742 FunctionalTestRig[579:118604] [MC] Invalidating cache
2016-09-15 01:17:06.124475 FunctionalTestRig[579:118604] [MC] Invalidating cache
2016-09-15 01:17:06.128834 FunctionalTestRig[579:118604] [MC] Invalidating cache
2016-09-15 01:17:06.322612 FunctionalTestRig[579:118552] [MC] Reading from public effective user settings.
2016-09-15 01:17:06.337720 FunctionalTestRig[579:118604] [MC] Invalidating cache
2016-09-15 01:17:06.349781 FunctionalTestRig[579:118552] [MC] Reading from public effective user settings.
2016-09-15 01:17:06.350549 FunctionalTestRig[579:118603] [MC] Invalidating cache
2016-09-15 01:17:06.843593 FunctionalTestRig[579:118552] Scheduling timer to fire in 0.5 seconds.
2016-09-15 01:17:06.934139 FunctionalTestRig[579:118552] [MC] Reading from public effective user settings.
Test Suite 'All tests' started at 2016-09-15 01:17:07.393
Test Suite 'FunctionalTests.xctest' started at 2016-09-15 01:17:07.394
Test Suite 'FTRAccessibilityTest' started at 2016-09-15 01:17:07.394
Test Case '-[FTRAccessibilityTest testAccessibilityElementTappedSuccessfullyWithTapAtPoint]' started.
2016-09-15 01:17:07.399443 FunctionalTestRig[579:118552] Timer fired! Removing splash screen.
2016-09-15 01:17:07.442503 FunctionalTestRig[579:118552] View is moving to nil window. Skipping viewWillDisappear state tracking.

khandpur avatar Sep 15 '16 08:09 khandpur

Thanks @axi0mX , @khandpur : When I tried this , I also just build app and launch it and it didn't crash. There is no test code as it was failing in set up itself. We recently fixed few bugs with Swift 3 migration. I will try with latest code for our app and let you know.

yaphatak avatar Sep 16 '16 00:09 yaphatak

@yaphatak, as mentioned, it would be great if you could please provide us with a repro project or reproduce the issue with our tests projects. Do tell us what you find. Thanks.

tirodkar avatar Sep 16 '16 00:09 tirodkar

Yes I will do that. It will be sometime next week hopefully. So if you want to close this I am fine with it, as you guys can't repro it with same configuration of device and host.

yaphatak avatar Sep 16 '16 00:09 yaphatak

I tried example project as suggested. Example app keep crashing. This is on iphone 5s and OS 10.0.1 (Also this example project didnt work as is on xcode 8. So i converted to Swift3. )

Error Domain=com.apple.platform.iphoneos Code=-12 "Unable to launch com.google.samples.EarlGrey" UserInfo={NSLocalizedDescription=Unable to launch com.google.samples.EarlGrey, NSUnderlyingError=0x7ff300284340 {Error Domain=DTXMessage Code=1 "(null)" UserInfo={DTXExceptionKey=Background launch requested, but this app cannot run in the background (see UIApplicationExitsOnSuspend or 'Background Modes' in Xcode).}}} 2016-09-16 15:42:14.503 xcodebuild[93081:717074] Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}

yaphatak avatar Sep 16 '16 22:09 yaphatak

@yaphatak, just to confirm, this was a vanilla run on a 5s on iOS 10.0.1 on Xcode8? (Thanks for the heads up on the conversion. Feel free to send a PR for it or we'll get it in in the coming release.)

tirodkar avatar Sep 16 '16 22:09 tirodkar

Yatin, following up to see if you were able to get this issue resolved? @yaphatak

khandpur avatar Oct 03 '16 19:10 khandpur

@khandpur Our debug build has some issues running with EarlGrey but release one worked just fine. Actually I worked with @tirodkar on this. Thanks for all support. I am closing this now

yaphatak avatar Oct 03 '16 19:10 yaphatak

@tirodkar : I can still reproduce this issue with Xcode 10.2 and device with iOS 11+. Here are the logs.

2019-05-02: Enabling accessibility for automation on Device. 2019-05-02: [User Defaults] Couldn't write value for key AutomationEnabled in CFPrefsPlistSource<0x1086e3470> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access, switching to read-only 2019-05-02: [User Defaults] attempt to set 1 for key in ApplicationAccessibilityEnabled in read-only (due to a previously logged write error) preferences domain CFPrefsPlistSource<0x1086e3470> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No) 2019-05-02: [User Defaults] attempt to set 1 for key in AccessibilityEnabled in read-only (due to a previously logged write error) preferences domain CFPrefsPlistSource<0x1086e3470> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No)

kapild-imvu avatar May 06 '19 19:05 kapild-imvu