Skip to content

Instantly share code, notes, and snippets.

View lawrencelomax's full-sized avatar

Lawrence Lomax lawrencelomax

View GitHub Profile
@lawrencelomax
lawrencelomax / gist:961c4d93ab3f1748570d2fadaea89c53
Created June 13, 2019 14:28
Failing close release grpclib example
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
@lawrencelomax
lawrencelomax / gist:c0df8f552e13ae023d7882aadd718531
Created June 13, 2019 14:27
Passing close and release of grpc stream
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
@lawrencelomax
lawrencelomax / gist:70660eec687869ec1873816050fbf396
Created August 9, 2016 09:11
Running a Simulator Logic Test with Dylib Overrides
$ 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
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
@lawrencelomax
lawrencelomax / gist:54d48d77158938258d0d7a4f8564ba89
Created July 12, 2016 07:44
homebrew recursively using install_name on nested Frameworks.
[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
HTTP/1.1 200 OK
Content-Length: 1809
Server: Swifter 1.1.2
Content-Type: application/json
{
"status" : "success",
"events" : [
{
"event_type" : "started",
@lawrencelomax
lawrencelomax / fbsimctl.rb
Last active July 8, 2016 17:22
WIP fbsimctl brew formula
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"
@lawrencelomax
lawrencelomax / gist:532d23905a27f97754b7
Created October 13, 2015 09:32
Xcode7 XCTest Launch
Oct 13 08:41:44 lawrencelom-mbp syncdefaultsd[10129]: (Note ) SYDAlwaysOnAccount: no account (null)
Oct 13 08:41:44 lawrencelom-mbp CoreSimulatorBridge[9632]: Requesting launch of com.example.apple-samplecode.TableSearch with options: {
arguments = (
"-NSTreatUnknownArgumentsAsOpen",
NO,
"-ApplePersistenceIgnoreState",
YES
);
environment = {
AppTargetLocation = "/Users/lawrencelomax/Library/Developer/Xcode/DerivedData/TableSearch-avrosnidtpyztnerixabsyhzbfvt/Build/Products/Debug-iphoneos/TableSearch.app/TableSearch";
2015-09-25 10:23:18.449 xctest[80351:2903136] Port: <AVCaptureInputPort: 0x10053ce60 (AVCaptureScreenInput: 0x10053ca50) vide 0000 enabled>
2015-09-25 10:23:18.934 xctest[80351:2903717] <AVCaptureVideoDataOutput: 0x10053bcb0> Did Sample
2015-09-25 10:23:19.000 xctest[80351:2903572] <AVCaptureVideoDataOutput: 0x10053bcb0> Did Sample
2015-09-25 10:23:19.046 xctest[80351:2903572] <AVCaptureVideoDataOutput: 0x10053bcb0> Did Sample
2015-09-25 10:23:19.113 xctest[80351:2903717] <AVCaptureVideoDataOutput: 0x10053bcb0> Did Sample
2015-09-25 10:23:19.201 xctest[80351:2903717] <AVCaptureVideoDataOutput: 0x10053bcb0> Did Sample
2015-09-25 10:23:19.246 xctest[80351:2903717] <AVCaptureVideoDataOutput: 0x10053bcb0> Did Sample
2015-09-25 10:23:19.335 xctest[80351:2903572] <AVCaptureVideoDataOutput: 0x10053bcb0> Did Sample
2015-09-25 10:23:19.380 xctest[80351:2903717] <AVCaptureVideoDataOutput: 0x10053bcb0> Did Sample
2015-09-25 10:23:19.469 xctest[80351:2903572] <AVCaptureVideoDataOutput: 0x10053bcb0> Did Sample
@lawrencelomax
lawrencelomax / Instructions.md
Last active July 27, 2016 07:52
instruments-without-delay on Xcode 7

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