diff options
-rw-r--r-- | BUILD | 1 | ||||
-rw-r--r-- | INSTALL.md | 4 | ||||
-rw-r--r-- | bazel/cc_grpc_library.bzl | 4 | ||||
-rw-r--r-- | examples/BUILD | 4 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/call.h | 5 | ||||
-rw-r--r-- | src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc | 2 | ||||
-rw-r--r-- | src/core/lib/debug/trace.cc | 4 | ||||
-rw-r--r-- | src/core/lib/support/murmur_hash.cc | 19 | ||||
-rw-r--r-- | test/cpp/util/BUILD | 100 | ||||
-rw-r--r-- | tools/internal_ci/linux/grpc_interop_matrix.cfg | 2 | ||||
-rwxr-xr-x | tools/run_tests/sanity/check_unsecure.sh | 24 | ||||
-rw-r--r-- | tools/run_tests/sanity/sanity_tests.yaml | 1 |
12 files changed, 145 insertions, 25 deletions
@@ -418,7 +418,6 @@ grpc_cc_library( ], external_deps = [ "nanopb", - "libssl", ], language = "c++", public_hdrs = [ diff --git a/INSTALL.md b/INSTALL.md index 15725bd188..a18f5690a4 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -94,6 +94,7 @@ on experience with the tools involved. ### Building using CMake (RECOMMENDED) Builds gRPC C and C++ with boringssl. +- Install [Git](https://git-scm.com/). - Install Visual Studio 2015 or 2017 (Visual C++ compiler will be used). - Install [CMake](https://cmake.org/download/). - Install [Active State Perl](https://www.activestate.com/activeperl/) (`choco install activeperl`) @@ -106,11 +107,14 @@ Builds gRPC C and C++ with boringssl. Please note that when using Ninja, you'll still need Visual C++ (part of Visual Studio) installed to be able to compile the C/C++ sources. ``` +> powershell git clone --recursive -b ((New-Object System.Net.WebClient).DownloadString(\"https://grpc.io/release\").Trim()) https://github.com/grpc/grpc +> cd grpc > md .build > cd .build > call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64 > cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release > cmake --build . +> ninja ``` #### cmake: Using Visual Studio 2015 (can only build with OPENSSL_NO_ASM). diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl index afc5543795..94781ed7ae 100644 --- a/bazel/cc_grpc_library.bzl +++ b/bazel/cc_grpc_library.bzl @@ -60,10 +60,10 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mo if use_external: # when this file is used by non-grpc projects - grpc_deps = ["//external:grpc++", "//external:grpc++_codegen_proto", + grpc_deps = ["//external:grpc++_codegen_proto", "//external:protobuf"] else: - grpc_deps = ["//:grpc++", "//:grpc++_codegen_proto", "//external:protobuf"] + grpc_deps = ["//:grpc++_codegen_proto", "//external:protobuf"] native.cc_library( name = name, diff --git a/examples/BUILD b/examples/BUILD index 3e9e508ec2..0f18cfa9ba 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -42,12 +42,12 @@ cc_binary( name = "greeter_client", srcs = ["cpp/helloworld/greeter_client.cc"], defines = ["BAZEL_BUILD"], - deps = [":helloworld"], + deps = [":helloworld", "//:grpc++"], ) cc_binary( name = "greeter_server", srcs = ["cpp/helloworld/greeter_server.cc"], defines = ["BAZEL_BUILD"], - deps = [":helloworld"], + deps = [":helloworld", "//:grpc++"], ) diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index 41e95866cf..af2c2b510c 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -313,11 +313,6 @@ class CallOpSendMessage { WriteOptions write_options_; }; -namespace internal { -template <class T> -T Example(); -} // namespace internal - template <class M> Status CallOpSendMessage::SendMessage(const M& message, WriteOptions options) { write_options_ = options; diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc index 6bbb4d5739..390da52e2f 100644 --- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc @@ -139,7 +139,7 @@ static bool parse_user_agent(grpc_mdelem md) { bool grpc_objc_specifier_seen = false; bool cronet_specifier_seen = false; char *major_version_str = user_agent_str, *minor_version_str; - long major_version, minor_version; + long major_version = 0, minor_version = 0; char* head = strtok(user_agent_str, " "); while (head != nullptr) { diff --git a/src/core/lib/debug/trace.cc b/src/core/lib/debug/trace.cc index 4c63983bdc..a76c1afb4c 100644 --- a/src/core/lib/debug/trace.cc +++ b/src/core/lib/debug/trace.cc @@ -75,8 +75,8 @@ void TraceFlagList::LogAllTracers() { } // Flags register themselves on the list during construction -TraceFlag::TraceFlag(bool default_enabled, const char* name) - : name_(name), value_(default_enabled) { +TraceFlag::TraceFlag(bool default_enabled, const char* name) : name_(name) { + set_enabled(default_enabled); TraceFlagList::Add(this); } diff --git a/src/core/lib/support/murmur_hash.cc b/src/core/lib/support/murmur_hash.cc index 4e08579a1d..2f0e71a53c 100644 --- a/src/core/lib/support/murmur_hash.cc +++ b/src/core/lib/support/murmur_hash.cc @@ -30,22 +30,19 @@ (h) ^= (h) >> 16; uint32_t gpr_murmur_hash3(const void* key, size_t len, uint32_t seed) { - const uint8_t* data = (const uint8_t*)key; - const size_t nblocks = len / 4; - int i; - uint32_t h1 = seed; uint32_t k1; const uint32_t c1 = 0xcc9e2d51; const uint32_t c2 = 0x1b873593; - const uint32_t* blocks = ((const uint32_t*)key) + nblocks; - const uint8_t* tail = (const uint8_t*)(data + nblocks * 4); + const uint8_t* keyptr = (const uint8_t*)key; + const size_t bsize = sizeof(k1); + const size_t nblocks = len / bsize; /* body */ - for (i = -(int)nblocks; i; i++) { - memcpy(&k1, blocks + i, sizeof(uint32_t)); + for (size_t i = 0; i < nblocks; i++, keyptr += bsize) { + memcpy(&k1, keyptr, bsize); k1 *= c1; k1 = ROTL32(k1, 15); @@ -61,13 +58,13 @@ uint32_t gpr_murmur_hash3(const void* key, size_t len, uint32_t seed) { /* tail */ switch (len & 3) { case 3: - k1 ^= ((uint32_t)tail[2]) << 16; + k1 ^= ((uint32_t)keyptr[2]) << 16; /* fallthrough */ case 2: - k1 ^= ((uint32_t)tail[1]) << 8; + k1 ^= ((uint32_t)keyptr[1]) << 8; /* fallthrough */ case 1: - k1 ^= tail[0]; + k1 ^= keyptr[0]; k1 *= c1; k1 = ROTL32(k1, 15); k1 *= c2; diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index 2559c18c32..19e15b1adf 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -43,6 +43,7 @@ grpc_cc_library( "proto_reflection_descriptor_database.h", ], deps = [ + "//:grpc++", "//:grpc++_config_proto", "//src/proto/grpc/reflection/v1alpha:reflection_proto", ], @@ -135,6 +136,105 @@ grpc_cc_library( ) grpc_cc_test( + name = "grpc_tool_test", + srcs = [ + "grpc_tool_test.cc", + ], + deps = [ + ":grpc_cli_libs", + ":test_util", + "//:grpc++_reflection", + "//src/proto/grpc/testing:echo_proto", + "//src/proto/grpc/testing:echo_messages_proto", + "//test/core/util:grpc_test_util", + ], + external_deps = [ + "gtest", + ], +) + +grpc_cc_test( + name = "byte_buffer_test", + srcs = [ + "byte_buffer_test.cc", + ], + deps = [ + ":test_util", + ], + external_deps = [ + "gtest", + ], +) + +grpc_cc_test( + name = "slice_test", + srcs = [ + "slice_test.cc", + ], + deps = [ + ":test_util", + ], + external_deps = [ + "gtest", + ], +) + +grpc_cc_test( + name = "string_ref_test", + srcs = [ + "string_ref_test.cc", + ], + deps = [ + "//:grpc++", + ], + external_deps = [ + "gtest", + ], +) + +grpc_cc_test( + name = "time_test", + srcs = [ + "time_test.cc", + ], + deps = [ + ":test_util", + ], + external_deps = [ + "gtest", + ], +) + +grpc_cc_test( + name = "status_test", + srcs = [ + "status_test.cc", + ], + deps = [ + ":test_util", + ], + external_deps = [ + "gtest", + ], +) + +grpc_cc_test( + name = "cli_call_test", + srcs = [ + "cli_call_test.cc", + ], + deps = [ + ":grpc_cli_libs", + ":test_util", + "//src/proto/grpc/testing:echo_proto", + "//test/core/util:grpc_test_util", + ], + external_deps = [ + "gtest", + ], +) + +grpc_cc_test( name = "error_details_test", srcs = [ "error_details_test.cc", diff --git a/tools/internal_ci/linux/grpc_interop_matrix.cfg b/tools/internal_ci/linux/grpc_interop_matrix.cfg index a7fd479a73..71e930e0b0 100644 --- a/tools/internal_ci/linux/grpc_interop_matrix.cfg +++ b/tools/internal_ci/linux/grpc_interop_matrix.cfg @@ -17,7 +17,7 @@ # Location of the continuous shell script in repository. build_file: "grpc/tools/internal_ci/linux/grpc_interop_matrix.sh" # grpc_interop tests can take 1 hours to complete. -timeout_mins: 60 +timeout_mins: 120 action { define_artifacts { regex: "**/sponge_log.xml" diff --git a/tools/run_tests/sanity/check_unsecure.sh b/tools/run_tests/sanity/check_unsecure.sh new file mode 100755 index 0000000000..aabafedfb8 --- /dev/null +++ b/tools/run_tests/sanity/check_unsecure.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# 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. +# 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. + + +set -e + +# Make sure that there is no path from a known unsecure target +# to an SSL library + +test `bazel query "somepath(//test/cpp/microbenchmarks:helpers, //external:libssl)" 2>/dev/null | wc -l` -eq 0 + +# Fall through with the exit code of that command diff --git a/tools/run_tests/sanity/sanity_tests.yaml b/tools/run_tests/sanity/sanity_tests.yaml index 81eec4d149..3ce864a8bd 100644 --- a/tools/run_tests/sanity/sanity_tests.yaml +++ b/tools/run_tests/sanity/sanity_tests.yaml @@ -6,6 +6,7 @@ - script: tools/run_tests/sanity/check_submodules.sh - script: tools/run_tests/sanity/check_test_filtering.py - script: tools/run_tests/sanity/check_tracer_sanity.py +- script: tools/run_tests/sanity/check_unsecure.sh - script: tools/run_tests/sanity/core_banned_functions.py - script: tools/run_tests/sanity/core_untyped_structs.sh - script: tools/buildgen/generate_projects.sh -j 3 |