grpc / grpc-ios

gRPC for iOS
Apache License 2.0
39 stars 22 forks source link

Bazel migration for ObjC Unit Test Suite #74

Closed dennycd closed 2 years ago

dennycd commented 2 years ago

Migrate existing gRPC ObjC unit test suite to bazel-based test

Current Test Setup

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

New Setup

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


cc @jtattermusch

jtattermusch commented 2 years ago

Any progress here? I had trouble building ObjC with bazel on my mac machine, so it would be good to verify what's needed here by trying it out.

HannahShiSFB commented 2 years ago

What problem did you meet?

jtattermusch commented 2 years ago

I ran (the InteropTests is just one of the targets I tried randomly): tools/bazel build //src/objective-c/tests:InteropTests

Which gave me:

ERROR: /private/var/tmp/_bazel_jtattermusch/4690b3cecd520a08d66e7529f10bff45/external/local_config_cc/BUILD:48:19: in cc_toolchain_suite rule @local_config_cc//:toolchain: cc_toolchain_suite '@local_config_cc//:toolchain' does not contain a toolchain for cpu 'ios_x86_64'

ERROR: Analysis of target '//src/objective-c/tests:InteropTests' failed; build aborted: Analysis of target '@local_config_cc//:toolchain' failed

And I got stuck there. Do you know how I can fix this?

Update: looks like I was able to fix by making sure Xcode is installed and then running tools/bazel clean --expunge (it wouldn't work without that).

jtattermusch commented 2 years ago

Looks like https://github.com/grpc/grpc/pull/29599 basically addresses this (it runs //src/objective-c/tests:UnitTests bazel target), but someone familiar with ObjC tests should doublecheck that.

jtattermusch commented 2 years ago

@dennycd should we close this? (see my previous comment)