grpc / grpc-ios Goto Github PK
View Code? Open in Web Editor NEWgRPC for iOS
License: Apache License 2.0
gRPC for iOS
License: Apache License 2.0
Create gRPC-iOS release branching and release tags
At the moment, post pod installation, all gRPC/ObjcC pod is using prepare_command to rewrite c++ core / external lib's include headers in order to accomodate iOS/Xcode search path. This creates various issues and very error prone.
Instead we should look at avoid modifying the source and adjust build header search path at Cocoapoad/Xcode configuration level.
This also requires importing absl:random headers on iOS
Migrate and/or create build test coverage for pods managed by iOS/ObjC stack, these includes
The build test should be triggered in the following brach and scenarios
As seem in sample below
Also can be repro by manually triggering it with running the test script
grpc/tools/internal_ci/macos/grpc_run_bazel_cpp_ios_tests.sh
or
tools/bazel test --test_summary=detailed --test_output=all //test/cpp/server:authorization_policy_provider_test_on_ios
Clean up and removal of GRPCCallSafety enum after idempotent/cacheable options are removed after grpc/grpc#28922.
Switching pod release from grpc/grpc to grpc/grpc-ios for the following c-core Pod
gRPC-C++ and gRPC-Core pod should still be present in grpc/grpc as that correctly reflects the dependency structure .
Sample failure log
First introduced via PR
Crash on test case DuplicateHeadersAreMerged with the following error
Test Case '-[GTMGoogleTestRunner RlsEnd2endTest::DuplicateHeadersAreMerged]' started.
E1025 11:55:03.334006000 4675941824 lb_policy_registry.cc:45] assertion failed: strcmp(factories_[i]->name(), factory->name()) != 0
Child process terminated with signal 6: Abort trap
2021-10-25 18:55:03,337 Deleting simulator B98849B0-9930-4F52-9042-26010265B1F5 asynchronously.
2021-10-25 18:55:03,343 Done.
================================================================================
Target //test/cpp/end2end:rls_end2end_test_on_ios up-to-date:
bazel-bin/test/cpp/end2end/rls_end2end_test_on_ios
bazel-out/applebin_ios-ios_x86_64-fastbuild-ST-e637a0adc749/bin/test/cpp/end2end/rls_end2end_test_on_ios.zip
INFO: Elapsed time: 17.652s, Critical Path: 16.50s
INFO: 55 processes: 31 internal, 23 darwin-sandbox, 1 local.
INFO: Build completed, 1 test FAILED, 55 total actions
//test/cpp/end2end:rls_end2end_test_on_ios FAILED in 2.3s
ERROR .test/cpp/end2end/rls_end2end_test_on_ios (0.0s)
Umbrella issue for tracking and grouping PRs updating V2.x APIs
Fri Sep 17 00:56:37 PDT 2021 - Test Case '-[GRPCClientTests testTimeoutBackoff2]' started.
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.576055-0700 xctest[41153:78530] [] nw_socket_handle_socket_event [C22:1] Socket SO_ERROR [61: Connection refused]
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.577751-0700 xctest[41153:78530] [] nw_connection_get_connected_socket [C22] Client called nw_connection_get_connected_socket on unconnected nw_connection
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.582215-0700 xctest[41153:78530] TCP Conn 0x7fd4a45aaa70 Failed : error 0:61 [61]
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.595044-0700 xctest[41153:78530] [] nw_socket_handle_socket_event [C23:1] Socket SO_ERROR [61: Connection refused]
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.598824-0700 xctest[41153:78732] [] nw_connection_get_connected_socket [C23] Client called nw_connection_get_connected_socket on unconnected nw_connection
Fri Sep 17 00:56:37 PDT 2021 - 2021-09-17 00:56:37.603653-0700 xctest[41153:78732] TCP Conn 0x7fd4a45adee0 Failed : error 0:61 [61]
Fri Sep 17 00:56:38 PDT 2021 - /Volumes/BuildData/tmpfs/src/github/grpc/workspace_objc_macos_opt_native/src/objective-c/tests/UnitTests/GRPCClientTests.m:589: error: -[GRPCClientTests testTimeoutBackoff2] : (([[NSDate date] timeIntervalSinceDate:startTime]) less than (maxConnectTime + kMargin)) failed: ("0.843600988388") is not less than ("0.8")
Fri Sep 17 00:56:38 PDT 2021 - Test Case '-[GRPCClientTests testTimeoutBackoff2]' failed (0.847 seconds).
At the moment, generated_projects.sh will automatically add new source file to the main spec, however, additional podspec imports may still be needed to avoid linkage-time symbol missing issue. See PR example here: grpc/grpc#27032
Check if there is a way to automatically detect missing imports or surface up the missing steps to devs.
xxhash Cyan4973/xxHash#601 have fixed Wdocumentation error during grpc ios compile Cyan4973/xxHash#590
xxhash.h patch no longer needed
General clean up and refactoring of existing Interop test suite 's structure
As seem in grpc/grpc#27662, it looks like current suite of kokoro test didn't catch compilation errors as seem locally on dev machine (Xcode 13, clang 5.5, Mac OSX 11.6)
At the moment, Libuv-gRPC is pined to version 1.37. Latest libuv 1.42 is broken on iOS build.
Add goto doc for how to build gRPC native c-core for iOS.
Create and/or migrate SPM build test to verify SPM iOS build. Existing build test from gRPC located at
The build test should be triggered for the following branch and scenarios
Migrate existing gRPC ObjC unit test suite to bazel-based test
Current test utilize a Cocoapod project target for unit test, and integrated with kokoro CI via script
The script involves two major stage: pod installation and xcodebuild test run.
Its corresponding kokoro test components at
We will define new ios_unit_test target for Unit Test and may utilize the following script for bazel integration w/ kokoro
Also we should enable GRPC_VERBOSITY=debug environment variable when running these tests
Observed a number of test breakage on cpp cronet test targets
Looks like all test cases crashed with the following error messages
Wed Oct 20 09:56:47 PDT 2021 - 2021-10-20 09:56:47.779436-0700 xctest[31851:63940] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/kbuilder/Library/Developer/CoreSimulator/Devices/4F9376BD-4079-49A7-BB18-AED93CEEBE0B/data/Library/Cookies/com.apple.dt.xctest.tool.binarycookies
Wed Oct 20 09:56:47 PDT 2021 - xctest(31851,0x11151f5c0) malloc: *** error for object 0x2000000000000000: pointer being freed was not allocated
Wed Oct 20 09:56:47 PDT 2021 - xctest(31851,0x11151f5c0) malloc: *** set a breakpoint in malloc_error_break to debug
Wed Oct 20 09:58:30 PDT 2021 -
Wed Oct 20 09:58:30 PDT 2021 - Restarting after unexpected exit or crash in CppCronetEnd2EndTests/testBidiStream; summary will include totals from previous launches.
A few errors message related to cronet failure
ed Oct 20 09:56:47 PDT 2021 - [1020/095647.771493:ERROR:cronet_environment.mm(157)] Can not start NetLog to /Users/kbuilder/Library/Developer/CoreSimulator/Devices/4F9376BD-4079-49A7-BB18-AED93CEEBE0B/data/Documents/cronet_netlog.json: Undefined error: 0
Umbrella task tracking Swift Package Manager implementation support for grpc-ios
For verifying libuv timer's usability for iOS, add unit test coverage to EventEngineTimerTests test suite. This can closely mirror existing c-core's test logic at
Note that in order to test libuv timer, it requires the libuv-timer impl PR to land and instantiation of grpc_event_engine::experimental::LibuvEventEngine as mentioned in libuv_event_engine_test.cc
as mentioned in grpc/grpc#28570, patch libuv timer test with proper setup/tear down logic for static variables so that the test behavior doesn't break across platforms.
Cocoapod Targets
Also we should enable GRPC_VERBOSITY=debug environment variable when running these tests
See samples from run
The following ObjC test failed
With assert at
Update bazel-based gRPC ObjC test to support generating structured test logs that can be rendered by kokoro UI. Specifically, look into existing c++'s bazel test scripts examples
Prior PR for structured test results at
Currently our iOS binary size diff script (binary_size.py) builds sample app via build_one_example.sh script which is cocoapod & xcodebuild-based. Switching to bazel based build (build_one_example_bazel.sh) may help significantly speed up the build time.
As discussed in grpc/grpc#29377
Example issue seem here
Current working assumption is bazel's ios_unit_test using GMT test runner. reloads test dylib per test run and triggers gtest's test suite setup to execute per test.
Follow up to grpc/grpc#28029 for adding internal kokoro run job
Automate Cocoapod release with the following steps
This should also coordinates w/ gRPC-iOS cocoapod migration so that
Investigate build timeout and adjust. Failure report samples
observing high frequent cronet test time out on both pre-submit and prod/master's grpc_basictests_objc_ios test suite. One of the following sample log captures the issue from cronet test suite crash due to python port server not running. XCTest attempts to restart the test and eventually leads to timeout being reported
Mon Nov 1 11:37:54 PDT 2021 - Test Case '-[CoreCronetEnd2EndTests testCancelAfterClientDone]' started.
Mon Nov 1 11:38:04 PDT 2021 - gRPC tests require a helper port server to allocate ports used
Mon Nov 1 11:38:04 PDT 2021 - during the test.
Mon Nov 1 11:38:04 PDT 2021 -
Mon Nov 1 11:38:04 PDT 2021 - This server is not currently running.
Mon Nov 1 11:38:04 PDT 2021 -
Mon Nov 1 11:38:04 PDT 2021 - To start it, run tools/run_tests/start_port_server.py
Mon Nov 1 11:38:04 PDT 2021 -
Mon Nov 1 11:38:25 PDT 2021 -
Mon Nov 1 11:38:25 PDT 2021 - Restarting after unexpected exit or crash in CoreCronetEnd2EndTests/testCancelAfterClientDone; summary will include totals from previous launches.
Mon Nov 1 11:38:25 PDT 2021 -
most sample test log doesn't capture the above crash, but instead reporting time out with the last test suite being ios cronet test,
2021-11-01 14:50:10,768 START: ios-test-cronettests
2021-11-01 15:16:45,843 TIMEOUT: run_tests_objc_macos_opt_native [pid=3790, time=5402.6sec]
2021-11-01 15:16:45,856 FAILED: Some run_tests.py instances have failed.
This is followed by another script check agains the port server existence w/ exit failure
+ FAILED=true
+ ps aux
+ grep 'port_server\.py'
+ awk '{print $2}'
+ xargs kill -9
...
real 0m13.275s
user 0m0.359s
sys 0m8.198s
+ '[' true '!=' '' ']'
+ exit 1
Two alternative ways of uploading our test results to BQ
Moving all GRPCCallOption & GRPCMutableCallOptions properties to nonatomic since these are basic data model types and atomic access does not add much value to it.
Setup bazel ios_unit_test and test against C-core's existing event engine test suite
Existing c-core unit test on iOS is done via the following bazel rule
on iOS/Mac, we run the following script to trigger bazel test on kokoro CI
This is test against all ios_unit_test targets under //test/cpp. We can setup a similar structure for event engine test target
Sample instruction to run bazel ios test in command line
tools/bazel query "kind(ios_unit_test, tests(//test/core/event_engine/...))"
tools/bazel test --test_summary=detailed --test_output=all //test/core/event_engine:endpoint_config_test_on_ios
To make iOS bazel test behaves similar to other language
e.g. grpc/grpc#28570
similar iOS test behavior diffs issue
#41
Note that all upstream pod specs should be pointing to local shallow copy, or a mgirated pod that has been migrated or released from gRPC-iOS.
Look at how we can have better reuse of existing test logic from c-core. In Event Engine test, for example, one possibility is to expose its test util via test-only public headers and call from iOS test. Some of these might not be possible as they are based on gtest.
An existing similar example is our current Cronet's end2end test setup
Looks like we maintained a local copy of Protobuf-C++ podspec in grpc repo, which can easily get out of sync with the official one
sample build break
Our CFStream test suite currently have a few issues that need to be improved
In addition, the current test suite is an objc translation from existing c-core test
We should revisit the test setup to run c-core's test setup using the corresponding ios unit test target instead
Additional todos for CFStream Test Update
Currently if we modify gRPC-Core's BoringSSL & Libuv version number w/o publishing the pod for the new version, our iOS sample app project will break since the next pod install won't be able to find the updated version from the pod trunk (see example grpc/grpc#27710). A few action items
Migrate existing Cocoapod based Interop test suite to bazel
Existing pod test target defined in
Its corresponding kokoro run component at
Also we should enable GRPC_VERBOSITY=debug environment variable when running these tests
Note that all upstream pod specs should be pointing to local shallow copy, or a mgirated pod that has been migrated or released from gRPC-iOS.
Currently a few of our cocoapod doesn't have a default landing page on cocoapod trunk. Visiting the trunk page will automatically forward to homepage URL
Investigate adding a landing page for our pods
Currently as 1st step in libuv PR , we hard-coded libuv source in podspec. Ideally these are pulled from libuv.BUILD rules and tunneled through its template files and auto-populated (alongside build flags) via buildgen script. This reduce maintenance overhead.
Create SPM ObjC target for the following corresponding pod target
These targets should be under top level Package.swift and upstream dependencies should be referencing grpc native c-core's shallow content instead of pulling from gRPC c-core repo.
See the following sample
Wed Sep 15 21:00:52 PDT 2021 - Test Case '-[CallAPIv2Tests testMetadata]' started.
Wed Sep 15 21:01:01 PDT 2021 - /Volumes/BuildData/tmpfs/src/github/grpc/workspace_objc_macos_opt_native/src/objective-c/tests/UnitTests/APIv2Tests.m:205: error: -[CallAPIv2Tests testMetadata] : Asynchronous wait failed: Exceeded timeout of 8 seconds, with unfulfilled expectations: "RPC unauthorized.".
Wed Sep 15 21:01:01 PDT 2021 - Test Case '-[CallAPIv2Tests testMetadata]' failed (8.465 seconds).
In addition, testErrorDebugInformation raises NSInternalInconsistencyException as follows
Wed Sep 15 21:01:15 PDT 2021 - 2021-09-15 21:01:15.822864-0700 xctest[41458:80151] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to report test assertion failure '((error.code) equal to (16)) failed: throwing "Unable to report test assertion failure '((error.code) equal to (16)) failed: ("14") is not equal to ("16") - Finished with unexpected error: Error Domain=io.grpc Code=14 "{"created":"@1631764875.804842000","description":"Error received from peer ipv6:[2607:f8b0:4002:c11::451]:443","file":"/Volumes/BuildData/tmpfs/src/github/grpc/workspace_objc_macos_opt_native/src/core/lib/surface/call.cc","file_line":1074,"grpc_message":"502:Bad Gateway","grpc_status":14}" UserInfo={io.grpc.HeadersKey={
Also looks like we have
Add libuv-based unit test on iOS core test for DNS resolver. This make sure the API that core uses can work. Unit test logic can be sampled from a core subset from
Libuv's DNS utility API
On GRPCCallOptions, the following properties are currently not copied over
In addition, these are currently marked readwrite on immutable option class GRPCCallOptions, and should be moved to GRPCMutableCallOptions instead.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.