aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/codegen/core/gen_header_frame.py95
-rwxr-xr-xtools/codegen/core/gen_static_metadata.py2
-rwxr-xr-xtools/distrib/check_copyright.py2
-rw-r--r--tools/doxygen/Doxyfile.c++2
-rw-r--r--tools/doxygen/Doxyfile.c++.internal8
-rw-r--r--tools/doxygen/Doxyfile.core1
-rw-r--r--tools/doxygen/Doxyfile.core.internal1
-rwxr-xr-xtools/profiling/microbenchmarks/bm2bq.py9
-rw-r--r--tools/run_tests/generated/sources_and_headers.json159
-rw-r--r--tools/run_tests/generated/tests.json88
-rwxr-xr-xtools/run_tests/run_microbenchmark.py21
-rwxr-xr-xtools/run_tests/run_tests.py45
12 files changed, 298 insertions, 135 deletions
diff --git a/tools/codegen/core/gen_header_frame.py b/tools/codegen/core/gen_header_frame.py
index ee476267f2..c92ff3c579 100755
--- a/tools/codegen/core/gen_header_frame.py
+++ b/tools/codegen/core/gen_header_frame.py
@@ -37,8 +37,41 @@
import json
import sys
+import argparse
-set_end_stream = len(sys.argv) > 1 and sys.argv[1] == '--set_end_stream'
+def append_never_indexed(payload_line, n, count, key, value):
+ payload_line.append(0x10)
+ assert(len(key) <= 126)
+ payload_line.append(len(key))
+ payload_line.extend(ord(c) for c in key)
+ assert(len(value) <= 126)
+ payload_line.append(len(value))
+ payload_line.extend(ord(c) for c in value)
+
+def append_inc_indexed(payload_line, n, count, key, value):
+ payload_line.append(0x40)
+ assert(len(key) <= 126)
+ payload_line.append(len(key))
+ payload_line.extend(ord(c) for c in key)
+ assert(len(value) <= 126)
+ payload_line.append(len(value))
+ payload_line.extend(ord(c) for c in value)
+
+def append_pre_indexed(payload_line, n, count, key, value):
+ payload_line.append(0x80 + 61 + count - n)
+
+_COMPRESSORS = {
+ 'never': append_never_indexed,
+ 'inc': append_inc_indexed,
+ 'pre': append_pre_indexed,
+}
+
+argp = argparse.ArgumentParser('Generate header frames')
+argp.add_argument('--set_end_stream', default=False, action='store_const', const=True)
+argp.add_argument('--no_framing', default=False, action='store_const', const=True)
+argp.add_argument('--compression', choices=sorted(_COMPRESSORS.keys()), default='never')
+argp.add_argument('--hex', default=False, action='store_const', const=True)
+args = argp.parse_args()
# parse input, fill in vals
vals = []
@@ -52,38 +85,37 @@ for line in sys.stdin:
vals.append((key, value))
# generate frame payload binary data
-payload_bytes = [[]] # reserve space for header
+payload_bytes = []
+if not args.no_framing:
+ payload_bytes.append([]) # reserve space for header
payload_len = 0
+n = 0
for key, value in vals:
payload_line = []
- payload_line.append(0x10)
- assert(len(key) <= 126)
- payload_line.append(len(key))
- payload_line.extend(ord(c) for c in key)
- assert(len(value) <= 126)
- payload_line.append(len(value))
- payload_line.extend(ord(c) for c in value)
+ _COMPRESSORS[args.compression](payload_line, n, len(vals), key, value)
+ n += 1
payload_len += len(payload_line)
payload_bytes.append(payload_line)
# fill in header
-flags = 0x04 # END_HEADERS
-if set_end_stream:
- flags |= 0x01 # END_STREAM
-payload_bytes[0].extend([
- (payload_len >> 16) & 0xff,
- (payload_len >> 8) & 0xff,
- (payload_len) & 0xff,
- # header frame
- 0x01,
- # flags
- flags,
- # stream id
- 0x00,
- 0x00,
- 0x00,
- 0x01
-])
+if not args.no_framing:
+ flags = 0x04 # END_HEADERS
+ if args.set_end_stream:
+ flags |= 0x01 # END_STREAM
+ payload_bytes[0].extend([
+ (payload_len >> 16) & 0xff,
+ (payload_len >> 8) & 0xff,
+ (payload_len) & 0xff,
+ # header frame
+ 0x01,
+ # flags
+ flags,
+ # stream id
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x01
+ ])
hex_bytes = [ord(c) for c in "abcdefABCDEF0123456789"]
@@ -105,6 +137,11 @@ def esc_c(line):
return out + "\""
# dump bytes
-for line in payload_bytes:
- print esc_c(line)
-
+if args.hex:
+ all_bytes = []
+ for line in payload_bytes:
+ all_bytes.extend(line)
+ print '{%s}' % ', '.join('0x%02x' % c for c in all_bytes)
+else:
+ for line in payload_bytes:
+ print esc_c(line)
diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py
index 4703708aaa..109701f740 100755
--- a/tools/codegen/core/gen_static_metadata.py
+++ b/tools/codegen/core/gen_static_metadata.py
@@ -123,7 +123,6 @@ CONFIG = [
('if-unmodified-since', ''),
('last-modified', ''),
('lb-token', ''),
- ('lb-cost-bin', ''),
('link', ''),
('location', ''),
('max-forwards', ''),
@@ -160,7 +159,6 @@ METADATA_BATCH_CALLOUTS = [
'user-agent',
'host',
'lb-token',
- 'lb-cost-bin',
]
COMPRESSION_ALGORITHMS = [
diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py
index c993407eb2..611a9f40ae 100755
--- a/tools/distrib/check_copyright.py
+++ b/tools/distrib/check_copyright.py
@@ -106,6 +106,8 @@ _EXEMPT = frozenset((
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h',
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c',
+ 'src/cpp/server/health/health.pb.h',
+ 'src/cpp/server/health/health.pb.c',
# An older file originally from outside gRPC.
'src/php/tests/bootstrap.php',
diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++
index 0706cdca0f..551ba46b3b 100644
--- a/tools/doxygen/Doxyfile.c++
+++ b/tools/doxygen/Doxyfile.c++
@@ -795,9 +795,11 @@ include/grpc++/client_context.h \
include/grpc++/completion_queue.h \
include/grpc++/create_channel.h \
include/grpc++/create_channel_posix.h \
+include/grpc++/ext/health_check_service_server_builder_option.h \
include/grpc++/generic/async_generic_service.h \
include/grpc++/generic/generic_stub.h \
include/grpc++/grpc++.h \
+include/grpc++/health_check_service_interface.h \
include/grpc++/impl/call.h \
include/grpc++/impl/client_unary_call.h \
include/grpc++/impl/codegen/async_stream.h \
diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal
index cb0a3e55f8..0d7ddfc6d6 100644
--- a/tools/doxygen/Doxyfile.c++.internal
+++ b/tools/doxygen/Doxyfile.c++.internal
@@ -795,9 +795,11 @@ include/grpc++/client_context.h \
include/grpc++/completion_queue.h \
include/grpc++/create_channel.h \
include/grpc++/create_channel_posix.h \
+include/grpc++/ext/health_check_service_server_builder_option.h \
include/grpc++/generic/async_generic_service.h \
include/grpc++/generic/generic_stub.h \
include/grpc++/grpc++.h \
+include/grpc++/health_check_service_interface.h \
include/grpc++/impl/call.h \
include/grpc++/impl/client_unary_call.h \
include/grpc++/impl/codegen/async_stream.h \
@@ -913,6 +915,12 @@ src/cpp/server/async_generic_service.cc \
src/cpp/server/create_default_thread_pool.cc \
src/cpp/server/dynamic_thread_pool.cc \
src/cpp/server/dynamic_thread_pool.h \
+src/cpp/server/health/default_health_check_service.cc \
+src/cpp/server/health/default_health_check_service.h \
+src/cpp/server/health/health.pb.c \
+src/cpp/server/health/health.pb.h \
+src/cpp/server/health/health_check_service.cc \
+src/cpp/server/health/health_check_service_server_builder_option.cc \
src/cpp/server/insecure_server_credentials.cc \
src/cpp/server/secure_server_credentials.cc \
src/cpp/server/secure_server_credentials.h \
diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core
index 060e09869d..896ee0213b 100644
--- a/tools/doxygen/Doxyfile.core
+++ b/tools/doxygen/Doxyfile.core
@@ -827,6 +827,7 @@ include/grpc/impl/codegen/sync_posix.h \
include/grpc/impl/codegen/sync_posix.h \
include/grpc/impl/codegen/sync_windows.h \
include/grpc/impl/codegen/sync_windows.h \
+include/grpc/load_reporting.h \
include/grpc/slice.h \
include/grpc/slice_buffer.h \
include/grpc/status.h \
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index ce7e103647..10801254ef 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -827,6 +827,7 @@ include/grpc/impl/codegen/sync_posix.h \
include/grpc/impl/codegen/sync_posix.h \
include/grpc/impl/codegen/sync_windows.h \
include/grpc/impl/codegen/sync_windows.h \
+include/grpc/load_reporting.h \
include/grpc/slice.h \
include/grpc/slice_buffer.h \
include/grpc/status.h \
diff --git a/tools/profiling/microbenchmarks/bm2bq.py b/tools/profiling/microbenchmarks/bm2bq.py
index 8f728b5c3f..d31921feef 100755
--- a/tools/profiling/microbenchmarks/bm2bq.py
+++ b/tools/profiling/microbenchmarks/bm2bq.py
@@ -66,6 +66,8 @@ columns = [
('cli_stream_stalls_per_iteration', 'float'),
('svr_transport_stalls_per_iteration', 'float'),
('svr_stream_stalls_per_iteration', 'float'),
+ ('atm_cas_per_iteration', 'float'),
+ ('atm_add_per_iteration', 'float')
]
if sys.argv[1] == '--schema':
@@ -102,6 +104,7 @@ bm_specs = {
'tpl': [],
'dyn': ['request_size', 'bandwidth_kilobits'],
},
+<<<<<<< HEAD
'BM_ErrorStringOnNewError': {
'tpl': ['fixture'],
'dyn': [],
@@ -126,6 +129,10 @@ bm_specs = {
'tpl': ['fixture'],
'dyn': [],
},
+ 'BM_IsolatedFilter' : {
+ 'tpl': ['fixture', 'client_mutator'],
+ 'dyn': [],
+ }
}
def numericalize(s):
@@ -182,7 +189,7 @@ def parse_name(name):
for bm in js['benchmarks']:
context = js['context']
if 'label' in bm:
- labels_list = [s.split(':') for s in bm['label'].split(' ')]
+ labels_list = [s.split(':') for s in bm['label'].strip().split(' ') if len(s) and s[0] != '#']
for el in labels_list:
el[0] = el[0].replace('/iter', '_per_iteration')
labels = dict(labels_list)
diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json
index cb1833dfb5..8403f0664b 100644
--- a/tools/run_tests/generated/sources_and_headers.json
+++ b/tools/run_tests/generated/sources_and_headers.json
@@ -1299,57 +1299,6 @@
"headers": [],
"is_filegroup": false,
"language": "c",
- "name": "internal_api_canary_iomgr_test",
- "src": [
- "test/core/internal_api_canaries/iomgr.c"
- ],
- "third_party": false,
- "type": "target"
- },
- {
- "deps": [
- "gpr",
- "gpr_test_util",
- "grpc",
- "grpc_test_util"
- ],
- "headers": [],
- "is_filegroup": false,
- "language": "c",
- "name": "internal_api_canary_support_test",
- "src": [
- "test/core/internal_api_canaries/iomgr.c"
- ],
- "third_party": false,
- "type": "target"
- },
- {
- "deps": [
- "gpr",
- "gpr_test_util",
- "grpc",
- "grpc_test_util"
- ],
- "headers": [],
- "is_filegroup": false,
- "language": "c",
- "name": "internal_api_canary_transport_test",
- "src": [
- "test/core/internal_api_canaries/iomgr.c"
- ],
- "third_party": false,
- "type": "target"
- },
- {
- "deps": [
- "gpr",
- "gpr_test_util",
- "grpc",
- "grpc_test_util"
- ],
- "headers": [],
- "is_filegroup": false,
- "language": "c",
"name": "invalid_call_argument_test",
"src": [
"test/core/end2end/invalid_call_argument_test.c"
@@ -2396,6 +2345,46 @@
"headers": [],
"is_filegroup": false,
"language": "c++",
+ "name": "bm_chttp2_hpack",
+ "src": [
+ "test/cpp/microbenchmarks/bm_chttp2_hpack.cc"
+ ],
+ "third_party": false,
+ "type": "target"
+ },
+ {
+ "deps": [
+ "benchmark",
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc++",
+ "grpc++_test_util",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "is_filegroup": false,
+ "language": "c++",
+ "name": "bm_closure",
+ "src": [
+ "test/cpp/microbenchmarks/bm_closure.cc"
+ ],
+ "third_party": false,
+ "type": "target"
+ },
+ {
+ "deps": [
+ "benchmark",
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc++",
+ "grpc++_test_util",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "is_filegroup": false,
+ "language": "c++",
"name": "bm_cq",
"src": [
"test/cpp/microbenchmarks/bm_cq.cc"
@@ -2954,6 +2943,25 @@
},
{
"deps": [
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc++",
+ "grpc++_test_util",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "is_filegroup": false,
+ "language": "c++",
+ "name": "health_service_end2end_test",
+ "src": [
+ "test/cpp/end2end/health_service_end2end_test.cc"
+ ],
+ "third_party": false,
+ "type": "target"
+ },
+ {
+ "deps": [
"grpc",
"grpc++",
"grpc++_test_config",
@@ -5552,23 +5560,6 @@
"type": "lib"
},
{
- "deps": [
- "grpc++"
- ],
- "headers": [
- "include/grpc++/test/server_context_test_spouse.h"
- ],
- "is_filegroup": false,
- "language": "c++",
- "name": "grpc++_test",
- "src": [
- "include/grpc++/test/server_context_test_spouse.h",
- "src/cpp/test/server_context_test_spouse.cc"
- ],
- "third_party": false,
- "type": "lib"
- },
- {
"deps": [],
"headers": [
"test/cpp/util/test_config.h"
@@ -5594,6 +5585,8 @@
"thrift_util"
],
"headers": [
+ "src/proto/grpc/health/v1/health.grpc.pb.h",
+ "src/proto/grpc/health/v1/health.pb.h",
"src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h",
"src/proto/grpc/testing/duplicate/echo_duplicate.pb.h",
"src/proto/grpc/testing/echo.grpc.pb.h",
@@ -7160,6 +7153,7 @@
"include/grpc/grpc.h",
"include/grpc/grpc_posix.h",
"include/grpc/grpc_security_constants.h",
+ "include/grpc/load_reporting.h",
"include/grpc/slice.h",
"include/grpc/slice_buffer.h",
"include/grpc/status.h",
@@ -7280,6 +7274,7 @@
"include/grpc/grpc.h",
"include/grpc/grpc_posix.h",
"include/grpc/grpc_security_constants.h",
+ "include/grpc/load_reporting.h",
"include/grpc/slice.h",
"include/grpc/slice_buffer.h",
"include/grpc/status.h",
@@ -8181,9 +8176,11 @@
"include/grpc++/completion_queue.h",
"include/grpc++/create_channel.h",
"include/grpc++/create_channel_posix.h",
+ "include/grpc++/ext/health_check_service_server_builder_option.h",
"include/grpc++/generic/async_generic_service.h",
"include/grpc++/generic/generic_stub.h",
"include/grpc++/grpc++.h",
+ "include/grpc++/health_check_service_interface.h",
"include/grpc++/impl/call.h",
"include/grpc++/impl/client_unary_call.h",
"include/grpc++/impl/codegen/core_codegen.h",
@@ -8220,6 +8217,8 @@
"src/cpp/client/create_channel_internal.h",
"src/cpp/common/channel_filter.h",
"src/cpp/server/dynamic_thread_pool.h",
+ "src/cpp/server/health/default_health_check_service.h",
+ "src/cpp/server/health/health.pb.h",
"src/cpp/server/thread_pool_interface.h",
"src/cpp/thread_manager/thread_manager.h"
],
@@ -8233,9 +8232,11 @@
"include/grpc++/completion_queue.h",
"include/grpc++/create_channel.h",
"include/grpc++/create_channel_posix.h",
+ "include/grpc++/ext/health_check_service_server_builder_option.h",
"include/grpc++/generic/async_generic_service.h",
"include/grpc++/generic/generic_stub.h",
"include/grpc++/grpc++.h",
+ "include/grpc++/health_check_service_interface.h",
"include/grpc++/impl/call.h",
"include/grpc++/impl/client_unary_call.h",
"include/grpc++/impl/codegen/core_codegen.h",
@@ -8289,6 +8290,12 @@
"src/cpp/server/create_default_thread_pool.cc",
"src/cpp/server/dynamic_thread_pool.cc",
"src/cpp/server/dynamic_thread_pool.h",
+ "src/cpp/server/health/default_health_check_service.cc",
+ "src/cpp/server/health/default_health_check_service.h",
+ "src/cpp/server/health/health.pb.c",
+ "src/cpp/server/health/health.pb.h",
+ "src/cpp/server/health/health_check_service.cc",
+ "src/cpp/server/health/health_check_service_server_builder_option.cc",
"src/cpp/server/server_builder.cc",
"src/cpp/server/server_cc.cc",
"src/cpp/server/server_context.cc",
@@ -8440,6 +8447,22 @@
},
{
"deps": [
+ "grpc++"
+ ],
+ "headers": [
+ "include/grpc++/test/server_context_test_spouse.h"
+ ],
+ "is_filegroup": true,
+ "language": "c++",
+ "name": "grpc++_test",
+ "src": [
+ "include/grpc++/test/server_context_test_spouse.h"
+ ],
+ "third_party": false,
+ "type": "filegroup"
+ },
+ {
+ "deps": [
"grpc++_codegen_base"
],
"headers": [
diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json
index 7486f0989a..8b18e2fba2 100644
--- a/tools/run_tests/generated/tests.json
+++ b/tools/run_tests/generated/tests.json
@@ -1529,28 +1529,6 @@
"posix",
"windows"
],
- "cpu_cost": 0.1,
- "exclude_configs": [],
- "exclude_iomgrs": [],
- "flaky": true,
- "gtest": false,
- "language": "c",
- "name": "lb_policies_test",
- "platforms": [
- "linux",
- "mac",
- "posix",
- "windows"
- ]
- },
- {
- "args": [],
- "ci_platforms": [
- "linux",
- "mac",
- "posix",
- "windows"
- ],
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
@@ -2506,6 +2484,50 @@
"flaky": false,
"gtest": false,
"language": "c++",
+ "name": "bm_chttp2_hpack",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix"
+ ]
+ },
+ {
+ "args": [
+ "--benchmark_min_time=0"
+ ],
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix"
+ ],
+ "cpu_cost": 1.0,
+ "exclude_configs": [],
+ "exclude_iomgrs": [],
+ "flaky": false,
+ "gtest": false,
+ "language": "c++",
+ "name": "bm_closure",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix"
+ ]
+ },
+ {
+ "args": [
+ "--benchmark_min_time=0"
+ ],
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix"
+ ],
+ "cpu_cost": 1.0,
+ "exclude_configs": [],
+ "exclude_iomgrs": [],
+ "flaky": false,
+ "gtest": false,
+ "language": "c++",
"name": "bm_cq",
"platforms": [
"linux",
@@ -2984,6 +3006,28 @@
"cpu_cost": 1.0,
"exclude_configs": [],
"exclude_iomgrs": [],
+ "flaky": false,
+ "gtest": true,
+ "language": "c++",
+ "name": "health_service_end2end_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ]
+ },
+ {
+ "args": [],
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ],
+ "cpu_cost": 1.0,
+ "exclude_configs": [],
+ "exclude_iomgrs": [],
"flaky": true,
"gtest": false,
"language": "c++",
diff --git a/tools/run_tests/run_microbenchmark.py b/tools/run_tests/run_microbenchmark.py
index 2bf4bc1d4d..7f871bf0ad 100755
--- a/tools/run_tests/run_microbenchmark.py
+++ b/tools/run_tests/run_microbenchmark.py
@@ -28,6 +28,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import cgi
import multiprocessing
import os
import subprocess
@@ -71,11 +72,12 @@ def heading(name):
def link(txt, tgt):
global index_html
- index_html += "<p><a href=\"%s\">%s</a></p>\n" % (tgt, txt)
+ index_html += "<p><a href=\"%s\">%s</a></p>\n" % (
+ cgi.escape(tgt, quote=True), cgi.escape(txt))
def text(txt):
global index_html
- index_html += "<p><pre>%s</pre></p>\n" % txt
+ index_html += "<p><pre>%s</pre></p>\n" % cgi.escape(txt)
def collect_latency(bm_name, args):
"""generate latency profiles"""
@@ -91,7 +93,9 @@ def collect_latency(bm_name, args):
'--benchmark_list_tests']).splitlines():
link(line, '%s.txt' % fnize(line))
benchmarks.append(
- jobset.JobSpec(['bins/basicprof/%s' % bm_name, '--benchmark_filter=^%s$' % line],
+ jobset.JobSpec(['bins/basicprof/%s' % bm_name,
+ '--benchmark_filter=^%s$' % line,
+ '--benchmark_min_time=0.05'],
environ={'LATENCY_TRACE': '%s.trace' % fnize(line)}))
profile_analysis.append(
jobset.JobSpec([sys.executable,
@@ -103,7 +107,7 @@ def collect_latency(bm_name, args):
# consume upwards of five gigabytes of ram in some cases, and so analysing
# hundreds of them at once is impractical -- but we want at least some
# concurrency or the work takes too long
- if len(benchmarks) >= min(4, multiprocessing.cpu_count()):
+ if len(benchmarks) >= min(16, multiprocessing.cpu_count()):
# run up to half the cpu count: each benchmark can use up to two cores
# (one for the microbenchmark, one for the data flush)
jobset.run(benchmarks, maxjobs=max(1, multiprocessing.cpu_count()/2),
@@ -195,7 +199,14 @@ argp.add_argument('-c', '--collect',
default=sorted(collectors.keys()),
help='Which collectors should be run against each benchmark')
argp.add_argument('-b', '--benchmarks',
- default=['bm_fullstack', 'bm_closure', 'bm_cq', 'bm_call_create', 'bm_error', 'bm_metadata'],
+ default=['bm_fullstack',
+ 'bm_closure',
+ 'bm_cq',
+ 'bm_call_create',
+ 'bm_error',
+ 'bm_chttp2_hpack',
+ 'bm_metadata'],
+>>>>>>> b325a1dd4af3f3d3443da3e0ac0f007162c63772
nargs='+',
type=str,
help='Which microbenchmarks should be run')
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 8b76193cbe..cfc2b04955 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -80,6 +80,13 @@ def platform_string():
_DEFAULT_TIMEOUT_SECONDS = 5 * 60
+def run_shell_command(cmd, env=None, cwd=None):
+ try:
+ subprocess.check_output(cmd, shell=True, env=env, cwd=cwd)
+ except subprocess.CalledProcessError as e:
+ print("Error while running command '%s'. Exit status %d. Output:\n%s",
+ e.cmd, e.returncode, e.output)
+ raise
# SimpleConfig: just compile with CONFIG=config, and run the binary to test
class Config(object):
@@ -1092,6 +1099,18 @@ def runs_per_test_type(arg_str):
raise argparse.ArgumentTypeError(msg)
+def percent_type(arg_str):
+ pct = float(arg_str)
+ if pct > 100 or pct < 0:
+ raise argparse.ArgumentTypeError(
+ "'%f' is not a valid percentage in the [0, 100] range" % pct)
+ return pct
+
+# This is math.isclose in python >= 3.5
+def isclose(a, b, rel_tol=1e-09, abs_tol=0.0):
+ return abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)
+
+
# parse command line
argp = argparse.ArgumentParser(description='Run grpc tests.')
argp.add_argument('-c', '--config',
@@ -1104,6 +1123,8 @@ argp.add_argument('-r', '--regex', default='.*', type=str)
argp.add_argument('--regex_exclude', default='', type=str)
argp.add_argument('-j', '--jobs', default=multiprocessing.cpu_count(), type=int)
argp.add_argument('-s', '--slowdown', default=1.0, type=float)
+argp.add_argument('-p', '--sample_percent', default=100.0, type=percent_type,
+ help='Run a random sample with that percentage of tests')
argp.add_argument('-f', '--forever',
default=False,
action='store_const',
@@ -1199,7 +1220,7 @@ for spec in args.update_submodules:
cwd = 'third_party/%s' % submodule
def git(cmd, cwd=cwd):
print('in %s: git %s' % (cwd, cmd))
- subprocess.check_call('git %s' % cmd, cwd=cwd, shell=True)
+ run_shell_command('git %s' % cmd, cwd=cwd)
git('fetch')
git('checkout %s' % branch)
git('pull origin %s' % branch)
@@ -1207,7 +1228,7 @@ for spec in args.update_submodules:
need_to_regenerate_projects = True
if need_to_regenerate_projects:
if jobset.platform_string() == 'linux':
- subprocess.check_call('tools/buildgen/generate_projects.sh', shell=True)
+ run_shell_command('tools/buildgen/generate_projects.sh')
else:
print('WARNING: may need to regenerate projects, but since we are not on')
print(' Linux this step is being skipped. Compilation MAY fail.')
@@ -1276,9 +1297,7 @@ if args.use_docker:
if not args.travis:
env['TTY_FLAG'] = '-t' # enables Ctrl-C when not on Jenkins.
- subprocess.check_call(['tools/run_tests/dockerize/build_docker_and_run_tests.sh'],
- shell=True,
- env=env)
+ run_shell_command('tools/run_tests/dockerize/build_docker_and_run_tests.sh', env=env)
sys.exit(0)
_check_arch_option(args.arch)
@@ -1438,8 +1457,18 @@ def _build_and_run(
else:
# whereas otherwise, we want to shuffle things up to give all tests a
# chance to run.
- massaged_one_run = list(one_run) # random.shuffle needs an indexable seq.
- random.shuffle(massaged_one_run) # which it modifies in-place.
+ massaged_one_run = list(one_run) # random.sample needs an indexable seq.
+ num_jobs = len(massaged_one_run)
+ # for a random sample, get as many as indicated by the 'sample_percent'
+ # argument. By default this arg is 100, resulting in a shuffle of all
+ # jobs.
+ sample_size = int(num_jobs * args.sample_percent/100.0)
+ massaged_one_run = random.sample(massaged_one_run, sample_size)
+ if not isclose(args.sample_percent, 100.0):
+ print("Running %d tests out of %d (~%d%%)" %
+ (sample_size, num_jobs, args.sample_percent))
+ else:
+ assert args.runs_per_test == 1, "Can't do sampling (-p) over multiple runs (-n)."
if infinite_runs:
assert len(massaged_one_run) > 0, 'Must have at least one test for a -n inf run'
runs_sequence = (itertools.repeat(massaged_one_run) if infinite_runs
@@ -1450,7 +1479,7 @@ def _build_and_run(
jobset.message('START', 'Running tests quietly, only failing tests will be reported', do_newline=True)
num_test_failures, resultset = jobset.run(
all_runs, check_cancelled, newline_on_success=newline_on_success,
- travis=args.travis, infinite_runs=infinite_runs, maxjobs=args.jobs,
+ travis=args.travis, maxjobs=args.jobs,
stop_on_failure=args.stop_on_failure,
add_env={'GRPC_TEST_PORT_SERVER': 'localhost:%d' % port_server_port},
quiet_success=args.quiet_success)