aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Noah Eisen <ncteisen@google.com>2017-04-25 17:01:08 -0700
committerGravatar Noah Eisen <ncteisen@google.com>2017-04-25 17:01:08 -0700
commitf725d7e6b6ac57641e67f363f3e3b585d074f0e2 (patch)
tree08d98309e9fe0993e6fb33e79662776fc7cc5b54 /tools
parentad8d36d4dcd4deeec2d05644b78eb78ae0918f06 (diff)
parentb864e7c41c6d0363e23093fb090625f260994962 (diff)
Merge branch 'master' of https://github.com/grpc/grpc into client-auth-filter-fuzz
Diffstat (limited to 'tools')
-rwxr-xr-xtools/jenkins/run_performance.sh1
-rwxr-xr-xtools/profiling/microbenchmarks/bm_diff.py27
-rw-r--r--tools/run_tests/generated/sources_and_headers.json83
-rw-r--r--tools/run_tests/generated/tests.json2
-rwxr-xr-xtools/run_tests/python_utils/port_server.py27
5 files changed, 104 insertions, 36 deletions
diff --git a/tools/jenkins/run_performance.sh b/tools/jenkins/run_performance.sh
index 544e31dcbd..f530fb46b8 100755
--- a/tools/jenkins/run_performance.sh
+++ b/tools/jenkins/run_performance.sh
@@ -37,4 +37,5 @@ BENCHMARKS_TO_RUN="bm_fullstack_unary_ping_pong bm_fullstack_streaming_ping_pong
# Enter the gRPC repo root
cd $(dirname $0)/../..
+tools/run_tests/start_port_server.py
tools/profiling/microbenchmarks/bm_diff.py -d origin/$ghprbTargetBranch -b $BENCHMARKS_TO_RUN
diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py
index 6ee4cbfc7b..3c15478774 100755
--- a/tools/profiling/microbenchmarks/bm_diff.py
+++ b/tools/profiling/microbenchmarks/bm_diff.py
@@ -204,7 +204,10 @@ def eintr_be_gone(fn):
def read_json(filename):
- with open(filename) as f: return json.loads(f.read())
+ try:
+ with open(filename) as f: return json.loads(f.read())
+ except ValueError, e:
+ return None
def finalize():
@@ -217,16 +220,18 @@ def finalize():
js_old_ctr = read_json('%s.counters.old.%d.json' % (bm, loop))
js_old_opt = read_json('%s.opt.old.%d.json' % (bm, loop))
- for row in bm_json.expand_json(js_new_ctr, js_new_opt):
- print row
- name = row['cpp_name']
- if name.endswith('_mean') or name.endswith('_stddev'): continue
- benchmarks[name].add_sample(row, True)
- for row in bm_json.expand_json(js_old_ctr, js_old_opt):
- print row
- name = row['cpp_name']
- if name.endswith('_mean') or name.endswith('_stddev'): continue
- benchmarks[name].add_sample(row, False)
+ if js_new_ctr:
+ for row in bm_json.expand_json(js_new_ctr, js_new_opt):
+ print row
+ name = row['cpp_name']
+ if name.endswith('_mean') or name.endswith('_stddev'): continue
+ benchmarks[name].add_sample(row, True)
+ if js_old_ctr:
+ for row in bm_json.expand_json(js_old_ctr, js_old_opt):
+ print row
+ name = row['cpp_name']
+ if name.endswith('_mean') or name.endswith('_stddev'): continue
+ benchmarks[name].add_sample(row, False)
really_interesting = set()
for name, bm in benchmarks.items():
diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json
index f525faab9c..1f3bf7837f 100644
--- a/tools/run_tests/generated/sources_and_headers.json
+++ b/tools/run_tests/generated/sources_and_headers.json
@@ -2871,14 +2871,19 @@
"headers": [
"src/proto/grpc/testing/control.grpc.pb.h",
"src/proto/grpc/testing/control.pb.h",
+ "src/proto/grpc/testing/control_mock.grpc.pb.h",
"src/proto/grpc/testing/messages.grpc.pb.h",
"src/proto/grpc/testing/messages.pb.h",
+ "src/proto/grpc/testing/messages_mock.grpc.pb.h",
"src/proto/grpc/testing/payloads.grpc.pb.h",
"src/proto/grpc/testing/payloads.pb.h",
+ "src/proto/grpc/testing/payloads_mock.grpc.pb.h",
"src/proto/grpc/testing/services.grpc.pb.h",
"src/proto/grpc/testing/services.pb.h",
+ "src/proto/grpc/testing/services_mock.grpc.pb.h",
"src/proto/grpc/testing/stats.grpc.pb.h",
- "src/proto/grpc/testing/stats.pb.h"
+ "src/proto/grpc/testing/stats.pb.h",
+ "src/proto/grpc/testing/stats_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -2899,14 +2904,19 @@
"headers": [
"src/proto/grpc/testing/control.grpc.pb.h",
"src/proto/grpc/testing/control.pb.h",
+ "src/proto/grpc/testing/control_mock.grpc.pb.h",
"src/proto/grpc/testing/messages.grpc.pb.h",
"src/proto/grpc/testing/messages.pb.h",
+ "src/proto/grpc/testing/messages_mock.grpc.pb.h",
"src/proto/grpc/testing/payloads.grpc.pb.h",
"src/proto/grpc/testing/payloads.pb.h",
+ "src/proto/grpc/testing/payloads_mock.grpc.pb.h",
"src/proto/grpc/testing/services.grpc.pb.h",
"src/proto/grpc/testing/services.pb.h",
+ "src/proto/grpc/testing/services_mock.grpc.pb.h",
"src/proto/grpc/testing/stats.grpc.pb.h",
- "src/proto/grpc/testing/stats.pb.h"
+ "src/proto/grpc/testing/stats.pb.h",
+ "src/proto/grpc/testing/stats_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -3027,7 +3037,8 @@
],
"headers": [
"src/proto/grpc/testing/echo_messages.grpc.pb.h",
- "src/proto/grpc/testing/echo_messages.pb.h"
+ "src/proto/grpc/testing/echo_messages.pb.h",
+ "src/proto/grpc/testing/echo_messages_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -3084,7 +3095,8 @@
],
"headers": [
"src/proto/grpc/testing/compiler_test.grpc.pb.h",
- "src/proto/grpc/testing/compiler_test.pb.h"
+ "src/proto/grpc/testing/compiler_test.pb.h",
+ "src/proto/grpc/testing/compiler_test_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -3229,7 +3241,9 @@
"src/proto/grpc/testing/echo.grpc.pb.h",
"src/proto/grpc/testing/echo.pb.h",
"src/proto/grpc/testing/echo_messages.grpc.pb.h",
- "src/proto/grpc/testing/echo_messages.pb.h"
+ "src/proto/grpc/testing/echo_messages.pb.h",
+ "src/proto/grpc/testing/echo_messages_mock.grpc.pb.h",
+ "src/proto/grpc/testing/echo_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -3249,7 +3263,8 @@
],
"headers": [
"src/proto/grpc/lb/v1/load_balancer.grpc.pb.h",
- "src/proto/grpc/lb/v1/load_balancer.pb.h"
+ "src/proto/grpc/lb/v1/load_balancer.pb.h",
+ "src/proto/grpc/lb/v1/load_balancer_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -3271,7 +3286,8 @@
],
"headers": [
"src/proto/grpc/lb/v1/load_balancer.grpc.pb.h",
- "src/proto/grpc/lb/v1/load_balancer.pb.h"
+ "src/proto/grpc/lb/v1/load_balancer.pb.h",
+ "src/proto/grpc/lb/v1/load_balancer_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -3426,6 +3442,7 @@
"headers": [
"src/proto/grpc/testing/metrics.grpc.pb.h",
"src/proto/grpc/testing/metrics.pb.h",
+ "src/proto/grpc/testing/metrics_mock.grpc.pb.h",
"test/cpp/util/metrics_server.h"
],
"is_filegroup": false,
@@ -3447,11 +3464,14 @@
"grpc++_test_util",
"grpc_test_util"
],
- "headers": [],
+ "headers": [
+ "include/grpc++/test/mock_stream.h"
+ ],
"is_filegroup": false,
"language": "c++",
"name": "mock_test",
"src": [
+ "include/grpc++/test/mock_stream.h",
"test/cpp/end2end/mock_test.cc"
],
"third_party": false,
@@ -3610,10 +3630,13 @@
"headers": [
"src/proto/grpc/testing/empty.grpc.pb.h",
"src/proto/grpc/testing/empty.pb.h",
+ "src/proto/grpc/testing/empty_mock.grpc.pb.h",
"src/proto/grpc/testing/messages.grpc.pb.h",
"src/proto/grpc/testing/messages.pb.h",
+ "src/proto/grpc/testing/messages_mock.grpc.pb.h",
"src/proto/grpc/testing/test.grpc.pb.h",
- "src/proto/grpc/testing/test.pb.h"
+ "src/proto/grpc/testing/test.pb.h",
+ "src/proto/grpc/testing/test_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -3639,10 +3662,13 @@
"headers": [
"src/proto/grpc/testing/empty.grpc.pb.h",
"src/proto/grpc/testing/empty.pb.h",
+ "src/proto/grpc/testing/empty_mock.grpc.pb.h",
"src/proto/grpc/testing/messages.grpc.pb.h",
"src/proto/grpc/testing/messages.pb.h",
+ "src/proto/grpc/testing/messages_mock.grpc.pb.h",
"src/proto/grpc/testing/test.grpc.pb.h",
- "src/proto/grpc/testing/test.pb.h"
+ "src/proto/grpc/testing/test.pb.h",
+ "src/proto/grpc/testing/test_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -3743,7 +3769,9 @@
"src/proto/grpc/testing/echo.grpc.pb.h",
"src/proto/grpc/testing/echo.pb.h",
"src/proto/grpc/testing/echo_messages.grpc.pb.h",
- "src/proto/grpc/testing/echo_messages.pb.h"
+ "src/proto/grpc/testing/echo_messages.pb.h",
+ "src/proto/grpc/testing/echo_messages_mock.grpc.pb.h",
+ "src/proto/grpc/testing/echo_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -3880,12 +3908,16 @@
"headers": [
"src/proto/grpc/testing/empty.grpc.pb.h",
"src/proto/grpc/testing/empty.pb.h",
+ "src/proto/grpc/testing/empty_mock.grpc.pb.h",
"src/proto/grpc/testing/messages.grpc.pb.h",
"src/proto/grpc/testing/messages.pb.h",
+ "src/proto/grpc/testing/messages_mock.grpc.pb.h",
"src/proto/grpc/testing/metrics.grpc.pb.h",
"src/proto/grpc/testing/metrics.pb.h",
+ "src/proto/grpc/testing/metrics_mock.grpc.pb.h",
"src/proto/grpc/testing/test.grpc.pb.h",
"src/proto/grpc/testing/test.pb.h",
+ "src/proto/grpc/testing/test_mock.grpc.pb.h",
"test/cpp/interop/client_helper.h",
"test/cpp/interop/interop_client.h",
"test/cpp/interop/stress_interop_client.h",
@@ -5900,7 +5932,8 @@
"headers": [
"include/grpc++/support/error_details.h",
"src/proto/grpc/status/status.grpc.pb.h",
- "src/proto/grpc/status/status.pb.h"
+ "src/proto/grpc/status/status.pb.h",
+ "src/proto/grpc/status/status_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -5980,12 +6013,16 @@
"headers": [
"src/proto/grpc/health/v1/health.grpc.pb.h",
"src/proto/grpc/health/v1/health.pb.h",
+ "src/proto/grpc/health/v1/health_mock.grpc.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/duplicate/echo_duplicate_mock.grpc.pb.h",
"src/proto/grpc/testing/echo.grpc.pb.h",
"src/proto/grpc/testing/echo.pb.h",
"src/proto/grpc/testing/echo_messages.grpc.pb.h",
"src/proto/grpc/testing/echo_messages.pb.h",
+ "src/proto/grpc/testing/echo_messages_mock.grpc.pb.h",
+ "src/proto/grpc/testing/echo_mock.grpc.pb.h",
"test/cpp/end2end/test_service_impl.h",
"test/cpp/util/byte_buffer_proto_helper.h",
"test/cpp/util/create_test_channel.h",
@@ -6165,10 +6202,13 @@
"headers": [
"src/proto/grpc/testing/empty.grpc.pb.h",
"src/proto/grpc/testing/empty.pb.h",
+ "src/proto/grpc/testing/empty_mock.grpc.pb.h",
"src/proto/grpc/testing/messages.grpc.pb.h",
"src/proto/grpc/testing/messages.pb.h",
+ "src/proto/grpc/testing/messages_mock.grpc.pb.h",
"src/proto/grpc/testing/test.grpc.pb.h",
"src/proto/grpc/testing/test.pb.h",
+ "src/proto/grpc/testing/test_mock.grpc.pb.h",
"test/cpp/interop/http2_client.h"
],
"is_filegroup": false,
@@ -6192,6 +6232,7 @@
"headers": [
"src/proto/grpc/testing/messages.grpc.pb.h",
"src/proto/grpc/testing/messages.pb.h",
+ "src/proto/grpc/testing/messages_mock.grpc.pb.h",
"test/cpp/interop/client_helper.h"
],
"is_filegroup": false,
@@ -6218,10 +6259,13 @@
"headers": [
"src/proto/grpc/testing/empty.grpc.pb.h",
"src/proto/grpc/testing/empty.pb.h",
+ "src/proto/grpc/testing/empty_mock.grpc.pb.h",
"src/proto/grpc/testing/messages.grpc.pb.h",
"src/proto/grpc/testing/messages.pb.h",
+ "src/proto/grpc/testing/messages_mock.grpc.pb.h",
"src/proto/grpc/testing/test.grpc.pb.h",
"src/proto/grpc/testing/test.pb.h",
+ "src/proto/grpc/testing/test_mock.grpc.pb.h",
"test/cpp/interop/interop_client.h"
],
"is_filegroup": false,
@@ -6270,10 +6314,13 @@
"headers": [
"src/proto/grpc/testing/empty.grpc.pb.h",
"src/proto/grpc/testing/empty.pb.h",
+ "src/proto/grpc/testing/empty_mock.grpc.pb.h",
"src/proto/grpc/testing/messages.grpc.pb.h",
"src/proto/grpc/testing/messages.pb.h",
+ "src/proto/grpc/testing/messages_mock.grpc.pb.h",
"src/proto/grpc/testing/test.grpc.pb.h",
- "src/proto/grpc/testing/test.pb.h"
+ "src/proto/grpc/testing/test.pb.h",
+ "src/proto/grpc/testing/test_mock.grpc.pb.h"
],
"is_filegroup": false,
"language": "c++",
@@ -6307,14 +6354,19 @@
"headers": [
"src/proto/grpc/testing/control.grpc.pb.h",
"src/proto/grpc/testing/control.pb.h",
+ "src/proto/grpc/testing/control_mock.grpc.pb.h",
"src/proto/grpc/testing/messages.grpc.pb.h",
"src/proto/grpc/testing/messages.pb.h",
+ "src/proto/grpc/testing/messages_mock.grpc.pb.h",
"src/proto/grpc/testing/payloads.grpc.pb.h",
"src/proto/grpc/testing/payloads.pb.h",
+ "src/proto/grpc/testing/payloads_mock.grpc.pb.h",
"src/proto/grpc/testing/services.grpc.pb.h",
"src/proto/grpc/testing/services.pb.h",
+ "src/proto/grpc/testing/services_mock.grpc.pb.h",
"src/proto/grpc/testing/stats.grpc.pb.h",
"src/proto/grpc/testing/stats.pb.h",
+ "src/proto/grpc/testing/stats_mock.grpc.pb.h",
"test/cpp/qps/benchmark_config.h",
"test/cpp/qps/client.h",
"test/cpp/qps/driver.h",
@@ -9020,7 +9072,8 @@
"deps": [],
"headers": [
"src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h",
- "src/proto/grpc/reflection/v1alpha/reflection.pb.h"
+ "src/proto/grpc/reflection/v1alpha/reflection.pb.h",
+ "src/proto/grpc/reflection/v1alpha/reflection_mock.grpc.pb.h"
],
"is_filegroup": true,
"language": "c++",
@@ -9034,12 +9087,14 @@
"grpc++"
],
"headers": [
+ "include/grpc++/test/mock_stream.h",
"include/grpc++/test/server_context_test_spouse.h"
],
"is_filegroup": true,
"language": "c++",
"name": "grpc++_test",
"src": [
+ "include/grpc++/test/mock_stream.h",
"include/grpc++/test/server_context_test_spouse.h"
],
"third_party": false,
diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json
index 38e9e2a880..2928b870c9 100644
--- a/tools/run_tests/generated/tests.json
+++ b/tools/run_tests/generated/tests.json
@@ -3329,7 +3329,7 @@
},
{
"args": [
- "--generated_file_path=gens/src/proto/grpc/testing/compiler_test.grpc.pb.h"
+ "--generated_file_path=gens/src/proto/grpc/testing/"
],
"ci_platforms": [
"linux",
diff --git a/tools/run_tests/python_utils/port_server.py b/tools/run_tests/python_utils/port_server.py
index dbd32efc0e..e96ee0b08c 100755
--- a/tools/run_tests/python_utils/port_server.py
+++ b/tools/run_tests/python_utils/port_server.py
@@ -33,18 +33,20 @@
from __future__ import print_function
import argparse
-from six.moves import BaseHTTPServer
+from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import hashlib
import os
import socket
import sys
import time
+from SocketServer import ThreadingMixIn
+import threading
# increment this number whenever making a change to ensure that
# the changes are picked up by running CI servers
# note that all changes must be backwards compatible
-_MY_VERSION = 9
+_MY_VERSION = 14
if len(sys.argv) == 2 and sys.argv[1] == 'dump_version':
@@ -68,6 +70,7 @@ print('port server running on port %d' % args.port)
pool = []
in_use = {}
+mu = threading.Lock()
def refill_pool(max_timeout, req):
@@ -95,28 +98,33 @@ def refill_pool(max_timeout, req):
def allocate_port(req):
global pool
global in_use
+ global mu
+ mu.acquire()
max_timeout = 600
while not pool:
refill_pool(max_timeout, req)
if not pool:
req.log_message("failed to find ports: retrying soon")
+ mu.release()
time.sleep(1)
+ mu.acquire()
max_timeout /= 2
port = pool[0]
pool = pool[1:]
in_use[port] = time.time()
+ mu.release()
return port
keep_running = True
-class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
+class Handler(BaseHTTPRequestHandler):
def setup(self):
# If the client is unreachable for 5 seconds, close the connection
self.timeout = 5
- BaseHTTPServer.BaseHTTPRequestHandler.setup(self)
+ BaseHTTPRequestHandler.setup(self)
def do_GET(self):
global keep_running
@@ -158,12 +166,11 @@ class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
elif self.path == '/quitquitquit':
self.send_response(200)
self.end_headers()
- keep_running = False
+ self.server.shutdown()
+class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
+ """Handle requests in a separate thread"""
-httpd = BaseHTTPServer.HTTPServer(('', args.port), Handler)
-while keep_running:
- httpd.handle_request()
- sys.stderr.flush()
-print('done')
+ThreadedHTTPServer(('', args.port), Handler).serve_forever()
+