From ee94700bb5eb97b51240b6da99d3a0233fcc6e1b Mon Sep 17 00:00:00 2001 From: htuch Date: Thu, 27 Apr 2017 13:23:07 -0400 Subject: [PATCH] build: remove cmake support. (#850) https://68.media.tumblr.com/tumblr_m1powhRVdz1rqnp16o1_r1_500.gif Fixes #415. --- CMakeLists.txt | 23 --- bazel/README.md | 2 +- bazel/envoy_build_system.bzl | 2 - bazel/target_recipes.bzl | 2 - ci/build_container/Makefile | 4 +- ci/build_container/build_recipes/cotire.sh | 5 - ci/build_setup.sh | 2 - common.cmake | 57 ------ docs/install/building.rst | 21 +-- docs/install/requirements.rst | 1 - source/CMakeLists.txt | 3 - source/common/CMakeLists.txt | 136 -------------- source/common/ratelimit/ratelimit_impl.h | 6 +- source/exe/CMakeLists.txt | 31 ---- source/server/CMakeLists.txt | 35 ---- test/CMakeLists.txt | 206 --------------------- test/common/grpc/codec_test.cc | 7 +- test/common/grpc/common_test.cc | 10 +- test/common/grpc/rpc_channel_impl_test.cc | 13 +- test/run_envoy_coverage.sh | 23 --- test/run_envoy_tests.sh | 48 ----- thirdparty.cmake | 72 ------- 22 files changed, 15 insertions(+), 694 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 ci/build_container/build_recipes/cotire.sh delete mode 100644 common.cmake delete mode 100644 source/CMakeLists.txt delete mode 100644 source/common/CMakeLists.txt delete mode 100644 source/exe/CMakeLists.txt delete mode 100644 source/server/CMakeLists.txt delete mode 100644 test/CMakeLists.txt delete mode 100755 test/run_envoy_coverage.sh delete mode 100755 test/run_envoy_tests.sh delete mode 100644 thirdparty.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index fe7c8d0344f4..000000000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -project(envoy CXX) - -include(common.cmake) -include(thirdparty.cmake) - -# Setup build ID via the linker. Also, statically link GCC libraries to lock GCC version. -execute_process(COMMAND git -C ${CMAKE_SOURCE_DIR} rev-parse --sq HEAD OUTPUT_VARIABLE GIT_COMMIT WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) -set(CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id=0x${GIT_COMMIT} -static-libstdc++ -static-libgcc ${ENVOY_EXE_EXTRA_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") - -include_directories(${PROJECT_SOURCE_DIR}/include) -include_directories(${PROJECT_BINARY_DIR}/source) -include_directories(${PROJECT_SOURCE_DIR}/source) -include_directories(SYSTEM ${ENVOY_SPDLOG_INCLUDE_DIR}) -include_directories(SYSTEM ${ENVOY_PROTOBUF_INCLUDE_DIR}) - -add_subdirectory(source) -add_subdirectory(test) - -set(CHECK_FORMAT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/tools/check_format.py) -add_custom_target(check_format ${CHECK_FORMAT_PATH} check ${CMAKE_SOURCE_DIR}) -add_custom_target(fix_format ${CHECK_FORMAT_PATH} fix ${CMAKE_SOURCE_DIR}) diff --git a/bazel/README.md b/bazel/README.md index 887f708bad27..1be74a6c3842 100644 --- a/bazel/README.md +++ b/bazel/README.md @@ -33,7 +33,7 @@ up-to-date with the latest security patches. Bazel can also be built with the Docker image used for CI, by installing Docker and executing: ``` -./ci/run_envoy_docker.sh ./ci/do_ci.sh bazel.debug +./ci/run_envoy_docker.sh ./ci/do_ci.sh bazel.fastbuild ``` See also the [documentation](https://github.com/lyft/envoy/tree/master/ci) for developer use of the diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl index a53bc9ebf8a8..fe5197455347 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -6,8 +6,6 @@ def envoy_package(): # Compute the final copts based on various options. def envoy_copts(repository, test = False): return [ - # TODO(htuch): Remove this when Bazel bringup is done. - "-DBAZEL_BRINGUP", "-Wall", "-Wextra", "-Werror", diff --git a/bazel/target_recipes.bzl b/bazel/target_recipes.bzl index bc53766c63d0..6a7f55f18085 100644 --- a/bazel/target_recipes.bzl +++ b/bazel/target_recipes.bzl @@ -4,8 +4,6 @@ TARGET_RECIPES = { "ares": "cares", "backward": "backward", - # TODO(htuch): Remove when cmake goes. - "cotire": "cotire", "event": "libevent", "event_pthreads": "libevent", # TODO(htuch): This shouldn't be a build recipe, it's a tooling dependency diff --git a/ci/build_container/Makefile b/ci/build_container/Makefile index 14ad66addfb0..d5976a175bd8 100644 --- a/ci/build_container/Makefile +++ b/ci/build_container/Makefile @@ -10,8 +10,8 @@ CXX ?= g++ # If $(BUILD_DISTINCT) is set in the make environment, the artifacts are built and installed in # distinct directories under $(THIRDPARTY_BUILD) and $(THIRDPARTY_SRC). They end up looking like -# $(THIRDPARTY_BUILD)/protobuf.dep/include, $(THIRDPARTY_BUILD)/cotire.dep/include etc. instead of -# all being under $(THIRDPARTY_BUILD)/include. +# $(THIRDPARTY_BUILD)/protobuf.dep/include, etc. instead of all being under +# $(THIRDPARTY_BUILD)/include. DISTINCT_PATH = $(if $(BUILD_DISTINCT),$(@F),) build-setup = rm -rf $@.build && \ diff --git a/ci/build_container/build_recipes/cotire.sh b/ci/build_container/build_recipes/cotire.sh deleted file mode 100644 index 2b603b1bbc85..000000000000 --- a/ci/build_container/build_recipes/cotire.sh +++ /dev/null @@ -1,5 +0,0 @@ -set -e - -wget https://github.com/sakra/cotire/archive/cotire-1.7.8.tar.gz -tar xf cotire-1.7.8.tar.gz -rsync -av cotire-cotire-1.7.8 $THIRDPARTY_SRC diff --git a/ci/build_setup.sh b/ci/build_setup.sh index ee09fcacf30c..30bc93e057fb 100755 --- a/ci/build_setup.sh +++ b/ci/build_setup.sh @@ -22,8 +22,6 @@ export HOME="${FAKE_HOME}" export PYTHONUSERBASE="${FAKE_HOME}" export BUILD_DIR=/build -# Make sure that "docker run" has a -v bind mount for /build, since cmake -# users will only have a bind mount for /source. if [[ ! -d "${BUILD_DIR}" ]] then echo "${BUILD_DIR} mount missing - did you forget -v :${BUILD_DIR}?" diff --git a/common.cmake b/common.cmake deleted file mode 100644 index d17ae92eb831..000000000000 --- a/common.cmake +++ /dev/null @@ -1,57 +0,0 @@ -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb3 -fno-omit-frame-pointer -Wall -Wextra -Werror -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast -std=c++0x") - -option(ENVOY_LIMIT_ERROR_LOG "limit the number of error log lines from compiler" OFF) -if (ENVOY_LIMIT_ERROR_LOG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=3") -endif() - -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9") - message(FATAL_ERROR "gcc >= 4.9 required for regex support") - endif() -endif() - -option(ENVOY_DEBUG "build debug binaries" ON) -option(ENVOY_CODE_COVERAGE "build with code coverage intrumentation" OFF) - -if (ENVOY_CODE_COVERAGE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage") - add_definitions(-DCOVERAGE) -endif() - -if (ENVOY_DEBUG AND NOT ENVOY_CODE_COVERAGE) - add_definitions(-DDEBUG) -else() - add_definitions(-DNDEBUG) -endif() - -if (ENVOY_DEBUG OR ENVOY_CODE_COVERAGE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0") -else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") -endif() - -option(ENVOY_SANITIZE "build with address sanitizer" OFF) -if (ENVOY_SANITIZE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") - set(ENVOY_TCMALLOC OFF CACHE BOOL "" FORCE) -endif() - -option(ENVOY_TCMALLOC "build with tcmalloc" ON) -if (ENVOY_TCMALLOC) - add_definitions(-DTCMALLOC) -endif() - -option(ENVOY_STRIP "strip symbols from binaries" OFF) - -option(ENVOY_USE_CCACHE "build with ccache" OFF) -if (ENVOY_USE_CCACHE) - find_program(CCACHE_FOUND ccache) - if (CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) - endif() -endif() - -set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${ENVOY_COTIRE_MODULE_DIR}") -include(cotire) diff --git a/docs/install/building.rst b/docs/install/building.rst index 47d439a4568b..b1b4740ae877 100644 --- a/docs/install/building.rst +++ b/docs/install/building.rst @@ -1,23 +1,8 @@ Building ======== -The Envoy build system uses cmake. In order to ease initial building and for a quick start, we -provide an Ubuntu 14 based docker container that has everything needed inside of it to build +The Envoy build system uses Bazel. In order to ease initial building and for a quick start, we +provide an Ubuntu 16 based docker container that has everything needed inside of it to build and *statically link* envoy, see :repo:`ci/README.md`. -In order to build manually, cmake is used like so: - -.. code-block:: console - - mkdir build - cd build - cmake .. - make - -Note that in order for the above raw build to work, cmake variables will need to be configured so -that the envoy build can find all of the needed third party dependencies (other variables are also -available to turn on debug builds, address sanitizer, etc.). - -* :repo:`CMakeLists.txt` -* :repo:`common.cmake` -* :repo:`thirdparty.cmake` +In order to build manually, follow the instructions at :repo:`bazel/README.md`. diff --git a/docs/install/requirements.rst b/docs/install/requirements.rst index 20b690116915..1249046720dc 100644 --- a/docs/install/requirements.rst +++ b/docs/install/requirements.rst @@ -9,7 +9,6 @@ recent Linux including Ubuntu 16 LTS. Envoy has the following requirements: * GCC 4.9+ (for C++11 regex support) -* `cotire `_ (last tested with 1.7.8) * `spdlog `_ (last tested with 0.11.0) * `http-parser `_ (last tested with 2.7.0) * `nghttp2 `_ (last tested with 1.20.0) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt deleted file mode 100644 index 52e699aadb35..000000000000 --- a/source/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(common) -add_subdirectory(exe) -add_subdirectory(server) diff --git a/source/common/CMakeLists.txt b/source/common/CMakeLists.txt deleted file mode 100644 index 89dbe630f0eb..000000000000 --- a/source/common/CMakeLists.txt +++ /dev/null @@ -1,136 +0,0 @@ -set(gen_git_sha_target ${CMAKE_CURRENT_BINARY_DIR}/version_generated.cc) -add_custom_target( - gen_git_sha ALL - COMMAND ${PROJECT_SOURCE_DIR}/tools/gen_git_sha.sh ${CMAKE_SOURCE_DIR} ${gen_git_sha_target}) - -add_custom_command( - OUTPUT ${gen_git_sha_target} - DEPENDS gen_git_sha) - -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated) -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated/ratelimit.pb.h ${CMAKE_CURRENT_BINARY_DIR}/generated/ratelimit.pb.cc - COMMAND ${ENVOY_PROTOBUF_PROTOC} -I=${CMAKE_CURRENT_SOURCE_DIR}/ratelimit/ - --cpp_out=${CMAKE_CURRENT_BINARY_DIR}/generated - ${CMAKE_CURRENT_SOURCE_DIR}/ratelimit/ratelimit.proto - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ratelimit/ratelimit.proto -) - -set_source_files_properties(generated/ratelimit.pb.cc PROPERTIES COMPILE_FLAGS -Wno-unused-parameter) - -add_library( - envoy-common OBJECT - api/api_impl.cc - access_log/access_log_manager_impl.cc - buffer/buffer_impl.cc - common/base64.cc - common/hex.cc - common/logger.cc - common/thread.cc - common/utility.cc - common/version.cc - dynamo/dynamo_filter.cc - dynamo/dynamo_request_parser.cc - dynamo/dynamo_utility.cc - event/dispatcher_impl.cc - event/event_impl_base.cc - event/file_event_impl.cc - event/libevent.cc - event/signal_impl.cc - event/timer_impl.cc - filesystem/filesystem_impl.cc - filesystem/watcher_impl.cc - filter/auth/client_ssl.cc - filter/echo.cc - filter/ratelimit.cc - filter/tcp_proxy.cc - generated/ratelimit.pb.cc - grpc/codec.cc - grpc/common.cc - grpc/http1_bridge_filter.cc - grpc/rpc_channel_impl.cc - http/access_log/access_log_formatter.cc - http/access_log/access_log_impl.cc - http/async_client_impl.cc - http/codec_client.cc - http/codes.cc - http/conn_manager_impl.cc - http/conn_manager_utility.cc - http/date_provider_impl.cc - http/header_map_impl.cc - http/message_impl.cc - http/http1/codec_impl.cc - http/http1/conn_pool.cc - http/http2/codec_impl.cc - http/http2/conn_pool.cc - http/filter/buffer_filter.cc - http/filter/fault_filter.cc - http/filter/ratelimit.cc - http/rest_api_fetcher.cc - http/user_agent.cc - http/utility.cc - json/config_schemas.cc - json/json_loader.cc - memory/stats.cc - mongo/bson_impl.cc - mongo/codec_impl.cc - mongo/proxy.cc - mongo/utility.cc - network/address_impl.cc - network/cidr_range.cc - network/connection_impl.cc - network/dns_impl.cc - network/filter_manager_impl.cc - network/listener_impl.cc - network/listen_socket_impl.cc - network/proxy_protocol.cc - network/utility.cc - profiler/profiler.cc - ratelimit/ratelimit_impl.cc - redis/codec_impl.cc - redis/command_splitter_impl.cc - redis/conn_pool_impl.cc - redis/proxy_filter.cc - router/config_impl.cc - router/config_utility.cc - router/rds_impl.cc - router/retry_state_impl.cc - router/router.cc - router/router_ratelimit.cc - router/shadow_writer_impl.cc - runtime/runtime_impl.cc - runtime/uuid_util.cc - ssl/connection_impl.cc - ssl/context_config_impl.cc - ssl/context_impl.cc - ssl/context_manager_impl.cc - stats/stats_impl.cc - stats/statsd.cc - stats/thread_local_store.cc - thread_local/thread_local_impl.cc - tracing/http_tracer_impl.cc - tracing/lightstep_tracer_impl.cc - upstream/cds_api_impl.cc - upstream/cluster_manager_impl.cc - upstream/health_checker_impl.cc - upstream/host_utility.cc - upstream/load_balancer_impl.cc - upstream/logical_dns_cluster.cc - upstream/outlier_detection_impl.cc - upstream/ring_hash_lb.cc - upstream/sds.cc - upstream/upstream_impl.cc - ${gen_git_sha_target}) - -include_directories(SYSTEM ${ENVOY_HTTP_PARSER_INCLUDE_DIR}) -include_directories(${ENVOY_RAPIDJSON_INCLUDE_DIR}) - -if (NOT ENVOY_SANITIZE) - include_directories(${ENVOY_GPERFTOOLS_INCLUDE_DIR}) -endif() - -include_directories(${ENVOY_CARES_INCLUDE_DIR}) -include_directories(${ENVOY_LIBEVENT_INCLUDE_DIR}) -include_directories(${ENVOY_NGHTTP2_INCLUDE_DIR}) -include_directories(SYSTEM ${ENVOY_OPENSSL_INCLUDE_DIR}) -include_directories(SYSTEM ${ENVOY_LIGHTSTEP_TRACER_INCLUDE_DIR}) diff --git a/source/common/ratelimit/ratelimit_impl.h b/source/common/ratelimit/ratelimit_impl.h index 9e868d360e6a..7897441f5cf1 100644 --- a/source/common/ratelimit/ratelimit_impl.h +++ b/source/common/ratelimit/ratelimit_impl.h @@ -10,12 +10,8 @@ #include "envoy/tracing/context.h" #include "envoy/upstream/cluster_manager.h" -#ifdef BAZEL_BRINGUP -#include "common/ratelimit/ratelimit.pb.h" -#else -#include "common/generated/ratelimit.pb.h" -#endif #include "common/json/json_loader.h" +#include "common/ratelimit/ratelimit.pb.h" namespace RateLimit { diff --git a/source/exe/CMakeLists.txt b/source/exe/CMakeLists.txt deleted file mode 100644 index 0348c0226edf..000000000000 --- a/source/exe/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -add_executable(envoy hot_restart.cc main.cc $ $ ${ENVOY_EXE_EXTRA_OBJECTS}) - -if (ENVOY_TCMALLOC) - target_link_libraries(envoy tcmalloc_and_profiler) -endif() - -target_link_libraries(envoy event) -target_link_libraries(envoy event_pthreads) -target_link_libraries(envoy http_parser) -target_link_libraries(envoy ssl) -target_link_libraries(envoy crypto) -target_link_libraries(envoy nghttp2) -target_link_libraries(envoy lightstep_core_cxx11) -target_link_libraries(envoy cares) -target_link_libraries(envoy protobuf) -target_link_libraries(envoy pthread) -target_link_libraries(envoy anl) -target_link_libraries(envoy rt) -target_link_libraries(envoy dl) - -include_directories(SYSTEM ${ENVOY_OPENSSL_INCLUDE_DIR}) -include_directories(SYSTEM ${ENVOY_LIGHTSTEP_TRACER_INCLUDE_DIR}) -include_directories(SYSTEM ${ENVOY_CARES_INCLUDE_DIR}) - -if (ENVOY_STRIP) - add_custom_command(TARGET envoy POST_BUILD - COMMAND objcopy --only-keep-debug $ $.dbg - COMMAND strip $ - COMMAND objcopy --add-gnu-debuglink=$.dbg $ - ) -endif() diff --git a/source/server/CMakeLists.txt b/source/server/CMakeLists.txt deleted file mode 100644 index 968306274f54..000000000000 --- a/source/server/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -add_library(envoy-server OBJECT - config/http/buffer.cc - config/http/dynamo.cc - config/http/fault.cc - config/http/grpc_http1_bridge.cc - config/http/ratelimit.cc - config/http/router.cc - config/network/client_ssl_auth.cc - config/network/echo.cc - config/network/http_connection_manager.cc - config/network/mongo_proxy.cc - config/network/ratelimit.cc - config/network/redis_proxy.cc - config/network/tcp_proxy.cc - configuration_impl.cc - connection_handler_impl.cc - drain_manager_impl.cc - guarddog_impl.cc - http/admin.cc - http/health_check.cc - options_impl.cc - server.cc - watchdog_impl.cc - worker.cc) - -include_directories(SYSTEM ${ENVOY_TCLAP_INCLUDE_DIR}) -include_directories(SYSTEM ${ENVOY_HTTP_PARSER_INCLUDE_DIR}) -include_directories(${ENVOY_NGHTTP2_INCLUDE_DIR}) -include_directories(SYSTEM ${ENVOY_OPENSSL_INCLUDE_DIR}) -include_directories(SYSTEM ${ENVOY_LIGHTSTEP_TRACER_INCLUDE_DIR}) -include_directories(${ENVOY_LIBEVENT_INCLUDE_DIR}) - -# Needed due to generated proto headers. There is probably a way to have this only depend on the -# generation of the header but I don't feel like figuring that out right now. -add_dependencies(envoy-server envoy-common) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 9ffe8aab94db..000000000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,206 +0,0 @@ -set(CMAKE_EXE_LINKER_FLAGS "${ENVOY_TEST_EXTRA_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") - -# TODO: Generic function for building protos -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated) -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated/helloworld.pb.h ${CMAKE_CURRENT_BINARY_DIR}/generated/helloworld.pb.cc - COMMAND ${ENVOY_PROTOBUF_PROTOC} -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ - --cpp_out=${CMAKE_CURRENT_BINARY_DIR}/generated - ${CMAKE_CURRENT_SOURCE_DIR}/proto/helloworld.proto - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/proto/helloworld.proto -) - -set_source_files_properties(generated/helloworld.pb.cc PROPERTIES COMPILE_FLAGS -Wno-unused-parameter) - -include_directories(${ENVOY_GMOCK_INCLUDE_DIR}) -include_directories(${ENVOY_GTEST_INCLUDE_DIR}) -include_directories(SYSTEM ${ENVOY_HTTP_PARSER_INCLUDE_DIR}) -include_directories(${PROJECT_SOURCE_DIR}) -include_directories(${PROJECT_BINARY_DIR}) -include_directories(SYSTEM ${ENVOY_OPENSSL_INCLUDE_DIR}) -include_directories(${ENVOY_NGHTTP2_INCLUDE_DIR}) -include_directories(SYSTEM ${ENVOY_CARES_INCLUDE_DIR}) -include_directories(SYSTEM ${ENVOY_LIGHTSTEP_TRACER_INCLUDE_DIR}) -include_directories(${ENVOY_LIBEVENT_INCLUDE_DIR}) - -add_executable(envoy-test - $ - $ - ${ENVOY_TEST_EXTRA_OBJECTS} - common/access_log/access_log_manager_impl_test.cc - common/api/api_impl_test.cc - common/common/base64_test.cc - common/common/hex_test.cc - common/common/optional_test.cc - common/common/utility_test.cc - common/event/dispatcher_impl_test.cc - common/event/file_event_impl_test.cc - common/filesystem/filesystem_impl_test.cc - common/filesystem/watcher_impl_test.cc - common/grpc/codec_test.cc - common/grpc/common_test.cc - common/grpc/http1_bridge_filter_test.cc - common/grpc/rpc_channel_impl_test.cc - common/http/access_log/access_log_formatter_test.cc - common/http/access_log/access_log_impl_test.cc - common/http/async_client_impl_test.cc - common/http/codec_client_test.cc - common/http/codes_test.cc - common/http/common.cc - common/http/conn_manager_impl_test.cc - common/http/conn_manager_utility_test.cc - common/http/date_provider_impl_test.cc - common/http/filter/buffer_filter_test.cc - common/http/filter/fault_filter_test.cc - common/http/filter/ratelimit_test.cc - common/http/header_map_impl_test.cc - common/http/http1/codec_impl_test.cc - common/http/http1/conn_pool_test.cc - common/http/http2/codec_impl_test.cc - common/http/http2/conn_pool_test.cc - common/http/user_agent_test.cc - common/http/utility_test.cc - common/filter/auth/client_ssl_test.cc - common/filter/ratelimit_test.cc - common/filter/tcp_proxy_test.cc - common/dynamo/dynamo_filter_test.cc - common/dynamo/dynamo_request_parser_test.cc - common/dynamo/dynamo_utility_test.cc - common/json/json_loader_test.cc - common/mongo/bson_impl_test.cc - common/mongo/codec_impl_test.cc - common/mongo/proxy_test.cc - common/mongo/utility_test.cc - common/network/address_impl_test.cc - common/network/cidr_range_test.cc - common/network/connection_impl_test.cc - common/network/dns_impl_test.cc - common/network/filter_manager_impl_test.cc - common/network/listener_impl_test.cc - common/network/listen_socket_impl_test.cc - common/network/proxy_protocol_test.cc - common/network/utility_test.cc - common/ratelimit/ratelimit_impl_test.cc - common/redis/codec_impl_test.cc - common/redis/command_splitter_impl_test.cc - common/redis/conn_pool_impl_test.cc - common/redis/proxy_filter_test.cc - common/router/config_impl_test.cc - common/router/rds_impl_test.cc - common/router/retry_state_impl_test.cc - common/router/router_test.cc - common/router/router_ratelimit_test.cc - common/router/shadow_writer_impl_test.cc - common/runtime/runtime_impl_test.cc - common/runtime/uuid_util_test.cc - common/ssl/connection_impl_test.cc - common/ssl/context_impl_test.cc - common/stats/stats_impl_test.cc - common/stats/statsd_test.cc - common/stats/thread_local_store_test.cc - common/tracing/http_tracer_impl_test.cc - common/tracing/lightstep_tracer_impl_test.cc - common/upstream/cds_api_impl_test.cc - common/upstream/cluster_manager_impl_test.cc - common/upstream/health_checker_impl_test.cc - common/upstream/host_utility_test.cc - common/upstream/load_balancer_impl_test.cc - common/upstream/load_balancer_simulation_test.cc - common/upstream/logical_dns_cluster_test.cc - common/upstream/outlier_detection_impl_test.cc - common/upstream/resource_manager_impl_test.cc - common/upstream/ring_hash_lb_test.cc - common/upstream/sds_test.cc - common/upstream/upstream_impl_test.cc - generated/helloworld.pb.cc - integration/fake_upstream.cc - integration/http2_integration_test.cc - integration/http2_upstream_integration_test.cc - integration/integration.cc - integration/integration_test.cc - integration/integration_admin_test.cc - integration/proxy_proto_integration_test.cc - integration/ssl_integration_test.cc - integration/uds_integration_test.cc - integration/server.cc - integration/utility.cc - main.cc - mocks/access_log/mocks.cc - mocks/api/mocks.cc - mocks/common.cc - mocks/event/mocks.cc - mocks/filesystem/mocks.cc - mocks/grpc/mocks.cc - mocks/http/mocks.cc - mocks/init/mocks.cc - mocks/local_info/mocks.cc - mocks/network/mocks.cc - mocks/ratelimit/mocks.cc - mocks/redis/mocks.cc - mocks/router/mocks.cc - mocks/runtime/mocks.cc - mocks/server/mocks.cc - mocks/ssl/mocks.cc - mocks/stats/mocks.cc - mocks/thread_local/mocks.cc - mocks/tracing/mocks.cc - mocks/upstream/mocks.cc - server/config/http/config_test.cc - server/config/network/config_test.cc - server/config/network/http_connection_manager_test.cc - server/configuration_impl_test.cc - server/connection_handler_test.cc - server/drain_manager_impl_test.cc - server/guarddog_impl_test.cc - server/http/admin_test.cc - server/http/health_check_test.cc - server/options_impl_test.cc - server/server_test.cc - test_common/environment.cc - test_common/network_utility.cc - test_common/network_utility_test.cc - test_common/printers.cc - test_common/utility.cc) - -# The MOCK_METHOD* macros from gtest triggers this clang warning and it's hard -# to work around, so we just ignore it. -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set_target_properties(envoy-test PROPERTIES COMPILE_FLAGS "-Wno-inconsistent-missing-override") -endif() - -if (ENVOY_TCMALLOC) - target_link_libraries(envoy-test tcmalloc_and_profiler) -endif() - -target_link_libraries(envoy-test event) -target_link_libraries(envoy-test event_pthreads) -target_link_libraries(envoy-test http_parser) -target_link_libraries(envoy-test ssl) -target_link_libraries(envoy-test crypto) -target_link_libraries(envoy-test nghttp2) -target_link_libraries(envoy-test lightstep_core_cxx11) -target_link_libraries(envoy-test cares) -target_link_libraries(envoy-test protobuf) -target_link_libraries(envoy-test gmock) -target_link_libraries(envoy-test pthread) -target_link_libraries(envoy-test anl) -target_link_libraries(envoy-test dl) - -set(ENVOY_TEST_EXTRA_SETUP_SCRIPT "" CACHE STRING - "extra setup script to call from run_envoy_tests.sh after basic setup") - -add_custom_target( - ${PROJECT_NAME}.check ${PROJECT_SOURCE_DIR}/test/run_envoy_tests.sh ${PROJECT_SOURCE_DIR} - ${PROJECT_BINARY_DIR} ${ENVOY_TEST_EXTRA_SETUP_SCRIPT} - DEPENDS envoy envoy-test -) - -if (ENVOY_CODE_COVERAGE) -add_custom_target( - ${PROJECT_NAME}.check-coverage - DEPENDS envoy envoy-test - COMMAND ${PROJECT_SOURCE_DIR}/test/run_envoy_coverage.sh ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} - ${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR} ${ENVOY_GCOVR} ${ENVOY_GCOVR_EXTRA_ARGS} - ${ENVOY_TEST_EXTRA_SETUP_SCRIPT} -) -endif() diff --git a/test/common/grpc/codec_test.cc b/test/common/grpc/codec_test.cc index 76fb2d39a6b9..791a46616af5 100644 --- a/test/common/grpc/codec_test.cc +++ b/test/common/grpc/codec_test.cc @@ -6,16 +6,11 @@ #include "common/buffer/buffer_impl.h" #include "common/grpc/codec.h" +#include "test/proto/helloworld.pb.h" #include "test/test_common/printers.h" #include "gtest/gtest.h" -#ifdef BAZEL_BRINGUP -#include "test/proto/helloworld.pb.h" -#else -#include "test/generated/helloworld.pb.h" -#endif - namespace Grpc { TEST(GrpcCodecTest, encodeHeader) { diff --git a/test/common/grpc/common_test.cc b/test/common/grpc/common_test.cc index 7788e682d17a..8a5701ca251a 100644 --- a/test/common/grpc/common_test.cc +++ b/test/common/grpc/common_test.cc @@ -1,14 +1,10 @@ #include "common/grpc/common.h" #include "common/http/headers.h" -#include "gtest/gtest.h" - -#ifdef BAZEL_BRINGUP -#include "test/proto/helloworld.pb.h" -#else -#include "test/generated/helloworld.pb.h" -#endif #include "test/mocks/upstream/mocks.h" +#include "test/proto/helloworld.pb.h" + +#include "gtest/gtest.h" namespace Grpc { diff --git a/test/common/grpc/rpc_channel_impl_test.cc b/test/common/grpc/rpc_channel_impl_test.cc index 16c7f4de8d44..95e5e035dfdf 100644 --- a/test/common/grpc/rpc_channel_impl_test.cc +++ b/test/common/grpc/rpc_channel_impl_test.cc @@ -6,20 +6,15 @@ #include "common/grpc/rpc_channel_impl.h" #include "common/http/message_impl.h" +#include "test/mocks/grpc/mocks.h" +#include "test/mocks/upstream/mocks.h" +#include "test/proto/helloworld.pb.h" #include "test/test_common/printers.h" +#include "test/test_common/utility.h" #include "gmock/gmock.h" #include "gtest/gtest.h" -#ifdef BAZEL_BRINGUP -#include "test/proto/helloworld.pb.h" -#else -#include "test/generated/helloworld.pb.h" -#endif -#include "test/mocks/grpc/mocks.h" -#include "test/mocks/upstream/mocks.h" -#include "test/test_common/utility.h" - using testing::_; using testing::Invoke; using testing::Return; diff --git a/test/run_envoy_coverage.sh b/test/run_envoy_coverage.sh deleted file mode 100755 index 310bf9f1d5f3..000000000000 --- a/test/run_envoy_coverage.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -BINARY_DIR=$1 -SOURCE_DIR=$2 -PROJECT_SOURCE_DIR=$3 -PROJECT_BINARY_DIR=$4 -GCOVR=$5 -GCOVR_EXTRA_ARGS=$6 -EXTRA_SETUP_SCRIPT=$7 - -find $BINARY_DIR -name *.gcda -exec rm {} \; -$PROJECT_SOURCE_DIR/test/run_envoy_tests.sh $PROJECT_SOURCE_DIR $PROJECT_BINARY_DIR "$EXTRA_SETUP_SCRIPT" -$GCOVR $GCOVR_EXTRA_ARGS -r $SOURCE_DIR --html --html-details -o $BINARY_DIR/coverage.html --exclude-unreachable-branches --print-summary > coverage_summary.txt - -coverage_value=`grep -Po 'lines: \K(\d|\.)*' coverage_summary.txt` -coverage_threshold=98.0 -coverage_failed=`echo "$coverage_value<$coverage_threshold" | bc` -if test $coverage_failed -eq 1; then - echo Code coverage $coverage_value is lower than limit of $coverage_threshold - exit 1 -else - echo Code coverage $coverage_value is good and higher than limit of $coverage_threshold -fi diff --git a/test/run_envoy_tests.sh b/test/run_envoy_tests.sh deleted file mode 100755 index 0fa6dbc5c713..000000000000 --- a/test/run_envoy_tests.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -set -e - -SOURCE_DIR=$1 -BINARY_DIR=$2 -EXTRA_SETUP_SCRIPT=$3 - -# These directories have the Bazel meaning described at -# https://bazel.build/versions/master/docs/test-encyclopedia.html. In particular, TEST_SRCDIR is -# where we expect to find the generated outputs of various scripts preparing input data (these are -# not only the actual source files!). -# It is a precondition that both $TEST_TMPDIR and $TEST_SRCDIR are empty. -if [ -z "$TEST_TMPDIR" ] || [ -z "$TEST_SRCDIR" ] -then - TEST_BASE=/tmp/envoy_test - echo "Cleaning $TEST_BASE" - rm -rf $TEST_BASE -fi -: ${TEST_TMPDIR:=$TEST_BASE/tmp} -: ${TEST_SRCDIR:=$TEST_BASE/runfiles} -export TEST_TMPDIR TEST_SRCDIR -export TEST_WORKSPACE="" -export TEST_RUNDIR="${TEST_SRCDIR}" -export TEST_UDSDIR="$TEST_TMPDIR" - -echo "TEST_TMPDIR=$TEST_TMPDIR" -echo "TEST_SRCDIR=$TEST_SRCDIR" - -mkdir -p $TEST_TMPDIR -mkdir -p $TEST_RUNDIR -ln -sf "${SOURCE_DIR}/test" "${TEST_RUNDIR}" - -if [ -n "$EXTRA_SETUP_SCRIPT" ]; then - $EXTRA_SETUP_SCRIPT -fi - -# First run the normal unit test suite -cd $SOURCE_DIR -$RUN_TEST_UNDER $BINARY_DIR/test/envoy-test $EXTRA_TEST_ARGS - -if [ "$UNIT_TEST_ONLY" = "1" ] -then - exit 0 -fi - -export ENVOY_BIN="$BINARY_DIR"/source/exe/envoy -"$SOURCE_DIR"/test/integration/hotrestart_test.sh diff --git a/thirdparty.cmake b/thirdparty.cmake deleted file mode 100644 index d82b93008dee..000000000000 --- a/thirdparty.cmake +++ /dev/null @@ -1,72 +0,0 @@ -# NOTE: These are all of the third party requirements required to build Envoy. We realize this is -# not the cleanest cmake way of doing things and we welcome patches from cmake experts to -# make it better. - -# https://github.com/sakra/cotire -# Last tested with 1.7.8 -set(ENVOY_COTIRE_MODULE_DIR "" CACHE FILEPATH "location of cotire cmake module") - -# https://github.com/gabime/spdlog -# Last tested with 0.11.0 -set(ENVOY_SPDLOG_INCLUDE_DIR "" CACHE FILEPATH "location of spdlog includes") - -# https://github.com/nodejs/http-parser -# Last tested with 2.7.0 -set(ENVOY_HTTP_PARSER_INCLUDE_DIR "" CACHE FILEPATH "location of http-parser includes") - -# https://github.com/nghttp2/nghttp2 -# Last tested with 1.20.0 -set(ENVOY_NGHTTP2_INCLUDE_DIR "" CACHE FILEPATH "location of nghttp2 includes") - -# http://libevent.org/ -# Last tested with 2.1.8 -set(ENVOY_LIBEVENT_INCLUDE_DIR "" CACHE FILEPATH "location of libevent includes") - -# http://tclap.sourceforge.net/ -# Last tested with 1.2.1 -set(ENVOY_TCLAP_INCLUDE_DIR "" CACHE FILEPATH "location of tclap includes") - -# https://github.com/gperftools/gperftools -# Last tested with 2.5.0 -set(ENVOY_GPERFTOOLS_INCLUDE_DIR "" CACHE FILEPATH "location of gperftools includes") - -# https://boringssl.googlesource.com/boringssl/+/chromium-stable -# Last tested with sha be2ee342d3781ddb954f91f8a7e660c6f59e87e5 -set(ENVOY_OPENSSL_INCLUDE_DIR "" CACHE FILEPATH "location of openssl includes") - -# https://github.com/c-ares/c-ares -# Last tested with 1.12.0 -set(ENVOY_CARES_INCLUDE_DIR "" CACHE FILEPATH "location of c-ares includes") - -# https://github.com/google/protobuf -# Last tested with 3.0.0 -set(ENVOY_PROTOBUF_INCLUDE_DIR "" CACHE FILEPATH "location of protobuf includes") -set(ENVOY_PROTOBUF_PROTOC "" CACHE FILEPATH "location of protoc") - -# http://lightstep.com/ -# Last tested with lightstep-tracer-cpp-0.36 -set(ENVOY_LIGHTSTEP_TRACER_INCLUDE_DIR "" CACHE FILEPATH "location of lighstep tracer includes") - -# https://github.com/miloyip/rapidjson -# Last tested with 1.1.0 -set(ENVOY_RAPIDJSON_INCLUDE_DIR "" CACHE FILEPATH "location of rapidjson includes") - -# Extra linker flags required to properly link envoy with all of the above libraries. -set(ENVOY_EXE_EXTRA_LINKER_FLAGS "" CACHE STRING "envoy extra linker flags") - -# -# Test Requirements -# - -# https://github.com/google/googletest -# Last tested with 1.8.0 -set(ENVOY_GTEST_INCLUDE_DIR "" CACHE FILEPATH "location of gtest includes") -set(ENVOY_GMOCK_INCLUDE_DIR "" CACHE FILEPATH "location of gmock includes") - -# http://gcovr.com/ -# Last tested with 3.3 -set(ENVOY_GCOVR "" CACHE FILEPATH "location of gcovr") -set(ENVOY_GCOVR_EXTRA_ARGS "" CACHE STRING "extra arguments to pass to gcovr") - -# Extra linker flags required to properly link envoy-test with all of the above libraries. -set(ENVOY_TEST_EXTRA_LINKER_FLAGS "" CACHE STRING "envoy-test extra linker flags")