layout: post title: "ReactiveCocoa Unit Testing Tips" date: 2013-09-22 20:45 comments: true categories:
- Testing
- iOS
- Patterns
- Xcode
| 2019-06-13 15:14:51,407 [DEBUG] - hpack.hpack - Encoded header block to b"\x83\x86D\x94`\xd2F\xbd\xe3\xd3X\xea1\xea\xdc[;\x98\x85b\x81\xdbQ'A\x8b\xa0\xe4\x1d\x13\x9d\t\xb8\x10<\xf0\xbf@\x82I\x7f\x86M\x835\x05\xb1\x1f_\x90\x1du\xd0b\r&=LMed\xffu\xd8t\x9fz\xa9\x9a\xca\xc8\xb5~\x939\xeaZk+%\x06\x8d\x80.\xca\xe0\xb0\x8d)\xfdH;<\x1a\xaf\xb5\t_\xa4\xcez\x98ew\x17\x17\xfb\xfe\xff" | |
| 2019-06-13 15:14:51,637 [DEBUG] - hpack.hpack - Decoding b"\x88@\x0ccontent-type\x10application/grpc@\x0bgrpc-status\x019@\x0cgrpc-message\x7f%Application Bundle Name: Shortcuts | ID: is.workflow.my.app | Install Type user | Container (null) cannot be launched as it's not signed with a development identity" | |
| 2019-06-13 15:14:51,637 [DEBUG] - hpack.hpack - Decoded 8, consumed 1 bytes | |
| 2019-06-13 15:14:51,637 [DEBUG] - hpack.hpack - Decoded (b':status', b'200'), consumed 1 | |
| 2019-06-13 15:14:51,637 [DEBUG] - hpack.hpack - Decoded 12, consumed 1 bytes | |
| 2019-06-13 15:14:51,637 [DEBUG] - hpack.hpack - Decoded 16, consumed 1 bytes | |
| 2019-06-13 15:14:51 |
| 2019-06-13 15:15:36,947 [DEBUG] - hpack.hpack - Adding (b'user-agent', b'grpc-python-grpclib/0.3.0rc4 (darwin; cpython/3.6.2+)') to the header table | |
| 2019-06-13 15:15:36,947 [DEBUG] - hpack.hpack - Encoding 58 with 6 bits | |
| 2019-06-13 15:15:36,947 [DEBUG] - hpack.hpack - Encoding 41 with 7 bits | |
| 2019-06-13 15:15:36,947 [DEBUG] - hpack.hpack - Encoded header block to b"\x83\x86D\x94`\xd2F\xbd\xe3\xd3X\xea1\xea\xdc[;\x98\x85b\x81\xdbQ'A\x8b\xa0\xe4\x1d\x13\x9d\t\xb8\x10<\xf0\xbf@\x82I\x7f\x86M\x835\x05\xb1\x1f_\x90\x1du\xd0b\r&=LMed\xffu\xd8t\x9fz\xa9\x9a\xca\xc8\xb5~\x939\xeaZk+%\x06\x8d\x80.\xca\xe0\xb0\x8d)\xfdH;<\x1a\xaf\xb5\t_\xa4\xcez\x98ew\x17\x17\xfb\xfe\xff" | |
| 2019-06-13 15:15:37,073 [DEBUG] - hpack.hpack - Decoding b"\x88@\x0ccontent-type\x10application/grpc@\x0bgrpc-status\x019@\x0cgrpc-message\x7f%Application Bundle Name: Shortcuts | ID: is.workflow.my.app | Install Type user | Container (null) cannot be launched as it's not signed with a development identity" | |
| 2019-06-13 15:15:37,073 [DEBUG] - hpack.hpack |
layout: post title: "ReactiveCocoa Unit Testing Tips" date: 2013-09-22 20:45 comments: true categories:
It looks like the Simulator.app binary is now signed as of Xcode 7 as the following occurs in instruments-without-delay when using the build script:
./build.sh test <SIMULATOR-UDID>
The message that we get from the kernel is:
7/23/15 12:22:52.000 PM kernel[0]: AMFI: Simulator(pid 72600) - [deny-mmap] mapped file has no team identifier and is not a platform binary: /Users/lawrencelomax/src/instruments-without-delay/build/SimShim.dylib
This causes a crash:
| xcodebuild build build | |
| 2016-07-25 11:06:23.977 xctool[76237:2732422] *** Assertion failure in __LaunchXcodebuildTaskAndFeedEventsToReporters_block_invoke(), /tmp/xctool-20160725-72874-vvod9r/Common/XCToolUtil.m:380 | |
| 2016-07-25 11:06:23.980 xctool[76237:2732422] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Got error while trying to deserialize event 'User defaults from command line:': The data is not in the correct | |
| format.' | |
| *** First throw call stack: | |
| ( | |
| 0 CoreFoundation 0x00007fff94abf4f2 __exceptionPreprocess + 178 | |
| 1 libobjc.A.dylib 0x00007fff90e51f7e objc_exception_throw + 48 | |
| 2 CoreFoundation 0x00007fff94ac41ca +[NSException raise:format:arguments:] + 106 | |
| 3 Foundation 0x00007fff92dca1ee -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 169 |
| $ DYLD_FALLBACK_FRAMEWORK_PATH=/Applications/xcode_8_beta_4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks \ | |
| DYLD_FALLBACK_LIBRARY_PATH=/Applications/xcode_8_beta_4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib \ | |
| DYLD_ROOT_PATH=/Applications/xcode_8_beta_4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk \ | |
| DYLD_SHARED_REGION=avoid \ | |
| DYLD_INSERT_LIBRARIES=/Users/lawrencelomax/Library/Developer/Xcode/DerivedData/otest-shim-gzqfivxxroyopfctymsslntqaxit/Build/Products/Debug/lib/otest-shim-ios.dylib \ | |
| DYLD_PRINT_LIBRARIES=1 \ | |
| /Applications/xcode_8_beta_4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/xctest \ | |
| -XCTest All ~/src/FBSimulatorControl/XCTestBootstrapTests/Fixtures/SimpleTestTarget.xctest |
instruments-without-delay uses the DYLD_INSERT_LIBRARIES environment variable to shim from the instruments command line all the way down to ScriptAgentShim which is the iOS Simulator service responsible for interfacing UIAutomation JavaScript with the native UIAutomation.framework. It uses a stack of shims, starting at the instruments executable, going through Simulator.app. It is an essential part of ios-driver as it removes a pesky 200ms delay that drastically slows down the process of executing end-to-end tests. This is a fixed cost that would occur on every command.
Other than a few things being moved around and renamed in Xcode 7, there is the new issue of the codesigning of the Simulator app that triggers amfid whenever an unsigned image is loaded. This essentially means that we can't use DYLD_INSERT_LIBRARIES on the Simulator Process with SimShim
It is however, possible to inject these environment variables at the launchdaemon level. There is a plist fo
| [lawrencelomax:/usr/local] master+ ± brew install --debug fbsimctl | |
| /usr/local/Library/brew.rb (Formulary::FormulaLoader): loading /usr/local/Library/Taps/facebook/homebrew-fb/fbsimctl.rb | |
| ==> Installing fbsimctl from facebook/fb | |
| /usr/local/Library/brew.rb (Formulary::FormulaLoader): loading /usr/local/Library/Taps/homebrew/homebrew-core/Formula/carthage.rb | |
| /usr/local/Library/Homebrew/build.rb (Formulary::FromPathLoader): loading /usr/local/Library/Taps/facebook/homebrew-fb/fbsimctl.rb | |
| /usr/local/Library/Homebrew/build.rb (Formulary::FormulaLoader): loading /usr/local/Library/Taps/homebrew/homebrew-core/Formula/carthage.rb | |
| ==> Downloading file:///Users/lawrencelomax/Desktop/bad.zip | |
| ######################################################################## 100.0% | |
| Warning: Cannot verify integrity of fbsimctl-0.0.1.zip | |
| A checksum was not provided for this resource |
| class Fbsimctl < Formula | |
| desc "A Powerful Command Line for Managing iOS Simulators" | |
| homepage "https://github.com/facebook/FBSimulatorControl/" | |
| url "https://github.com/facebook/FBSimulatorControl/archive/master.zip" | |
| sha256 "" | |
| version "0.0.1" | |
| depends_on "carthage" | |
| depends_on :xcode => "7.0" |
| HTTP/1.1 200 OK | |
| Content-Length: 1809 | |
| Server: Swifter 1.1.2 | |
| Content-Type: application/json | |
| { | |
| "status" : "success", | |
| "events" : [ | |
| { | |
| "event_type" : "started", |