aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/codegen/core/gen_static_metadata.py4
-rw-r--r--tools/doxygen/Doxyfile.core.internal2
-rwxr-xr-xtools/gce/create_linux_performance_worker.sh3
-rwxr-xr-xtools/gce/linux_performance_worker_init.sh35
-rwxr-xr-xtools/jenkins/run_sweep_performance.sh5
-rw-r--r--tools/run_tests/filter_pull_request_tests.py184
-rwxr-xr-xtools/run_tests/performance/build_performance.sh3
-rwxr-xr-xtools/run_tests/performance/kill_workers.sh1
-rwxr-xr-xtools/run_tests/performance/run_worker_csharp.sh4
-rwxr-xr-xtools/run_tests/run_tests.py2
-rwxr-xr-xtools/run_tests/run_tests_matrix.py25
-rw-r--r--tools/run_tests/sources_and_headers.json20
-rw-r--r--tools/run_tests/tests.json19
13 files changed, 292 insertions, 15 deletions
diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py
index 6f400102e4..6f8cad279c 100755
--- a/tools/codegen/core/gen_static_metadata.py
+++ b/tools/codegen/core/gen_static_metadata.py
@@ -109,8 +109,8 @@ CONFIG = [
('if-range', ''),
('if-unmodified-since', ''),
('last-modified', ''),
- ('load-reporting-initial', ''),
- ('load-reporting-trailing', ''),
+ ('lb-token', ''),
+ ('lb-cost', ''),
('link', ''),
('location', ''),
('max-forwards', ''),
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index 44f147aeb1..0c92e270c8 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -841,6 +841,7 @@ src/core/lib/iomgr/timer.h \
src/core/lib/iomgr/timer_heap.h \
src/core/lib/iomgr/udp_server.h \
src/core/lib/iomgr/unix_sockets_posix.h \
+src/core/lib/iomgr/wakeup_fd_cv.h \
src/core/lib/iomgr/wakeup_fd_pipe.h \
src/core/lib/iomgr/wakeup_fd_posix.h \
src/core/lib/iomgr/workqueue.h \
@@ -1007,6 +1008,7 @@ src/core/lib/iomgr/timer_heap.c \
src/core/lib/iomgr/udp_server.c \
src/core/lib/iomgr/unix_sockets_posix.c \
src/core/lib/iomgr/unix_sockets_posix_noop.c \
+src/core/lib/iomgr/wakeup_fd_cv.c \
src/core/lib/iomgr/wakeup_fd_eventfd.c \
src/core/lib/iomgr/wakeup_fd_nospecial.c \
src/core/lib/iomgr/wakeup_fd_pipe.c \
diff --git a/tools/gce/create_linux_performance_worker.sh b/tools/gce/create_linux_performance_worker.sh
index c9a0ffa4e1..2c8cf0b96b 100755
--- a/tools/gce/create_linux_performance_worker.sh
+++ b/tools/gce/create_linux_performance_worker.sh
@@ -48,7 +48,8 @@ gcloud compute instances create $INSTANCE_NAME \
--project="$CLOUD_PROJECT" \
--zone "$ZONE" \
--machine-type $MACHINE_TYPE \
- --image ubuntu-15-10 \
+ --image-project ubuntu-os-cloud \
+ --image-family ubuntu-1604-lts \
--boot-disk-size 300 \
--scopes https://www.googleapis.com/auth/bigquery
diff --git a/tools/gce/linux_performance_worker_init.sh b/tools/gce/linux_performance_worker_init.sh
index ea80d74bdf..523749ee81 100755
--- a/tools/gce/linux_performance_worker_init.sh
+++ b/tools/gce/linux_performance_worker_init.sh
@@ -90,6 +90,16 @@ sudo apt-get install -y libgflags-dev libgtest-dev libc++-dev clang
# Python dependencies
sudo pip install tabulate
sudo pip install google-api-python-client
+sudo pip install virtualenv
+
+# TODO(jtattermusch): For some reason, building gRPC Python depends on python3.4
+# being installed, but python3.4 is not available on Ubuntu 16.04.
+# Temporarily fixing this by adding a PPA with python3.4, but we should
+# really remove this hack once possible.
+sudo add-apt-repository -y ppa:fkrull/deadsnakes
+sudo apt-get update
+sudo apt-get install -y python3.4 python3.4-dev
+python3.4 -m pip install virtualenv
curl -O https://bootstrap.pypa.io/get-pip.py
sudo pypy get-pip.py
@@ -105,17 +115,17 @@ nvm install 4 && npm config set cache /tmp/npm-cache
nvm install 5 && npm config set cache /tmp/npm-cache
nvm alias default 4
-# C# dependencies (http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives)
-
+# C# mono dependencies (http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives)
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install -y mono-devel nuget
-# The version of nuget that is installed using apt-get is too old to download
-# the System.Interactive.Async.3.0.0 C# dependency. Update to the latest version
-# in order to be able download it.
-sudo nuget update -self
+# C# .NET Core dependencies (https://www.microsoft.com/net/core#ubuntu)
+sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
+sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
+sudo apt-get update
+sudo apt-get install -y dotnet-dev-1.0.0-preview2-003131
# Ruby dependencies
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
@@ -128,4 +138,15 @@ gem install bundler
# Java dependencies - nothing as we already have Java JDK 8
# Go dependencies
-sudo apt-get install -y golang-go
+# Currently, the golang package available via apt-get doesn't have the latest go.
+# Significant performance improvements with grpc-go have been observed after
+# upgrading from go 1.5 to a later version, so a later go version is preferred.
+# Following go install instructions from https://golang.org/doc/install
+GO_VERSION=1.7.1
+OS=linux
+ARCH=amd64
+curl -O https://storage.googleapis.com/golang/go${GO_VERSION}.${OS}-${ARCH}.tar.gz
+sudo tar -C /usr/local -xzf go$GO_VERSION.$OS-$ARCH.tar.gz
+# Put go on the PATH, keep the usual installation dir
+sudo ln -s /usr/local/go/bin/go /usr/bin/go
+rm go$GO_VERSION.$OS-$ARCH.tar.gz
diff --git a/tools/jenkins/run_sweep_performance.sh b/tools/jenkins/run_sweep_performance.sh
index 6cd7a9129b..3b22e25a45 100755
--- a/tools/jenkins/run_sweep_performance.sh
+++ b/tools/jenkins/run_sweep_performance.sh
@@ -31,6 +31,9 @@
# This script is invoked by Jenkins and runs full performance test suite.
set -ex
+SERVER_HOST=${1:-grpc-performance-server-32core}
+CLIENT_HOST1=${2:-grpc-performance-client-32core}
+CLIENT_HOST2=${3:-grpc-performance-client2-32core}
# Enter the gRPC repo root
cd $(dirname $0)/../..
@@ -39,7 +42,7 @@ tools/run_tests/run_performance_tests.py \
-l c++ \
--category sweep \
--bq_result_table performance_test.performance_experiment_32core \
- --remote_worker_host grpc-performance-server-32core grpc-performance-client-32core grpc-performance-client2-32core \
+ --remote_worker_host ${SERVER_HOST} ${CLIENT_HOST1} ${CLIENT_HOST2} \
|| EXIT_CODE=1
exit $EXIT_CODE
diff --git a/tools/run_tests/filter_pull_request_tests.py b/tools/run_tests/filter_pull_request_tests.py
new file mode 100644
index 0000000000..55dab42f8a
--- /dev/null
+++ b/tools/run_tests/filter_pull_request_tests.py
@@ -0,0 +1,184 @@
+#!/usr/bin/env python2.7
+# Copyright 2015, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Filter out tests based on file differences compared to merge target branch"""
+
+import re
+from subprocess import call, check_output
+
+
+class TestSuite:
+ """
+ Contains tag to identify job as belonging to this test suite and
+ triggers to identify if changed files are relevant
+ """
+ def __init__(self, tags):
+ """
+ Build TestSuite to group tests by their tags
+ :param tag: string used to identify if a job belongs to this TestSuite
+ todo(mattkwong): Change the use of tag because do not want to depend on
+ job.shortname to identify what suite a test belongs to
+ """
+ self.triggers = []
+ self.tags = tags
+
+ def add_trigger(self, trigger):
+ """
+ Add a regex to list of triggers that determine if a changed file should run tests
+ :param trigger: regex matching file relevant to tests
+ """
+ self.triggers.append(trigger)
+
+# Create test suites
+_core_test_suite = TestSuite(['_c_'])
+_cpp_test_suite = TestSuite(['_c++_'])
+_csharp_test_suite = TestSuite(['_csharp_'])
+_node_test_suite = TestSuite(['_node_'])
+_objc_test_suite = TestSuite(['_objc_'])
+_php_test_suite = TestSuite(['_php_', '_php7_'])
+_python_test_suite = TestSuite(['_python_'])
+_ruby_test_suite = TestSuite(['_ruby'])
+_all_test_suites = [_core_test_suite, _cpp_test_suite, _csharp_test_suite,
+ _node_test_suite, _objc_test_suite, _php_test_suite,
+ _python_test_suite, _ruby_test_suite]
+
+# Dictionary of whitelistable files where the key is a regex matching changed files
+# and the value is a list of tests that should be run. An empty list means that
+# the changed files should not trigger any tests. Any changed file that does not
+# match any of these regexes will trigger all tests
+_WHITELIST_DICT = {
+ '^templates/.*': [],
+ '^doc/.*': [],
+ '^examples/.*': [],
+ '^summerofcode/.*': [],
+ '.*README.md$': [],
+ '.*LICENSE$': [],
+ '^src/cpp.*': [_cpp_test_suite],
+ '^src/csharp.*': [_csharp_test_suite],
+ '^src/node.*': [_node_test_suite],
+ '^src/objective-c.*': [_objc_test_suite],
+ '^src/php.*': [_php_test_suite],
+ '^src/python.*': [_python_test_suite],
+ '^src/ruby.*': [_ruby_test_suite],
+ '^test/core.*': [_core_test_suite],
+ '^test/cpp.*': [_cpp_test_suite],
+ '^test/distrib/cpp.*': [_cpp_test_suite],
+ '^test/distrib/csharp.*': [_csharp_test_suite],
+ '^test/distrib/node.*': [_node_test_suite],
+ '^test/distrib/php.*': [_php_test_suite],
+ '^test/distrib/python.*': [_python_test_suite],
+ '^test/distrib/ruby.*': [_ruby_test_suite]
+}
+# Add all triggers to their respective test suites
+for trigger, test_suites in _WHITELIST_DICT.iteritems():
+ for test_suite in test_suites:
+ test_suite.add_trigger(trigger)
+
+
+def _get_changed_files(base_branch):
+ """
+ Get list of changed files between current branch and base of target merge branch
+ """
+ # git fetch might need to be called on Jenkins slave
+ # todo(mattkwong): remove or uncomment below after seeing if Jenkins needs this
+ # call(['git', 'fetch'])
+
+ # Get file changes between branch and merge-base of specified branch
+ # Not combined to be Windows friendly
+ base_commit = check_output(["git", "merge-base", base_branch, "HEAD"]).rstrip()
+ return check_output(["git", "diff", base_commit, "--name-only"]).splitlines()
+
+
+def _can_skip_tests(file_names, triggers):
+ """
+ Determines if tests are skippable based on if all files do not match list of regexes
+ :param file_names: list of changed files generated by _get_changed_files()
+ :param triggers: list of regexes matching file name that indicates tests should be run
+ :return: safe to skip tests
+ """
+ for file_name in file_names:
+ if any(re.match(trigger, file_name) for trigger in triggers):
+ return False
+ return True
+
+
+def _remove_irrelevant_tests(tests, tag):
+ """
+ Filters out tests by config or language - will not remove sanitizer tests
+ :param tests: list of all tests generated by run_tests_matrix.py
+ :param tag: string representing language or config to filter - "_(language)_" or "_(config)"
+ :return: list of relevant tests
+ """
+ # todo(mattkwong): find a more reliable way to filter tests - don't use shortname
+ return [test for test in tests if tag not in test.shortname or
+ any(san_tag in test.shortname for san_tag in ['_asan', '_tsan', '_msan'])]
+
+
+def _remove_sanitizer_tests(tests):
+ """
+ Filters out sanitizer tests
+ :param tests: list of all tests generated by run_tests_matrix.py
+ :return: list of relevant tests
+ """
+ # todo(mattkwong): find a more reliable way to filter tests - don't use shortname
+ return [test for test in tests if
+ all(san_tag not in test.shortname for san_tag in ['_asan', '_tsan', '_msan'])]
+
+
+def filter_tests(tests, base_branch):
+ """
+ Filters out tests that are safe to ignore
+ :param tests: list of all tests generated by run_tests_matrix.py
+ :return: list of relevant tests
+ """
+ print("Finding file differences between %s repo and current branch...\n" % base_branch)
+ changed_files = _get_changed_files(base_branch)
+ for changed_file in changed_files:
+ print(changed_file)
+ print
+
+ # Regex that combines all keys in _WHITELIST_DICT
+ all_triggers = "(" + ")|(".join(_WHITELIST_DICT.keys()) + ")"
+ # Check if all tests have to be run
+ for changed_file in changed_files:
+ if not re.match(all_triggers, changed_file):
+ return(tests)
+ # Filter out tests by language
+ for test_suite in _all_test_suites:
+ if _can_skip_tests(changed_files, test_suite.triggers):
+ for tag in test_suite.tags:
+ print(" Filtering %s tests" % tag)
+ tests = _remove_irrelevant_tests(tests, tag)
+ # Sanitizer tests skipped if core and c++ are skipped
+ if _can_skip_tests(changed_files, _cpp_test_suite.triggers + _core_test_suite.triggers):
+ print(" Filtering Sanitizer tests")
+ tests = _remove_sanitizer_tests(tests)
+
+ return tests
diff --git a/tools/run_tests/performance/build_performance.sh b/tools/run_tests/performance/build_performance.sh
index 352c679757..e981cae76b 100755
--- a/tools/run_tests/performance/build_performance.sh
+++ b/tools/run_tests/performance/build_performance.sh
@@ -54,6 +54,9 @@ do
"go")
tools/run_tests/performance/build_performance_go.sh
;;
+ "csharp")
+ tools/run_tests/run_tests.py -l $language -c $CONFIG --build_only -j 8 --compiler coreclr
+ ;;
*)
tools/run_tests/run_tests.py -l $language -c $CONFIG --build_only -j 8
;;
diff --git a/tools/run_tests/performance/kill_workers.sh b/tools/run_tests/performance/kill_workers.sh
index 279cc7df29..6e33efad4c 100755
--- a/tools/run_tests/performance/kill_workers.sh
+++ b/tools/run_tests/performance/kill_workers.sh
@@ -40,6 +40,7 @@ killall -9 qps_worker || true
# C#
ps -C mono -o pid=,cmd= | grep QpsWorker | awk '{print $1}' | xargs kill -9 || true
+ps -C dotnet -o pid=,cmd= | grep QpsWorker | awk '{print $1}' | xargs kill -9 || true
# Ruby
ps -C ruby -o pid=,cmd= | grep 'qps/worker.rb' | awk '{print $1}' | xargs kill -9 || true
diff --git a/tools/run_tests/performance/run_worker_csharp.sh b/tools/run_tests/performance/run_worker_csharp.sh
index b91df09b42..b4c5ec288f 100755
--- a/tools/run_tests/performance/run_worker_csharp.sh
+++ b/tools/run_tests/performance/run_worker_csharp.sh
@@ -33,6 +33,6 @@ set -ex
cd $(dirname $0)/../../..
# needed to correctly locate testca
-cd src/csharp/Grpc.IntegrationTesting.QpsWorker/bin/Release
+cd src/csharp/Grpc.IntegrationTesting.QpsWorker/bin/Release/netcoreapp1.0
-mono Grpc.IntegrationTesting.QpsWorker.exe $@
+dotnet exec Grpc.IntegrationTesting.QpsWorker.dll $@
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index dd070b1fe0..e9ee5f538d 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -69,7 +69,7 @@ _FORCE_ENVIRON_FOR_WRAPPERS = {
_POLLING_STRATEGIES = {
- 'linux': ['epoll', 'poll', 'legacy']
+ 'linux': ['epoll', 'poll', 'poll-cv', 'legacy']
}
diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py
index 60c21a1e21..550dd10ea5 100755
--- a/tools/run_tests/run_tests_matrix.py
+++ b/tools/run_tests/run_tests_matrix.py
@@ -36,13 +36,14 @@ import multiprocessing
import os
import report_utils
import sys
+from filter_pull_request_tests import filter_tests
_ROOT = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../..'))
os.chdir(_ROOT)
# Set the timeout high to allow enough time for sanitizers and pre-building
# clang docker.
-_RUNTESTS_TIMEOUT = 2*60*60
+_RUNTESTS_TIMEOUT = 4*60*60
# Number of jobs assigned to each run_tests.py instance
_INNER_JOBS = 2
@@ -231,6 +232,15 @@ argp.add_argument('--dry_run',
action='store_const',
const=True,
help='Only print what would be run.')
+argp.add_argument('--filter_pr_tests',
+ default=False,
+ action='store_const',
+ const=True,
+ help='Filters out tests irrelavant to pull request changes.')
+argp.add_argument('--base_branch',
+ default='origin/master',
+ type=str,
+ help='Branch that pull request is requesting to merge into')
args = argp.parse_args()
extra_args = []
@@ -264,6 +274,19 @@ for job in jobs:
print ' %s' % job.shortname
print
+if args.filter_pr_tests:
+ print 'IMPORTANT: Test filtering is not active; this is only for testing.'
+ relevant_jobs = filter_tests(jobs, args.base_branch)
+ # todo(mattkwong): add skipped tests to report.xml
+ print
+ if len(relevant_jobs) == len(jobs):
+ print '(TESTING) No tests will be skipped.'
+ else:
+ print '(TESTING) These tests will be skipped:'
+ for job in list(set(jobs) - set(relevant_jobs)):
+ print ' %s' % job.shortname
+ print
+
if args.dry_run:
print '--dry_run was used, exiting'
sys.exit(1)
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index 7619af1105..ef5269d350 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -2084,6 +2084,23 @@
"gpr",
"gpr_test_util",
"grpc",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "is_filegroup": false,
+ "language": "c",
+ "name": "wakeup_fd_cv_test",
+ "src": [
+ "test/core/iomgr/wakeup_fd_cv_test.c"
+ ],
+ "third_party": false,
+ "type": "target"
+ },
+ {
+ "deps": [
+ "gpr",
+ "gpr_test_util",
+ "grpc",
"grpc++",
"grpc++_test_util",
"grpc_test_util"
@@ -6425,6 +6442,7 @@
"src/core/lib/iomgr/timer_heap.h",
"src/core/lib/iomgr/udp_server.h",
"src/core/lib/iomgr/unix_sockets_posix.h",
+ "src/core/lib/iomgr/wakeup_fd_cv.h",
"src/core/lib/iomgr/wakeup_fd_pipe.h",
"src/core/lib/iomgr/wakeup_fd_posix.h",
"src/core/lib/iomgr/workqueue.h",
@@ -6576,6 +6594,8 @@
"src/core/lib/iomgr/unix_sockets_posix.c",
"src/core/lib/iomgr/unix_sockets_posix.h",
"src/core/lib/iomgr/unix_sockets_posix_noop.c",
+ "src/core/lib/iomgr/wakeup_fd_cv.c",
+ "src/core/lib/iomgr/wakeup_fd_cv.h",
"src/core/lib/iomgr/wakeup_fd_eventfd.c",
"src/core/lib/iomgr/wakeup_fd_nospecial.c",
"src/core/lib/iomgr/wakeup_fd_pipe.c",
diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json
index 7446aecdc1..3d48516873 100644
--- a/tools/run_tests/tests.json
+++ b/tools/run_tests/tests.json
@@ -2066,6 +2066,25 @@
"ci_platforms": [
"linux",
"mac",
+ "posix"
+ ],
+ "cpu_cost": 1.0,
+ "exclude_configs": [],
+ "flaky": false,
+ "gtest": false,
+ "language": "c",
+ "name": "wakeup_fd_cv_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix"
+ ]
+ },
+ {
+ "args": [],
+ "ci_platforms": [
+ "linux",
+ "mac",
"posix",
"windows"
],