diff options
author | ncteisen <ncteisen@gmail.com> | 2018-06-13 23:00:07 -0700 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2018-06-13 23:00:07 -0700 |
commit | f92460e539405bbca98af3547edd3150d0fcca40 (patch) | |
tree | dea35a54d1f6db8135df398c6e5a328ba3489609 /tools | |
parent | 19ac7c0baf298be51c0dbfa7d5bcd1f45eec7c78 (diff) | |
parent | 9a2c0a8641d1837185a60436adf9419209f89fbe (diff) |
Merge branch 'master' of https://github.com/grpc/grpc into channelz
Diffstat (limited to 'tools')
21 files changed, 1156 insertions, 99 deletions
diff --git a/tools/dockerfile/distribtest/csharp_wheezy_x64/Dockerfile b/tools/BUILD index fb9c82c92b..e0f2a80bb4 100644 --- a/tools/dockerfile/distribtest/csharp_wheezy_x64/Dockerfile +++ b/tools/BUILD @@ -1,4 +1,4 @@ -# Copyright 2015 gRPC authors. +# Copyright 2017 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,9 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM mono:4.4.2.11 - -# make sure we have nuget 2.12+ (in case there's an older cached docker image) -RUN apt-get update && apt-get install -y nuget - -RUN apt-get update && apt-get install -y unzip +exports_files([ + "lsan_suppressions.txt", + "tsan_suppressions.txt", + "ubsan_suppressions.txt", +]) diff --git a/tools/distrib/pylint_code.sh b/tools/distrib/pylint_code.sh index 013b6660eb..82a818cce5 100755 --- a/tools/distrib/pylint_code.sh +++ b/tools/distrib/pylint_code.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2017 gRPC authors. +# Copyright 2017 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,14 +35,15 @@ python -m virtualenv $VIRTUALENV PYTHON=$VIRTUALENV/bin/python $PYTHON -m pip install --upgrade pip==10.0.1 -$PYTHON -m pip install pylint==1.6.5 +$PYTHON -m pip install pylint==1.9.2 +EXIT=0 for dir in "${DIRS[@]}"; do - $PYTHON -m pylint --rcfile=.pylintrc -rn "$dir" || exit $? + $PYTHON -m pylint --rcfile=.pylintrc -rn "$dir" || EXIT=1 done for dir in "${TEST_DIRS[@]}"; do - $PYTHON -m pylint --rcfile=.pylintrc-tests -rn "$dir" || exit $? + $PYTHON -m pylint --rcfile=.pylintrc-tests -rn "$dir" || EXIT=1 done -exit 0 +exit $EXIT diff --git a/tools/distrib/run_clang_tidy.py b/tools/distrib/run_clang_tidy.py index 337e6b43c8..7ad1c160ba 100755 --- a/tools/distrib/run_clang_tidy.py +++ b/tools/distrib/run_clang_tidy.py @@ -24,12 +24,6 @@ sys.path.append( os.path.dirname(sys.argv[0]), '..', 'run_tests', 'python_utils')) import jobset -GRPC_CHECKS = [ - 'modernize-use-nullptr', - 'google-build-namespaces', - 'google-build-explicit-make-pair', -] - extra_args = [ '-x', 'c++', @@ -57,8 +51,6 @@ args = argp.parse_args() cmdline = [ clang_tidy, - '--checks=-*,%s' % ','.join(GRPC_CHECKS), - '--warnings-as-errors=%s' % ','.join(GRPC_CHECKS) ] + ['--extra-arg-before=%s' % arg for arg in extra_args] if args.fix: diff --git a/tools/dockerfile/distribtest/csharp_centos7_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_centos7_x64/Dockerfile index 088635b0ea..3e1faafdc0 100644 --- a/tools/dockerfile/distribtest/csharp_centos7_x64/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_centos7_x64/Dockerfile @@ -14,21 +14,11 @@ FROM centos:7 -RUN rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -RUN yum-config-manager --add-repo http://download.mono-project.com/repo/centos/ +RUN rpm --import "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" +RUN curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo -RUN yum install -y mono +RUN yum install -y mono-devel -RUN yum install -y unzip - -# --nogpgcheck because nuget-2.12 package is not signed. -RUN yum install -y nuget --nogpgcheck +RUN yum install -y nuget -# Help mono correctly locate libMonoPosixHelper.so -# as a workaround for issue https://bugzilla.xamarin.com/show_bug.cgi?id=42820 -# The error message you'll get without this workaround: -# ``` -# WARNING: /usr/lib/libMonoPosixHelper.so -# WARNING: Unable to read package from path 'Grpc.1.1.0-dev.nupkg'. -# ``` -RUN cp /usr/lib64/libMonoPosixHelper.so /usr/lib/ +RUN yum install -y unzip diff --git a/tools/dockerfile/distribtest/csharp_jessie_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_jessie_x64/Dockerfile index 02ec4c278a..03fb7a5343 100644 --- a/tools/dockerfile/distribtest/csharp_jessie_x64/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_jessie_x64/Dockerfile @@ -14,14 +14,13 @@ FROM debian:jessie +RUN apt-get update && apt-get install -y apt-transport-https && apt-get clean + RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian jessie main" | tee /etc/apt/sources.list.d/mono-official.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list +RUN echo "deb https://download.mono-project.com/repo/debian stable-jessie main" | tee /etc/apt/sources.list.d/mono-official-stable.list RUN apt-get update && apt-get install -y \ mono-devel \ - ca-certificates-mono \ nuget \ && apt-get clean diff --git a/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile b/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile index 758f314572..f2fa61a691 100644 --- a/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile @@ -14,14 +14,13 @@ FROM 32bit/debian:jessie +RUN apt-get update && apt-get install -y apt-transport-https && apt-get clean + RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian jessie main" | tee /etc/apt/sources.list.d/mono-official.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list +RUN echo "deb https://download.mono-project.com/repo/debian stable-jessie main" | tee /etc/apt/sources.list.d/mono-official-stable.list RUN apt-get update && apt-get install -y \ mono-devel \ - ca-certificates-mono \ nuget \ && apt-get clean diff --git a/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile index 10279c5925..3edc31e170 100644 --- a/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile @@ -14,15 +14,17 @@ FROM ubuntu:14.04 -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list +RUN apt-get update && apt-get install -y apt-transport-https && apt-get clean + +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-trusty main" | tee /etc/apt/sources.list.d/mono-official-stable.list RUN apt-get update && apt-get install -y \ mono-devel \ - ca-certificates-mono \ - nuget + nuget \ + && apt-get clean -RUN apt-get update && apt-get install -y unzip +RUN apt-get update && apt-get install -y unzip && apt-get clean # Install dotnet CLI RUN apt-get install -y apt-transport-https diff --git a/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile index 0f40f18e38..1a58f9784b 100644 --- a/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile @@ -14,19 +14,14 @@ FROM ubuntu:16.04 +RUN apt-get update && apt-get install -y apt-transport-https && apt-get clean + +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | tee /etc/apt/sources.list.d/mono-official-stable.list + RUN apt-get update && apt-get install -y \ mono-devel \ - ca-certificates-mono \ nuget \ && apt-get clean -# make sure we have nuget 2.12+ (in case there's an older cached docker image) -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list -RUN apt-get update && apt-get install -y nuget && apt-get clean - -# Prevent "Error: SendFailure (Error writing headers)" when fetching nuget packages -# See https://github.com/tianon/docker-brew-ubuntu-core/issues/86 -RUN apt-get update && apt-get install -y tzdata && apt-get clean - RUN apt-get update && apt-get install -y unzip && apt-get clean diff --git a/tools/dockerfile/interoptest/grpc_interop_python/build_interop.sh b/tools/dockerfile/interoptest/grpc_interop_python/build_interop.sh index a8898f85fa..7917e1cd60 100755 --- a/tools/dockerfile/interoptest/grpc_interop_python/build_interop.sh +++ b/tools/dockerfile/interoptest/grpc_interop_python/build_interop.sh @@ -28,4 +28,5 @@ cp -r /var/local/jenkins/service_account $HOME || true cd /var/local/git/grpc -tools/run_tests/run_tests.py -l python -c opt --build_only +# interop tests only run using python2.7 currently (and python build is slow) +tools/run_tests/run_tests.py -l python --compiler python2.7 -c opt --build_only diff --git a/tools/internal_ci/linux/grpc_tsan_on_foundry.sh b/tools/internal_ci/linux/grpc_tsan_on_foundry.sh index fafa1ceecb..cd4e354be6 100644 --- a/tools/internal_ci/linux/grpc_tsan_on_foundry.sh +++ b/tools/internal_ci/linux/grpc_tsan_on_foundry.sh @@ -14,5 +14,5 @@ # limitations under the License. export UPLOAD_TEST_RESULTS=true -EXTRA_FLAGS="--copt=-gmlt --strip=never --copt=-fsanitize=thread --linkopt=-fsanitize=thread --test_timeout=3600" +EXTRA_FLAGS="--copt=-gmlt --strip=never --copt=-fsanitize=thread --linkopt=-fsanitize=thread --test_timeout=3600 --action_env=TSAN_OPTIONS=suppressions=tools/tsan_suppressions.txt:halt_on_error=1:second_deadlock_stack=1" github/grpc/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh "${EXTRA_FLAGS}" diff --git a/tools/profiling/ios_bin/binary_diff.py b/tools/profiling/ios_bin/binary_diff.py new file mode 100755 index 0000000000..6d5ae65e46 --- /dev/null +++ b/tools/profiling/ios_bin/binary_diff.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python2.7 +# +# Copyright 2018 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 argparse +import glob +import multiprocessing +import os +import shutil +import subprocess +import sys +from parse_link_map import parse_link_map + +sys.path.append( + os.path.join( + os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils')) +import comment_on_pr + +size_labels = ('Core', 'ObjC', 'BoringSSL', 'Protobuf', 'Total') + +argp = argparse.ArgumentParser( + description='Binary size diff of gRPC Objective-C sample') + +argp.add_argument( + '-d', + '--diff_base', + type=str, + help='Commit or branch to compare the current one to') + +args = argp.parse_args() + + +def dir_size(dir): + total = 0 + for dirpath, dirnames, filenames in os.walk(dir): + for f in filenames: + fp = os.path.join(dirpath, f) + total += os.stat(fp).st_size + return total + + +def get_size(where, frameworks): + build_dir = 'src/objective-c/examples/Sample/Build-%s/' % where + if not frameworks: + link_map_filename = 'Build/Intermediates.noindex/Sample.build/Release-iphoneos/Sample.build/Sample-LinkMap-normal-arm64.txt' + return parse_link_map(build_dir + link_map_filename) + else: + framework_dir = 'Build/Products/Release-iphoneos/Sample.app/Frameworks/' + boringssl_size = dir_size( + build_dir + framework_dir + 'openssl.framework') + core_size = dir_size(build_dir + framework_dir + 'grpc.framework') + objc_size = dir_size(build_dir + framework_dir + 'GRPCClient.framework') + \ + dir_size(build_dir + framework_dir + 'RxLibrary.framework') + \ + dir_size(build_dir + framework_dir + 'ProtoRPC.framework') + protobuf_size = dir_size( + build_dir + framework_dir + 'Protobuf.framework') + app_size = dir_size( + build_dir + 'Build/Products/Release-iphoneos/Sample.app') + return core_size, objc_size, boringssl_size, protobuf_size, app_size + + +def build(where, frameworks): + shutil.rmtree( + 'src/objective-c/examples/Sample/Build-%s' % where, ignore_errors=True) + subprocess.check_call( + 'CONFIG=opt EXAMPLE_PATH=src/objective-c/examples/Sample SCHEME=Sample FRAMEWORKS=%s ./build_one_example.sh' + % ('YES' if frameworks else 'NO'), + shell=True, + cwd='src/objective-c/tests') + os.rename('src/objective-c/examples/Sample/Build', + 'src/objective-c/examples/Sample/Build-%s' % where) + + +text = '' +for frameworks in [False, True]: + build('new', frameworks) + new_size = get_size('new', frameworks) + old_size = None + + if args.diff_base: + old = 'old' + where_am_i = subprocess.check_output( + ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() + subprocess.check_call(['git', 'checkout', '--', '.']) + subprocess.check_call(['git', 'checkout', args.diff_base]) + subprocess.check_call(['git', 'submodule', 'update']) + try: + build('old', frameworks) + old_size = get_size('old', frameworks) + finally: + subprocess.check_call(['git', 'checkout', '--', '.']) + subprocess.check_call(['git', 'checkout', where_am_i]) + subprocess.check_call(['git', 'submodule', 'update']) + + text += ('****************FRAMEWORKS*****************\n' + if frameworks else '******************STATIC*******************\n') + row_format = "{:>10}{:>15}{:>15}" + '\n' + text += row_format.format('New size', '', 'Old size') + for i in range(0, len(size_labels)): + if old_size == None: + diff_sign = ' ' + elif new_size[i] == old_size[i]: + diff_sign = ' (=)' + elif new_size[i] > old_size[i]: + diff_sign = ' (>)' + else: + diff_sign = ' (<)' + text += ('\n' if i == len(size_labels) - 1 else '') + row_format.format( + '{:,}'.format(new_size[i]), size_labels[i] + diff_sign, + '{:,}'.format(old_size[i]) if old_size != None else '') + text += '\n' + +print text + +comment_on_pr.comment_on_pr('```\n%s\n```' % text) diff --git a/tools/profiling/ios_bin/parse_link_map.py b/tools/profiling/ios_bin/parse_link_map.py new file mode 100755 index 0000000000..eaa1d6e060 --- /dev/null +++ b/tools/profiling/ios_bin/parse_link_map.py @@ -0,0 +1,104 @@ +#!/usr/bin/python +# Copyright 2018 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. + +# This script analyzes link map file generated by Xcode. It calculates and +# prints out the sizes of each dependent library and the total sizes of the +# symbols. +# The script takes one parameter, which is the path to the link map file. + +import sys +import re + + +def parse_link_map(filename): + table_tag = {} + state = "start" + + table_stats_symbol = {} + table_stats_dead = {} + section_total_size = 0 + symbol_total_size = 0 + + boringssl_size = 0 + core_size = 0 + objc_size = 0 + protobuf_size = 0 + + lines = list(open(filename)) + for line in lines: + line_stripped = line[:-1] + if "# Object files:" == line_stripped: + state = "object" + continue + elif "# Sections:" == line_stripped: + state = "section" + continue + elif "# Symbols:" == line_stripped: + state = "symbol" + continue + elif "# Dead Stripped Symbols:" == line_stripped: + state = "dead" + continue + + if state == "object": + segs = re.search('(\[ *[0-9]*\]) (.*)', line_stripped) + table_tag[segs.group(1)] = segs.group(2) + + if state == "section": + if len(line_stripped) == 0 or line_stripped[0] == '#': + continue + segs = re.search('^(.+?)\s+(.+?)\s+.*', line_stripped) + section_total_size += int(segs.group(2), 16) + + if state == "symbol": + if len(line_stripped) == 0 or line_stripped[0] == '#': + continue + segs = re.search('^.+?\s+(.+?)\s+(\[.+?\]).*', line_stripped) + target = table_tag[segs.group(2)] + target_stripped = re.search('^(.*?)(\(.+?\))?$', target).group(1) + size = int(segs.group(1), 16) + if not target_stripped in table_stats_symbol: + table_stats_symbol[target_stripped] = 0 + table_stats_symbol[target_stripped] += size + if 'BoringSSL' in target_stripped: + boringssl_size += size + elif 'libgRPC-Core' in target_stripped: + core_size += size + elif 'libgRPC-RxLibrary' in target_stripped or \ + 'libgRPC' in target_stripped or \ + 'libgRPC-ProtoLibrary' in target_stripped: + objc_size += size + elif 'libProtobuf' in target_stripped: + protobuf_size += size + + for target in table_stats_symbol: + symbol_total_size += table_stats_symbol[target] + + return core_size, objc_size, boringssl_size, protobuf_size, symbol_total_size + + +def main(): + filename = sys.argv[1] + core_size, objc_size, boringssl_size, protobuf_size, total_size = parse_link_map( + filename) + print('Core size:{:,}'.format(core_size)) + print('ObjC size:{:,}'.format(objc_size)) + print('BoringSSL size:{:,}'.format(boringssl_size)) + print('Protobuf size:{:,}\n'.format(protobuf_size)) + print('Total size:{:,}'.format(total_size)) + + +if __name__ == "__main__": + main() diff --git a/tools/run_tests/artifacts/build_artifact_csharp.bat b/tools/run_tests/artifacts/build_artifact_csharp.bat index a84bc54157..ac2c92b716 100644 --- a/tools/run_tests/artifacts/build_artifact_csharp.bat +++ b/tools/run_tests/artifacts/build_artifact_csharp.bat @@ -19,11 +19,12 @@ set GRPC_SKIP_DOTNET_RESTORE=true @call tools\run_tests\helper_scripts\pre_build_csharp.bat %ARCHITECTURE% || goto :error cd cmake\build\%ARCHITECTURE% -cmake --build . --target grpc_csharp_ext --config Release +cmake --build . --target grpc_csharp_ext --config RelWithDebInfo cd ..\..\.. mkdir -p %ARTIFACTS_OUT% -copy /Y cmake\build\Win32\Release\grpc_csharp_ext.dll %ARTIFACTS_OUT% || copy /Y cmake\build\x64\Release\grpc_csharp_ext.dll %ARTIFACTS_OUT% || goto :error +copy /Y cmake\build\Win32\RelWithDebInfo\grpc_csharp_ext.dll %ARTIFACTS_OUT% || copy /Y cmake\build\x64\RelWithDebInfo\grpc_csharp_ext.dll %ARTIFACTS_OUT% || goto :error +copy /Y cmake\build\Win32\RelWithDebInfo\grpc_csharp_ext.pdb %ARTIFACTS_OUT% || copy /Y cmake\build\x64\RelWithDebInfo\grpc_csharp_ext.pdb %ARTIFACTS_OUT% || goto :error goto :EOF diff --git a/tools/run_tests/artifacts/distribtest_targets.py b/tools/run_tests/artifacts/distribtest_targets.py index 213325439e..e02f4bffcd 100644 --- a/tools/run_tests/artifacts/distribtest_targets.py +++ b/tools/run_tests/artifacts/distribtest_targets.py @@ -303,7 +303,6 @@ def targets(): CppDistribTest('linux', 'x64', 'jessie', 'cmake_as_submodule'), CppDistribTest('windows', 'x86', testcase='cmake'), CppDistribTest('windows', 'x86', testcase='cmake_as_externalproject'), - CSharpDistribTest('linux', 'x64', 'wheezy'), CSharpDistribTest('linux', 'x64', 'jessie'), CSharpDistribTest('linux', 'x86', 'jessie'), CSharpDistribTest('linux', 'x64', 'centos7'), diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 564f39b6ca..291cf87244 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -6567,6 +6567,26 @@ "gpr", "gpr_test_util", "grpc", + "grpc++", + "grpc++_test_config", + "grpc++_test_util", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "cancel_ares_query_test", + "src": [ + "test/cpp/naming/cancel_ares_query_test.cc" + ], + "third_party": false, + "type": "target" + }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", "grpc_test_util" ], "headers": [], @@ -8768,6 +8788,7 @@ "test/core/end2end/tests/max_message_length.cc", "test/core/end2end/tests/negative_deadline.cc", "test/core/end2end/tests/network_status_change.cc", + "test/core/end2end/tests/no_error_on_hotpath.cc", "test/core/end2end/tests/no_logging.cc", "test/core/end2end/tests/no_op.cc", "test/core/end2end/tests/payload.cc", @@ -8868,6 +8889,7 @@ "test/core/end2end/tests/max_message_length.cc", "test/core/end2end/tests/negative_deadline.cc", "test/core/end2end/tests/network_status_change.cc", + "test/core/end2end/tests/no_error_on_hotpath.cc", "test/core/end2end/tests/no_logging.cc", "test/core/end2end/tests/no_op.cc", "test/core/end2end/tests/payload.cc", @@ -9773,6 +9795,32 @@ { "deps": [ "gpr", + "gpr_base_headers", + "grpc_base_headers" + ], + "headers": [ + "src/core/lib/iomgr/cfstream_handle.h", + "src/core/lib/iomgr/endpoint_cfstream.h", + "src/core/lib/iomgr/error_cfstream.h" + ], + "is_filegroup": true, + "language": "c", + "name": "grpc_cfstream", + "src": [ + "src/core/lib/iomgr/cfstream_handle.cc", + "src/core/lib/iomgr/cfstream_handle.h", + "src/core/lib/iomgr/endpoint_cfstream.cc", + "src/core/lib/iomgr/endpoint_cfstream.h", + "src/core/lib/iomgr/error_cfstream.cc", + "src/core/lib/iomgr/error_cfstream.h", + "src/core/lib/iomgr/tcp_client_cfstream.cc" + ], + "third_party": false, + "type": "filegroup" + }, + { + "deps": [ + "gpr", "grpc_base" ], "headers": [ diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 83d4f32eb6..48031c2fd3 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -82,7 +82,7 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 10, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -5664,6 +5664,28 @@ }, { "args": [], + "benchmark": false, + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": true, + "language": "c++", + "name": "cancel_ares_query_test", + "platforms": [ + "linux", + "mac", + "posix" + ], + "uses_polling": true + }, + { + "args": [], "boringssl": true, "ci_platforms": [ "linux", @@ -7845,6 +7867,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_census_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -9620,6 +9665,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -11335,6 +11403,28 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_fakesec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -12928,6 +13018,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_fd_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -14289,6 +14402,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -15912,6 +16048,25 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -17504,6 +17659,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_op" ], "ci_platforms": [ @@ -19256,6 +19434,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+workarounds_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -21064,6 +21265,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_http_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -22903,6 +23128,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_load_reporting_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -24711,6 +24959,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_oauth2_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -27615,6 +27887,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -28863,6 +29159,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_op" ], "ci_platforms": [ @@ -30149,6 +30469,32 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [ + "msan" + ], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -31550,6 +31896,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -34475,6 +34844,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -35970,6 +36362,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "inproc_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -37193,6 +37608,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_census_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -38945,6 +39383,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -40532,6 +40993,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_fd_nosec_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -41870,6 +42354,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -43474,6 +43981,25 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_nosec_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -45043,6 +45569,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+trace_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_op" ], "ci_platforms": [ @@ -46772,6 +47321,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_full+workarounds_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -48556,6 +49128,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_http_proxy_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -50372,6 +50968,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "h2_load_reporting_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -53188,6 +53807,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -54412,6 +55055,30 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_op" ], "ci_platforms": [ @@ -55672,6 +56339,32 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [ + "msan" + ], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -57000,6 +57693,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], + "flaky": false, + "language": "c", + "name": "h2_uds_nosec_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ @@ -58472,6 +59188,29 @@ }, { "args": [ + "no_error_on_hotpath" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "language": "c", + "name": "inproc_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ "no_logging" ], "ci_platforms": [ diff --git a/tools/run_tests/python_utils/upload_rbe_results.py b/tools/run_tests/python_utils/upload_rbe_results.py index 5955b3792f..7236227f7c 100644 --- a/tools/run_tests/python_utils/upload_rbe_results.py +++ b/tools/run_tests/python_utils/upload_rbe_results.py @@ -125,7 +125,7 @@ def _get_resultstore_data(api_key, invocation_id): if __name__ == "__main__": - # Arguments are necessary if running in a non-Kokoro envrionment. + # Arguments are necessary if running in a non-Kokoro environment. argp = argparse.ArgumentParser(description='Upload RBE results.') argp.add_argument('--api_key', default='', type=str) argp.add_argument('--invocation_id', default='', type=str) @@ -175,8 +175,8 @@ if __name__ == "__main__": 'build_id': os.getenv('KOKORO_BUILD_NUMBER'), 'build_url': - 'https://sponge.corp.google.com/invocation?id=%s' % - os.getenv('KOKORO_BUILD_ID'), + 'https://source.cloud.google.com/results/invocations/%s' % + invocation_id, 'test_target': action['id']['targetId'], 'test_case': diff --git a/tools/run_tests/python_utils/upload_test_results.py b/tools/run_tests/python_utils/upload_test_results.py index 09dcd57ad4..cbb4c32a2a 100644 --- a/tools/run_tests/python_utils/upload_test_results.py +++ b/tools/run_tests/python_utils/upload_test_results.py @@ -86,6 +86,26 @@ def _get_build_metadata(test_results): test_results['job_name'] = job_name +def _insert_rows_with_retries(bq, bq_table, bq_rows): + """Insert rows to bq table. Retry on error.""" + # BigQuery sometimes fails with large uploads, so batch 1,000 rows at a time. + for i in range((len(bq_rows) / 1000) + 1): + max_retries = 3 + for attempt in range(max_retries): + if big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET_ID, + bq_table, + bq_rows[i * 1000:(i + 1) * 1000]): + break + else: + if attempt < max_retries - 1: + print('Error uploading result to bigquery, will retry.') + else: + print( + 'Error uploading result to bigquery, all attempts failed.' + ) + sys.exit(1) + + def upload_results_to_bq(resultset, bq_table, args, platform): """Upload test results to a BQ table. @@ -106,6 +126,7 @@ def upload_results_to_bq(resultset, bq_table, args, platform): partition_type=_PARTITION_TYPE, expiration_ms=_EXPIRATION_MS) + bq_rows = [] for shortname, results in six.iteritems(resultset): for result in results: test_results = {} @@ -124,23 +145,9 @@ def upload_results_to_bq(resultset, bq_table, args, platform): test_results['return_code'] = result.returncode test_results['test_name'] = shortname test_results['timestamp'] = time.strftime('%Y-%m-%d %H:%M:%S') - row = big_query_utils.make_row(str(uuid.uuid4()), test_results) - - # TODO(jtattermusch): rows are inserted one by one, very inefficient - max_retries = 3 - for attempt in range(max_retries): - if big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET_ID, - bq_table, [row]): - break - else: - if attempt < max_retries - 1: - print('Error uploading result to bigquery, will retry.') - else: - print( - 'Error uploading result to bigquery, all attempts failed.' - ) - sys.exit(1) + bq_rows.append(row) + _insert_rows_with_retries(bq, bq_table, bq_rows) def upload_interop_results_to_bq(resultset, bq_table, args): @@ -162,6 +169,7 @@ def upload_interop_results_to_bq(resultset, bq_table, args): partition_type=_PARTITION_TYPE, expiration_ms=_EXPIRATION_MS) + bq_rows = [] for shortname, results in six.iteritems(resultset): for result in results: test_results = {} @@ -175,17 +183,5 @@ def upload_interop_results_to_bq(resultset, bq_table, args): test_results['test_case'] = shortname.split(':')[3] test_results['timestamp'] = time.strftime('%Y-%m-%d %H:%M:%S') row = big_query_utils.make_row(str(uuid.uuid4()), test_results) - # TODO(jtattermusch): rows are inserted one by one, very inefficient - max_retries = 3 - for attempt in range(max_retries): - if big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET_ID, - bq_table, [row]): - break - else: - if attempt < max_retries - 1: - print('Error uploading result to bigquery, will retry.') - else: - print( - 'Error uploading result to bigquery, all attempts failed.' - ) - sys.exit(1) + bq_rows.append(row) + _insert_rows_with_retries(bq, bq_table, bq_rows) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 014fb7d33a..e04b13b24c 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1114,6 +1114,12 @@ class ObjCLanguage(object): 'SCHEME': 'SwiftSample', 'EXAMPLE_PATH': 'src/objective-c/examples/SwiftSample' }), + self.config.job_spec( + ['test/core/iomgr/ios/CFStreamTests/run_tests.sh'], + timeout_seconds=10 * 60, + shortname='cfstream-tests', + cpu_cost=1e6, + environ=_FORCE_ENVIRON_FOR_WRAPPERS), ] def pre_build_steps(self): @@ -1126,7 +1132,10 @@ class ObjCLanguage(object): return [] def build_steps(self): - return [['src/objective-c/tests/build_tests.sh']] + return [ + ['src/objective-c/tests/build_tests.sh'], + ['test/core/iomgr/ios/CFStreamTests/build_tests.sh'], + ] def post_tests_steps(self): return [] diff --git a/tools/run_tests/sanity/check_channel_arg_usage.py b/tools/run_tests/sanity/check_channel_arg_usage.py new file mode 100755 index 0000000000..bb9f9299c1 --- /dev/null +++ b/tools/run_tests/sanity/check_channel_arg_usage.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +# Copyright 2018 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. + +from __future__ import print_function + +import os +import sys + +os.chdir(os.path.join(os.path.dirname(sys.argv[0]), '../../..')) + +# set of files that are allowed to use the raw GRPC_ARG_* types +_EXCEPTIONS = set([ + 'src/core/lib/channel/channel_args.cc', + 'src/core/lib/channel/channel_args.h', +]) + +_BANNED = set([ + "GRPC_ARG_POINTER", + "GRPC_ARG_STRING", + "GRPC_ARG_INTEGER", +]) + +errors = 0 +num_files = 0 +for root, dirs, files in os.walk('src/core'): + for filename in files: + num_files += 1 + path = os.path.join(root, filename) + if path in _EXCEPTIONS: continue + with open(path) as f: + text = f.read() + for banned in _BANNED: + if banned in text: + print('Illegal use of "%s" in %s' % (banned, path)) + errors += 1 + +assert errors == 0 +# This check comes about from this issue: +# https://github.com/grpc/grpc/issues/15381 +# Basically, a change rendered this script useless and we did not realize it. +# This dumb check ensures that this type of issue doesn't occur again. +assert num_files > 300 # we definitely have more than 300 files diff --git a/tools/run_tests/sanity/core_banned_functions.py b/tools/run_tests/sanity/core_banned_functions.py index 1d3f2eba8a..8afd826453 100755 --- a/tools/run_tests/sanity/core_banned_functions.py +++ b/tools/run_tests/sanity/core_banned_functions.py @@ -30,7 +30,8 @@ BANNED_EXCEPT = { ['src/core/lib/slice/slice_buffer.cc'], 'grpc_slice_ref(': ['src/core/lib/slice/slice.cc'], 'grpc_slice_unref(': ['src/core/lib/slice/slice.cc'], - 'grpc_error_create(': ['src/core/lib/iomgr/error.cc'], + 'grpc_error_create(': + ['src/core/lib/iomgr/error.cc', 'src/core/lib/iomgr/error_cfstream.cc'], 'grpc_error_ref(': ['src/core/lib/iomgr/error.cc'], 'grpc_error_unref(': ['src/core/lib/iomgr/error.cc'], 'grpc_os_error(': ['src/core/lib/iomgr/error.cc'], |