| 1 |
# Copyright 2021 gRPC authors. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
|
| 15 |
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package") |
| 16 |
load("//test/core/util:grpc_fuzzer.bzl", "grpc_proto_fuzzer") |
| 17 |
|
| 18 |
licenses(["notice"]) |
| 19 |
|
| 20 |
grpc_package(name = "test/core/resource_quota") |
| 21 |
|
| 22 |
grpc_cc_test( |
| 23 |
name = "arena_test", |
| 24 |
srcs = ["arena_test.cc"], |
| 25 |
external_deps = [ |
| 26 |
"absl/strings", |
| 27 |
"gtest", |
| 28 |
], |
| 29 |
language = "C++", |
| 30 |
tags = [ |
| 31 |
"resource_quota_test", |
| 32 |
], |
| 33 |
uses_event_engine = False, |
| 34 |
uses_polling = False, |
| 35 |
deps = [ |
| 36 |
"//:event_engine_base_hdrs", |
| 37 |
"//:exec_ctx", |
| 38 |
"//:gpr", |
| 39 |
"//:ref_counted_ptr", |
| 40 |
"//src/core:arena", |
| 41 |
"//src/core:resource_quota", |
| 42 |
"//test/core/util:grpc_test_util_unsecure", |
| 43 |
], |
| 44 |
) |
| 45 |
|
| 46 |
grpc_cc_library( |
| 47 |
name = "call_checker", |
| 48 |
testonly = True, |
| 49 |
hdrs = ["call_checker.h"], |
| 50 |
language = "c++", |
| 51 |
deps = ["//:gpr"], |
| 52 |
) |
| 53 |
|
| 54 |
grpc_cc_test( |
| 55 |
name = "memory_quota_test", |
| 56 |
srcs = ["memory_quota_test.cc"], |
| 57 |
external_deps = ["gtest"], |
| 58 |
language = "c++", |
| 59 |
tags = [ |
| 60 |
"cpu:10", |
| 61 |
"resource_quota_test", |
| 62 |
], |
| 63 |
uses_event_engine = False, |
| 64 |
uses_polling = False, |
| 65 |
deps = [ |
| 66 |
"call_checker", |
| 67 |
"//:exec_ctx", |
| 68 |
"//src/core:memory_quota", |
| 69 |
"//src/core:slice_refcount", |
| 70 |
"//test/core/util:grpc_test_util_unsecure", |
| 71 |
], |
| 72 |
) |
| 73 |
|
| 74 |
grpc_cc_test( |
| 75 |
name = "periodic_update_test", |
| 76 |
srcs = ["periodic_update_test.cc"], |
| 77 |
external_deps = ["gtest"], |
| 78 |
flaky = True, |
| 79 |
language = "c++", |
| 80 |
uses_event_engine = False, |
| 81 |
uses_polling = False, |
| 82 |
deps = [ |
| 83 |
"//:exec_ctx", |
| 84 |
"//:gpr", |
| 85 |
"//src/core:periodic_update", |
| 86 |
], |
| 87 |
) |
| 88 |
|
| 89 |
grpc_cc_test( |
| 90 |
name = "thread_quota_test", |
| 91 |
srcs = ["thread_quota_test.cc"], |
| 92 |
external_deps = ["gtest"], |
| 93 |
language = "c++", |
| 94 |
uses_event_engine = False, |
| 95 |
uses_polling = False, |
| 96 |
deps = ["//src/core:thread_quota"], |
| 97 |
) |
| 98 |
|
| 99 |
grpc_cc_test( |
| 100 |
name = "resource_quota_test", |
| 101 |
srcs = ["resource_quota_test.cc"], |
| 102 |
external_deps = ["gtest"], |
| 103 |
language = "c++", |
| 104 |
tags = [ |
| 105 |
"resource_quota_test", |
| 106 |
], |
| 107 |
uses_event_engine = False, |
| 108 |
uses_polling = False, |
| 109 |
deps = [ |
| 110 |
"//src/core:resource_quota", |
| 111 |
"//test/core/util:grpc_test_util_unsecure", |
| 112 |
], |
| 113 |
) |
| 114 |
|
| 115 |
grpc_cc_test( |
| 116 |
name = "memory_quota_stress_test", |
| 117 |
srcs = ["memory_quota_stress_test.cc"], |
| 118 |
external_deps = [ |
| 119 |
"absl/base:core_headers", |
| 120 |
"absl/strings", |
| 121 |
"absl/types:optional", |
| 122 |
"gtest", |
| 123 |
], |
| 124 |
language = "c++", |
| 125 |
# We only run this test under Linux, and really only care about the |
| 126 |
# TSAN results. |
| 127 |
tags = [ |
| 128 |
"no_mac", |
| 129 |
"no_windows", |
| 130 |
"resource_quota_test", |
| 131 |
], |
| 132 |
uses_event_engine = False, |
| 133 |
uses_polling = False, |
| 134 |
deps = [ |
| 135 |
"//:exec_ctx", |
| 136 |
"//:gpr", |
| 137 |
"//src/core:event_engine_memory_allocator", |
| 138 |
"//src/core:memory_quota", |
| 139 |
"//test/core/util:grpc_test_util_unsecure", |
| 140 |
], |
| 141 |
) |
| 142 |
|
| 143 |
grpc_proto_fuzzer( |
| 144 |
name = "memory_quota_fuzzer", |
| 145 |
srcs = ["memory_quota_fuzzer.cc"], |
| 146 |
corpus = "memory_quota_fuzzer_corpus", |
| 147 |
external_deps = [ |
| 148 |
"absl/status", |
| 149 |
"absl/strings", |
| 150 |
"absl/types:optional", |
| 151 |
], |
| 152 |
language = "C++", |
| 153 |
proto = "memory_quota_fuzzer.proto", |
| 154 |
tags = ["no_windows"], |
| 155 |
uses_event_engine = False, |
| 156 |
uses_polling = False, |
| 157 |
deps = [ |
| 158 |
"call_checker", |
| 159 |
"//:debug_location", |
| 160 |
"//:exec_ctx", |
| 161 |
"//:gpr", |
| 162 |
"//:grpc_trace", |
| 163 |
"//src/core:closure", |
| 164 |
"//src/core:error", |
| 165 |
"//src/core:event_engine_memory_allocator", |
| 166 |
"//src/core:memory_quota", |
| 167 |
"//src/core:useful", |
| 168 |
], |
| 169 |
) |