diff --git a/src/objective-c/grpc_objc_internal_library.bzl b/src/objective-c/grpc_objc_internal_library.bzl index edd0550752a..95443d80b61 100644 --- a/src/objective-c/grpc_objc_internal_library.bzl +++ b/src/objective-c/grpc_objc_internal_library.bzl @@ -31,6 +31,43 @@ load( "generate_objc_non_arc_srcs", "generate_objc_srcs", ) +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test") +load( + "@build_bazel_rules_apple//apple/testing/default_runner:ios_test_runner.bzl", + "ios_test_runner", +) + +# The default device type for ios objc unit tests +IOS_UNIT_TEST_DEVICE_TYPE = "iPhone 11" + +# The default iOS version for ios objc unit tests +# IOS_UNIT_TEST_OS_VERSION = "13.3" + +def grpc_objc_ios_unit_test( + name, + deps, + env = {}): + """ios unit test for running objc test suite on iOS simulator runner + + Args: + name: The name of the unit test target. + deps: The dependencies of the target. + env: Optional test environment variables passed to the test + """ + test_runner = "grpc_ios_sim_runner_" + name + ios_test_runner( + name = test_runner, + device_type = IOS_UNIT_TEST_DEVICE_TYPE, + # os_version = IOS_UNIT_TEST_OS_VERSION, + test_environment = env, + ) + + ios_unit_test( + name = name, + minimum_os_version = "9.0", + runner = test_runner, + deps = deps, + ) def proto_library_objc_wrapper( name, diff --git a/src/objective-c/tests/BUILD b/src/objective-c/tests/BUILD index 2875da78eb8..5cabdcb7ab9 100644 --- a/src/objective-c/tests/BUILD +++ b/src/objective-c/tests/BUILD @@ -17,6 +17,7 @@ load("//bazel:grpc_build_system.bzl", "grpc_sh_test") load( "//src/objective-c:grpc_objc_internal_library.bzl", + "grpc_objc_ios_unit_test", "grpc_objc_testing_library", "local_objc_grpc_library", "proto_library_objc_wrapper", @@ -183,10 +184,8 @@ grpc_objc_testing_library( hdrs = ["MacTests/StressTests.h"], ) -ios_unit_test( +grpc_objc_ios_unit_test( name = "UnitTests", - minimum_os_version = "9.0", - test_host = ":ios-host", deps = [ ":APIv2Tests-lib", ":ChannelPoolTest-lib",