[Objc] add ios libuv timer test (#28570)

* use libuv in third party

* add ios libuv timer test

* name changed correspondingly

* format code

* address comment

* remove libuv patch
pull/29125/head
Hannah Shi 3 years ago committed by GitHub
parent dd22b85c0a
commit 842ed8d461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      bazel/grpc_deps.bzl
  2. 3
      src/objective-c/tests/ThirdPartyTests/Libuv/BUILD
  3. 64
      src/objective-c/tests/ThirdPartyTests/Libuv/LibuvTimerTests.m
  4. 61
      third_party/libuv.BUILD
  5. 9
      tools/run_tests/sanity/check_bazel_workspace.py

@ -181,8 +181,13 @@ def grpc_deps():
)
native.bind(
name = "uv",
actual = "@libuv//:libuv",
name = "libuv",
actual = "@com_github_libuv_libuv//:libuv",
)
native.bind(
name = "libuv_test",
actual = "@com_github_libuv_libuv//:libuv_test",
)
if "boringssl" not in native.existing_rules():
@ -388,9 +393,9 @@ def grpc_deps():
],
)
if "libuv" not in native.existing_rules():
if "com_github_libuv_libuv" not in native.existing_rules():
http_archive(
name = "libuv",
name = "com_github_libuv_libuv",
build_file = "@com_github_grpc_grpc//third_party:libuv.BUILD",
sha256 = "5ca4e9091f3231d8ad8801862dc4e851c23af89c69141d27723157776f7291e7",
strip_prefix = "libuv-02a9e1be252b623ee032a3137c0b0c94afbe6809",

@ -36,7 +36,8 @@ objc_library(
testonly = True,
srcs = glob(["*.m"]),
deps = [
"//external:uv",
"//external:libuv",
"//external:libuv_test",
],
)

@ -0,0 +1,64 @@
/*
*
* Copyright 2021 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#import <XCTest/XCTest.h>
#import "test/runner.h"
#import "test/task.h"
TEST_DECLARE(timer)
TEST_DECLARE(timer_init)
TEST_DECLARE(timer_again)
// TEST_DECLARE(timer_start_twice) //withhold until libuv patched
TEST_DECLARE(timer_order)
TEST_DECLARE(timer_huge_timeout)
TEST_DECLARE(timer_huge_repeat)
TEST_DECLARE(timer_run_once)
TEST_DECLARE(timer_from_check)
TEST_DECLARE(timer_is_closing)
TEST_DECLARE(timer_null_callback)
TEST_DECLARE(timer_early_check)
TASK_LIST_START
TEST_ENTRY(timer)
TEST_ENTRY(timer_init)
TEST_ENTRY(timer_again)
// TEST_ENTRY(timer_start_twice) //withhold until libuv patched
TEST_ENTRY(timer_order)
TEST_ENTRY(timer_huge_timeout)
TEST_ENTRY(timer_huge_repeat)
TEST_ENTRY(timer_run_once)
TEST_ENTRY(timer_from_check)
TEST_ENTRY(timer_is_closing)
TEST_ENTRY(timer_null_callback)
TEST_ENTRY(timer_early_check)
TASK_LIST_END
@interface LibuvTimerTests : XCTestCase
@end
@implementation LibuvTimerTests
- (void)testTimerAll {
for (task_entry_t* task = TASKS; task->main; task++) {
task->main();
}
}
@end

@ -324,3 +324,64 @@ cc_library(
"//visibility:public",
],
)
cc_library(
name = "libuv_test",
srcs = [
"test/test-timer.c",
"test/test-timer-again.c",
"test/test-timer-from-check.c",
],
hdrs = [
"test/runner.h",
"test/runner-unix.h",
"test/task.h",
],
includes = [
"include",
"src",
],
deps = [
":libuv"
],
copts = [
"-D_LARGEFILE_SOURCE",
"-D_FILE_OFFSET_BITS=64",
"-D_GNU_SOURCE",
"-pthread",
"--std=gnu89",
"-pedantic",
"-Wno-error",
"-Wno-strict-aliasing",
"-Wstrict-aliasing",
"-O2",
"-Wno-implicit-function-declaration",
"-Wno-unused-function",
"-Wno-unused-variable",
] + select({
":apple": [],
":windows": [
"-DWIN32_LEAN_AND_MEAN",
"-D_WIN32_WINNT=0x0600",
],
"//conditions:default": [
"-Wno-tree-vrp",
"-Wno-omit-frame-pointer",
"-D_DARWIN_USE_64_BIT_INODE=1",
"-D_DARWIN_UNLIMITED_SELECT=1",
],
}),
linkopts = select({
":windows": [
"-Xcrosstool-compilation-mode=$(COMPILATION_MODE)",
"-Wl,Iphlpapi.lib",
"-Wl,Psapi.lib",
"-Wl,User32.lib",
"-Wl,Userenv.lib",
],
"//conditions:default": [],
}),
visibility = [
"//visibility:public",
],
)

@ -48,10 +48,11 @@ _GRPC_DEP_NAMES = [
_TWISTED_TWISTED_DEP_NAME, _YAML_PYYAML_DEP_NAME,
_TWISTED_INCREMENTAL_DEP_NAME, _ZOPEFOUNDATION_ZOPE_INTERFACE_DEP_NAME,
_TWISTED_CONSTANTLY_DEP_NAME, 'io_bazel_rules_go',
'build_bazel_rules_apple', 'build_bazel_apple_support', 'libuv',
'com_googlesource_code_re2', 'bazel_gazelle', 'opencensus_proto',
'com_envoyproxy_protoc_gen_validate', 'com_google_googleapis',
'com_google_libprotobuf_mutator', 'com_github_cncf_udpa'
'build_bazel_rules_apple', 'build_bazel_apple_support',
'com_github_libuv_libuv', 'com_googlesource_code_re2', 'bazel_gazelle',
'opencensus_proto', 'com_envoyproxy_protoc_gen_validate',
'com_google_googleapis', 'com_google_libprotobuf_mutator',
'com_github_cncf_udpa'
]
_GRPC_BAZEL_ONLY_DEPS = [

Loading…
Cancel
Save