From 590a996c8fdef62f4045daf91ebce513ba9c96a7 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Wed, 25 Mar 2020 11:19:14 -0400 Subject: [PATCH 01/42] Remove erroneous test from PR #9964 Test macro missing the second argument (for test name), causing compilation on Windows to fail. It appears to have no purpose, copy-paste error? Co-authored-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- test/common/http/http2/codec_impl_test.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/common/http/http2/codec_impl_test.cc b/test/common/http/http2/codec_impl_test.cc index 3129d30ca77d..fc208c175526 100644 --- a/test/common/http/http2/codec_impl_test.cc +++ b/test/common/http/http2/codec_impl_test.cc @@ -977,9 +977,6 @@ TEST_P(Http2CodecImplTest, WatermarkUnderEndStream) { response_encoder_->encodeHeaders(response_headers, true); } -class Http2CodecImplSettingsBasicTest : public Http2CodecImplTest {}; -TEST_P(Http2CodecImplSettingsBasicTest, ) {} - class Http2CodecImplStreamLimitTest : public Http2CodecImplTest {}; // Regression test for issue #3076. From 5662a356d14878bd215e54201f6a5b3139d2224b Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Tue, 17 Mar 2020 15:49:09 -0400 Subject: [PATCH 02/42] Temporary workaround to exclude WINDOWS_SKIP_TARGETS - Lizan has indicated a desire to refactor the envoy_extension_* API's to better handle target platform builds - See https://github.com/envoyproxy/envoy/pull/10365 for attempted workaround development, we were unsuccessful at a short-term fix to integrate WINDOWS_SKIP_TARGETS / PPC_SKIP_TARGETS - Individually exclude affected tests for the time being Co-authored-by: Sunjay Bhatia Signed-off-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Signed-off-by: William A Rowe Jr Co-authored-by: William A Rowe Jr --- bazel/repositories.bzl | 15 +- source/extensions/all_extensions.bzl | 12 +- source/extensions/extensions_build_config.bzl | 174 ------------------ test/extensions/extensions_build_system.bzl | 20 +- test/extensions/tracers/common/ot/BUILD | 10 +- test/extensions/tracers/datadog/BUILD | 4 + test/extensions/tracers/dynamic_ot/BUILD | 4 + test/extensions/tracers/lightstep/BUILD | 4 + test/extensions/tracers/opencensus/BUILD | 4 + 9 files changed, 47 insertions(+), 200 deletions(-) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index d2bbc3330961..97bbded071fb 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -5,8 +5,19 @@ load("@envoy_api//bazel:envoy_http_archive.bzl", "envoy_http_archive") load(":repository_locations.bzl", "REPOSITORY_LOCATIONS") load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") -# dict of {build recipe name: longform extension name,} -PPC_SKIP_TARGETS = {"luajit": "envoy.filters.http.lua"} +PPC_SKIP_TARGETS = ["envoy.filters.http.lua"] + +WINDOWS_SKIP_TARGETS = [ + "envoy.filters.http.adaptive_concurrency", + "envoy.filters.network.kafka_broker", + "envoy.filters.network.mysql_proxy", + "envoy.stat_sinks.hystrix", + "envoy.stat_sinks.statsd", + "envoy.tracers.dynamic_ot", + "envoy.tracers.lightstep", + "envoy.tracers.datadog", + "envoy.tracers.opencensus", +] # Make all contents of an external repository accessible under a filegroup. Used for external HTTP # archives, e.g. cares. diff --git a/source/extensions/all_extensions.bzl b/source/extensions/all_extensions.bzl index 74ea28bf426f..95f018c44973 100644 --- a/source/extensions/all_extensions.bzl +++ b/source/extensions/all_extensions.bzl @@ -1,5 +1,5 @@ load("@bazel_skylib//lib:dicts.bzl", "dicts") -load("@envoy_build_config//:extensions_build_config.bzl", "EXTENSIONS", "WINDOWS_EXTENSIONS") +load("@envoy_build_config//:extensions_build_config.bzl", "EXTENSIONS") # These extensions are registered using the extension system but are required for the core Envoy build. # The map may be overridden by extensions specified in envoy_build_config. @@ -9,14 +9,8 @@ _required_extensions = { } # Return all extensions to be compiled into Envoy. -def envoy_all_extensions(blacklist = dict()): +def envoy_all_extensions(blacklist = []): all_extensions = dicts.add(_required_extensions, EXTENSIONS) # These extensions can be removed on a site specific basis. - return [v for k, v in all_extensions.items() if not k in blacklist.values()] - -def envoy_windows_extensions(): - all_extensions = dicts.add(_required_extensions, WINDOWS_EXTENSIONS) - - # These extensions can be removed on a site specific basis. - return all_extensions.values() + return [v for k, v in all_extensions.items() if not k in blacklist] diff --git a/source/extensions/extensions_build_config.bzl b/source/extensions/extensions_build_config.bzl index 3c85a8a61a6a..65cdc341bec4 100644 --- a/source/extensions/extensions_build_config.bzl +++ b/source/extensions/extensions_build_config.bzl @@ -169,177 +169,3 @@ EXTENSIONS = { "envoy.filters.http.cache.simple_http_cache": "//source/extensions/filters/http/cache/simple_http_cache:simple_http_cache_lib", } - -WINDOWS_EXTENSIONS = { - # - # Access loggers - # - - "envoy.access_loggers.file": "//source/extensions/access_loggers/file:config", - "envoy.access_loggers.http_grpc": "//source/extensions/access_loggers/grpc:http_config", - "envoy.access_loggers.tcp_grpc": "//source/extensions/access_loggers/grpc:tcp_config", - - # - # Clusters - # - - "envoy.clusters.aggregate": "//source/extensions/clusters/aggregate:cluster", - "envoy.clusters.dynamic_forward_proxy": "//source/extensions/clusters/dynamic_forward_proxy:cluster", - # "envoy.clusters.redis": "//source/extensions/clusters/redis:redis_cluster", - - # - # gRPC Credentials Plugins - # - - "envoy.grpc_credentials.file_based_metadata": "//source/extensions/grpc_credentials/file_based_metadata:config", - "envoy.grpc_credentials.aws_iam": "//source/extensions/grpc_credentials/aws_iam:config", - - # - # Health checkers - # - - # "envoy.health_checkers.redis": "//source/extensions/health_checkers/redis:config", - - # - # HTTP filters - # - - # "envoy.filters.http.adaptive_concurrency": "//source/extensions/filters/http/adaptive_concurrency:config", - "envoy.filters.http.aws_lambda": "//source/extensions/filters/http/aws_lambda:config", - "envoy.filters.http.aws_request_signing": "//source/extensions/filters/http/aws_request_signing:config", - "envoy.filters.http.buffer": "//source/extensions/filters/http/buffer:config", - "envoy.filters.http.cache": "//source/extensions/filters/http/cache:config", - "envoy.filters.http.cors": "//source/extensions/filters/http/cors:config", - "envoy.filters.http.csrf": "//source/extensions/filters/http/csrf:config", - "envoy.filters.http.dynamic_forward_proxy": "//source/extensions/filters/http/dynamic_forward_proxy:config", - "envoy.filters.http.dynamo": "//source/extensions/filters/http/dynamo:config", - "envoy.filters.http.ext_authz": "//source/extensions/filters/http/ext_authz:config", - "envoy.filters.http.fault": "//source/extensions/filters/http/fault:config", - "envoy.filters.http.grpc_http1_bridge": "//source/extensions/filters/http/grpc_http1_bridge:config", - "envoy.filters.http.grpc_http1_reverse_bridge": "//source/extensions/filters/http/grpc_http1_reverse_bridge:config", - "envoy.filters.http.grpc_json_transcoder": "//source/extensions/filters/http/grpc_json_transcoder:config", - "envoy.filters.http.grpc_stats": "//source/extensions/filters/http/grpc_stats:config", - "envoy.filters.http.grpc_web": "//source/extensions/filters/http/grpc_web:config", - "envoy.filters.http.gzip": "//source/extensions/filters/http/gzip:config", - "envoy.filters.http.header_to_metadata": "//source/extensions/filters/http/header_to_metadata:config", - "envoy.filters.http.health_check": "//source/extensions/filters/http/health_check:config", - "envoy.filters.http.ip_tagging": "//source/extensions/filters/http/ip_tagging:config", - "envoy.filters.http.jwt_authn": "//source/extensions/filters/http/jwt_authn:config", - # "envoy.filters.http.lua": "//source/extensions/filters/http/lua:config", - "envoy.filters.http.on_demand": "//source/extensions/filters/http/on_demand:config", - "envoy.filters.http.original_src": "//source/extensions/filters/http/original_src:config", - "envoy.filters.http.ratelimit": "//source/extensions/filters/http/ratelimit:config", - "envoy.filters.http.rbac": "//source/extensions/filters/http/rbac:config", - "envoy.filters.http.router": "//source/extensions/filters/http/router:config", - "envoy.filters.http.squash": "//source/extensions/filters/http/squash:config", - "envoy.filters.http.tap": "//source/extensions/filters/http/tap:config", - - # - # Listener filters - # - - "envoy.filters.listener.http_inspector": "//source/extensions/filters/listener/http_inspector:config", - # NOTE: The original_dst filter is implicitly loaded if original_dst functionality is - # configured on the listener. Do not remove it in that case or configs will fail to load. - "envoy.filters.listener.original_dst": "//source/extensions/filters/listener/original_dst:config", - "envoy.filters.listener.original_src": "//source/extensions/filters/listener/original_src:config", - # NOTE: The proxy_protocol filter is implicitly loaded if proxy_protocol functionality is - # configured on the listener. Do not remove it in that case or configs will fail to load. - "envoy.filters.listener.proxy_protocol": "//source/extensions/filters/listener/proxy_protocol:config", - "envoy.filters.listener.tls_inspector": "//source/extensions/filters/listener/tls_inspector:config", - - # - # Network filters - # - - "envoy.filters.network.client_ssl_auth": "//source/extensions/filters/network/client_ssl_auth:config", - "envoy.filters.network.direct_response": "//source/extensions/filters/network/direct_response:config", - "envoy.filters.network.dubbo_proxy": "//source/extensions/filters/network/dubbo_proxy:config", - "envoy.filters.network.echo": "//source/extensions/filters/network/echo:config", - "envoy.filters.network.ext_authz": "//source/extensions/filters/network/ext_authz:config", - "envoy.filters.network.http_connection_manager": "//source/extensions/filters/network/http_connection_manager:config", - # WiP - # "envoy.filters.network.kafka_broker": "//source/extensions/filters/network/kafka:kafka_broker_config_lib", - "envoy.filters.network.local_ratelimit": "//source/extensions/filters/network/local_ratelimit:config", - "envoy.filters.network.mongo_proxy": "//source/extensions/filters/network/mongo_proxy:config", - # "envoy.filters.network.mysql_proxy": "//source/extensions/filters/network/mysql_proxy:config", - "envoy.filters.network.ratelimit": "//source/extensions/filters/network/ratelimit:config", - "envoy.filters.network.rbac": "//source/extensions/filters/network/rbac:config", - # "envoy.filters.network.redis_proxy": "//source/extensions/filters/network/redis_proxy:config", - "envoy.filters.network.tcp_proxy": "//source/extensions/filters/network/tcp_proxy:config", - "envoy.filters.network.thrift_proxy": "//source/extensions/filters/network/thrift_proxy:config", - "envoy.filters.network.sni_cluster": "//source/extensions/filters/network/sni_cluster:config", - "envoy.filters.network.zookeeper_proxy": "//source/extensions/filters/network/zookeeper_proxy:config", - - # - # UDP filters - # - - "envoy.filters.udp_listener.udp_proxy": "//source/extensions/filters/udp/udp_proxy:config", - - # - # Resource monitors - # - - "envoy.resource_monitors.fixed_heap": "//source/extensions/resource_monitors/fixed_heap:config", - "envoy.resource_monitors.injected_resource": "//source/extensions/resource_monitors/injected_resource:config", - - # - # Stat sinks - # - - "envoy.stat_sinks.dog_statsd": "//source/extensions/stat_sinks/dog_statsd:config", - # "envoy.stat_sinks.hystrix": "//source/extensions/stat_sinks/hystrix:config", - "envoy.stat_sinks.metrics_service": "//source/extensions/stat_sinks/metrics_service:config", - # "envoy.stat_sinks.statsd": "//source/extensions/stat_sinks/statsd:config", - - # - # Thrift filters - # - - "envoy.filters.thrift.router": "//source/extensions/filters/network/thrift_proxy/router:config", - "envoy.filters.thrift.ratelimit": "//source/extensions/filters/network/thrift_proxy/filters/ratelimit:config", - - # - # Tracers - # - - # These first three require opentracing to build on windows, but it is - # a foreign_cc build based on a linux autotools build schema. - # "envoy.tracers.dynamic_ot": "//source/extensions/tracers/dynamic_ot:config", - # "envoy.tracers.lightstep": "//source/extensions/tracers/lightstep:config", - # "envoy.tracers.datadog": "//source/extensions/tracers/datadog:config", - "envoy.tracers.zipkin": "//source/extensions/tracers/zipkin:config", - # The opencensus tool needs windows porting (unistd.h isn't c++) - # "envoy.tracers.opencensus": "//source/extensions/tracers/opencensus:config", - # WiP - "envoy.tracers.xray": "//source/extensions/tracers/xray:config", - - # - # Transport sockets - # - - "envoy.transport_sockets.alts": "//source/extensions/transport_sockets/alts:config", - "envoy.transport_sockets.raw_buffer": "//source/extensions/transport_sockets/raw_buffer:config", - "envoy.transport_sockets.tap": "//source/extensions/transport_sockets/tap:config", - - # - # Retry host predicates - # - - "envoy.retry_host_predicates.previous_hosts": "//source/extensions/retry/host/previous_hosts:config", - "envoy.retry_host_predicates.omit_canary_hosts": "//source/extensions/retry/host/omit_canary_hosts:config", - "envoy.retry_host_predicates.omit_host_metadata": "//source/extensions/retry/host/omit_host_metadata:config", - - # - # Retry priorities - # - - "envoy.retry_priorities.previous_priorities": "//source/extensions/retry/priority/previous_priorities:config", - - # - # CacheFilter plugins - # - - "envoy.filters.http.cache.simple_http_cache": "//source/extensions/filters/http/cache/simple_http_cache:simple_http_cache_lib", -} diff --git a/test/extensions/extensions_build_system.bzl b/test/extensions/extensions_build_system.bzl index b92680fced5a..3a944896086f 100644 --- a/test/extensions/extensions_build_system.bzl +++ b/test/extensions/extensions_build_system.bzl @@ -1,5 +1,5 @@ load("//bazel:envoy_build_system.bzl", "envoy_benchmark_test", "envoy_cc_benchmark_binary", "envoy_cc_mock", "envoy_cc_test", "envoy_cc_test_binary", "envoy_cc_test_library") -load("@envoy_build_config//:extensions_build_config.bzl", "EXTENSIONS") +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") # All extension tests should use this version of envoy_cc_test(). It allows compiling out # tests for extensions that the user does not wish to include in their build. @@ -8,52 +8,46 @@ def envoy_extension_cc_test( name, extension_name, **kwargs): - if not extension_name in EXTENSIONS: + if not extension_name in envoy_all_extensions(): return - envoy_cc_test(name, **kwargs) def envoy_extension_cc_test_library( name, extension_name, **kwargs): - if not extension_name in EXTENSIONS: + if not extension_name in envoy_all_extensions(): return - envoy_cc_test_library(name, **kwargs) def envoy_extension_cc_mock( name, extension_name, **kwargs): - if not extension_name in EXTENSIONS: + if not extension_name in envoy_all_extensions(): return - envoy_cc_mock(name, **kwargs) def envoy_extension_cc_test_binary( name, extension_name, **kwargs): - if not extension_name in EXTENSIONS: + if not extension_name in envoy_all_extensions(): return - envoy_cc_test_binary(name, **kwargs) def envoy_extension_cc_benchmark_binary( name, extension_name, **kwargs): - if not extension_name in EXTENSIONS: + if not extension_name in envoy_all_extensions(): return - envoy_cc_benchmark_binary(name, **kwargs) def envoy_extension_benchmark_test( name, extension_name, **kwargs): - if not extension_name in EXTENSIONS: + if not extension_name in envoy_all_extensions(): return - envoy_benchmark_test(name, **kwargs) diff --git a/test/extensions/tracers/common/ot/BUILD b/test/extensions/tracers/common/ot/BUILD index fba078c13bbc..76fd9d8b1378 100644 --- a/test/extensions/tracers/common/ot/BUILD +++ b/test/extensions/tracers/common/ot/BUILD @@ -2,17 +2,23 @@ licenses(["notice"]) # Apache 2 load( "//bazel:envoy_build_system.bzl", - "envoy_cc_test", "envoy_package", ) +load( + "//test/extensions:extensions_build_system.bzl", + "envoy_extension_cc_test", +) envoy_package() -envoy_cc_test( +envoy_extension_cc_test( name = "opentracing_driver_impl_test", srcs = [ "opentracing_driver_impl_test.cc", ], + extension_name = "envoy.tracers.dynamic_ot", + # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions + tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/dynamic_ot:dynamic_opentracing_driver_lib", "//test/mocks/http:http_mocks", diff --git a/test/extensions/tracers/datadog/BUILD b/test/extensions/tracers/datadog/BUILD index 8b0d233641fa..769a5e9de968 100644 --- a/test/extensions/tracers/datadog/BUILD +++ b/test/extensions/tracers/datadog/BUILD @@ -17,6 +17,8 @@ envoy_extension_cc_test( "datadog_tracer_impl_test.cc", ], extension_name = "envoy.tracers.datadog", + # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions + tags = ["skip_on_windows"], deps = [ "//source/common/common:base64_lib", "//source/common/http:header_map_lib", @@ -41,6 +43,8 @@ envoy_extension_cc_test( name = "config_test", srcs = ["config_test.cc"], extension_name = "envoy.tracers.datadog", + # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions + tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/datadog:config", "//test/mocks/server:server_mocks", diff --git a/test/extensions/tracers/dynamic_ot/BUILD b/test/extensions/tracers/dynamic_ot/BUILD index 4a7382e0efc0..4037befe21f9 100644 --- a/test/extensions/tracers/dynamic_ot/BUILD +++ b/test/extensions/tracers/dynamic_ot/BUILD @@ -20,6 +20,8 @@ envoy_extension_cc_test( "@io_opentracing_cpp//mocktracer:libmocktracer_plugin.so", ], extension_name = "envoy.tracers.dynamic_ot", + # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions + tags = ["skip_on_windows"], deps = [ "//source/common/http:header_map_lib", "//source/extensions/tracers/dynamic_ot:dynamic_opentracing_driver_lib", @@ -37,6 +39,8 @@ envoy_extension_cc_test( "@io_opentracing_cpp//mocktracer:libmocktracer_plugin.so", ], extension_name = "envoy.tracers.dynamic_ot", + # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions + tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/dynamic_ot:config", "//test/mocks/server:server_mocks", diff --git a/test/extensions/tracers/lightstep/BUILD b/test/extensions/tracers/lightstep/BUILD index 4abc6edc9418..c052e1095712 100644 --- a/test/extensions/tracers/lightstep/BUILD +++ b/test/extensions/tracers/lightstep/BUILD @@ -17,6 +17,8 @@ envoy_extension_cc_test( "lightstep_tracer_impl_test.cc", ], extension_name = "envoy.tracers.lightstep", + # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions + tags = ["skip_on_windows"], deps = [ "//source/common/common:base64_lib", "//source/common/http:header_map_lib", @@ -43,6 +45,8 @@ envoy_extension_cc_test( name = "config_test", srcs = ["config_test.cc"], extension_name = "envoy.tracers.lightstep", + # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions + tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/lightstep:config", "//test/mocks/server:server_mocks", diff --git a/test/extensions/tracers/opencensus/BUILD b/test/extensions/tracers/opencensus/BUILD index 01b231bc240b..9aa809b29f8d 100644 --- a/test/extensions/tracers/opencensus/BUILD +++ b/test/extensions/tracers/opencensus/BUILD @@ -15,6 +15,8 @@ envoy_extension_cc_test( name = "tracer_test", srcs = ["tracer_test.cc"], extension_name = "envoy.tracers.opencensus", + # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions + tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/opencensus:opencensus_tracer_impl", "//test/mocks/http:http_mocks", @@ -28,6 +30,8 @@ envoy_extension_cc_test( name = "config_test", srcs = ["config_test.cc"], extension_name = "envoy.tracers.opencensus", + # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions + tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/opencensus:config", "//test/mocks/server:server_mocks", From e7f9c0599ad86cc524d03b0e6d9a70236a35d1ef Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Thu, 26 Mar 2020 10:33:06 -0400 Subject: [PATCH 03/42] Shorten adaptive_concurrency/concurrency_controller path names - having paths greater than 240 characters breaks compilation on Windows with errors indicating header files do not exist in the includes directory - the adaptive_concurrency/concurrency_controller name is repetitive, this change shortens it to adaptive_concurrency/controller to get past Windows file path limits - namespace changed to AdaptiveConcurrency::Controller to mimic same shortening, AdaptiveConcurrency::Controller::ConcurrencyController class is kept as that seems an appropriately descriptive name for the class Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr Co-authored-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr --- .../extensions/filters/http/adaptive_concurrency/BUILD | 4 ++-- .../adaptive_concurrency_filter.cc | 4 ++-- .../adaptive_concurrency/adaptive_concurrency_filter.h | 5 ++--- .../filters/http/adaptive_concurrency/config.cc | 10 +++++----- .../{concurrency_controller => controller}/BUILD | 4 ++-- .../controller.h} | 4 ++-- .../gradient_controller.cc | 8 ++++---- .../gradient_controller.h | 6 +++--- 8 files changed, 22 insertions(+), 23 deletions(-) rename source/extensions/filters/http/adaptive_concurrency/{concurrency_controller => controller}/BUILD (91%) rename source/extensions/filters/http/adaptive_concurrency/{concurrency_controller/concurrency_controller.h => controller/controller.h} (95%) rename source/extensions/filters/http/adaptive_concurrency/{concurrency_controller => controller}/gradient_controller.cc (96%) rename source/extensions/filters/http/adaptive_concurrency/{concurrency_controller => controller}/gradient_controller.h (98%) diff --git a/source/extensions/filters/http/adaptive_concurrency/BUILD b/source/extensions/filters/http/adaptive_concurrency/BUILD index 4b757362b85a..1cff74436f07 100644 --- a/source/extensions/filters/http/adaptive_concurrency/BUILD +++ b/source/extensions/filters/http/adaptive_concurrency/BUILD @@ -20,7 +20,7 @@ envoy_cc_library( deps = [ "//include/envoy/http:filter_interface", "//source/extensions/filters/http:well_known_names", - "//source/extensions/filters/http/adaptive_concurrency/concurrency_controller:concurrency_controller_lib", + "//source/extensions/filters/http/adaptive_concurrency/controller:controller_lib", "//source/extensions/filters/http/common:pass_through_filter_lib", "@envoy_api//envoy/extensions/filters/http/adaptive_concurrency/v3:pkg_cc_proto", ], @@ -36,7 +36,7 @@ envoy_cc_extension( "//include/envoy/registry", "//source/extensions/filters/http:well_known_names", "//source/extensions/filters/http/adaptive_concurrency:adaptive_concurrency_filter_lib", - "//source/extensions/filters/http/adaptive_concurrency/concurrency_controller:concurrency_controller_lib", + "//source/extensions/filters/http/adaptive_concurrency/controller:controller_lib", "//source/extensions/filters/http/common:factory_base_lib", "@envoy_api//envoy/extensions/filters/http/adaptive_concurrency/v3:pkg_cc_proto", ], diff --git a/source/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter.cc b/source/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter.cc index 012f81e54d3a..69e706cbf2b6 100644 --- a/source/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter.cc +++ b/source/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter.cc @@ -10,7 +10,7 @@ #include "common/common/assert.h" #include "common/protobuf/utility.h" -#include "extensions/filters/http/adaptive_concurrency/concurrency_controller/concurrency_controller.h" +#include "extensions/filters/http/adaptive_concurrency/controller/controller.h" #include "extensions/filters/http/well_known_names.h" namespace Envoy { @@ -37,7 +37,7 @@ Http::FilterHeadersStatus AdaptiveConcurrencyFilter::decodeHeaders(Http::Request return Http::FilterHeadersStatus::Continue; } - if (controller_->forwardingDecision() == ConcurrencyController::RequestForwardingAction::Block) { + if (controller_->forwardingDecision() == Controller::RequestForwardingAction::Block) { decoder_callbacks_->sendLocalReply(Http::Code::ServiceUnavailable, "", nullptr, absl::nullopt, "reached concurrency limit"); return Http::FilterHeadersStatus::StopIteration; diff --git a/source/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter.h b/source/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter.h index dd375bf2d523..7424e1d3bdba 100644 --- a/source/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter.h +++ b/source/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter.h @@ -14,7 +14,7 @@ #include "common/common/cleanup.h" #include "common/runtime/runtime_protos.h" -#include "extensions/filters/http/adaptive_concurrency/concurrency_controller/concurrency_controller.h" +#include "extensions/filters/http/adaptive_concurrency/controller/controller.h" #include "extensions/filters/http/common/pass_through_filter.h" namespace Envoy { @@ -44,8 +44,7 @@ class AdaptiveConcurrencyFilterConfig { using AdaptiveConcurrencyFilterConfigSharedPtr = std::shared_ptr; -using ConcurrencyControllerSharedPtr = - std::shared_ptr; +using ConcurrencyControllerSharedPtr = std::shared_ptr; /** * A filter that samples request latencies and dynamically adjusts the request diff --git a/source/extensions/filters/http/adaptive_concurrency/config.cc b/source/extensions/filters/http/adaptive_concurrency/config.cc index e284d6095650..fc6b9d5e0f99 100644 --- a/source/extensions/filters/http/adaptive_concurrency/config.cc +++ b/source/extensions/filters/http/adaptive_concurrency/config.cc @@ -5,7 +5,7 @@ #include "envoy/registry/registry.h" #include "extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter.h" -#include "extensions/filters/http/adaptive_concurrency/concurrency_controller/gradient_controller.h" +#include "extensions/filters/http/adaptive_concurrency/controller/gradient_controller.h" namespace Envoy { namespace Extensions { @@ -18,13 +18,13 @@ Http::FilterFactoryCb AdaptiveConcurrencyFilterFactory::createFilterFactoryFromP auto acc_stats_prefix = stats_prefix + "adaptive_concurrency."; - std::shared_ptr controller; + std::shared_ptr controller; using Proto = envoy::extensions::filters::http::adaptive_concurrency::v3::AdaptiveConcurrency; ASSERT(config.concurrency_controller_config_case() == Proto::ConcurrencyControllerConfigCase::kGradientControllerConfig); - auto gradient_controller_config = ConcurrencyController::GradientControllerConfig( - config.gradient_controller_config(), context.runtime()); - controller = std::make_shared( + auto gradient_controller_config = + Controller::GradientControllerConfig(config.gradient_controller_config(), context.runtime()); + controller = std::make_shared( std::move(gradient_controller_config), context.dispatcher(), context.runtime(), acc_stats_prefix + "gradient_controller.", context.scope(), context.random()); diff --git a/source/extensions/filters/http/adaptive_concurrency/concurrency_controller/BUILD b/source/extensions/filters/http/adaptive_concurrency/controller/BUILD similarity index 91% rename from source/extensions/filters/http/adaptive_concurrency/concurrency_controller/BUILD rename to source/extensions/filters/http/adaptive_concurrency/controller/BUILD index c6dfc0a45780..b5e828f9a3b3 100644 --- a/source/extensions/filters/http/adaptive_concurrency/concurrency_controller/BUILD +++ b/source/extensions/filters/http/adaptive_concurrency/controller/BUILD @@ -13,10 +13,10 @@ load( envoy_package() envoy_cc_library( - name = "concurrency_controller_lib", + name = "controller_lib", srcs = ["gradient_controller.cc"], hdrs = [ - "concurrency_controller.h", + "controller.h", "gradient_controller.h", ], external_deps = [ diff --git a/source/extensions/filters/http/adaptive_concurrency/concurrency_controller/concurrency_controller.h b/source/extensions/filters/http/adaptive_concurrency/controller/controller.h similarity index 95% rename from source/extensions/filters/http/adaptive_concurrency/concurrency_controller/concurrency_controller.h rename to source/extensions/filters/http/adaptive_concurrency/controller/controller.h index 20342c0bd6cf..ecb78307a9d2 100644 --- a/source/extensions/filters/http/adaptive_concurrency/concurrency_controller/concurrency_controller.h +++ b/source/extensions/filters/http/adaptive_concurrency/controller/controller.h @@ -8,7 +8,7 @@ namespace Envoy { namespace Extensions { namespace HttpFilters { namespace AdaptiveConcurrency { -namespace ConcurrencyController { +namespace Controller { /** * The controller's decision on whether a request will be forwarded. @@ -57,7 +57,7 @@ class ConcurrencyController { virtual uint32_t concurrencyLimit() const PURE; }; -} // namespace ConcurrencyController +} // namespace Controller } // namespace AdaptiveConcurrency } // namespace HttpFilters } // namespace Extensions diff --git a/source/extensions/filters/http/adaptive_concurrency/concurrency_controller/gradient_controller.cc b/source/extensions/filters/http/adaptive_concurrency/controller/gradient_controller.cc similarity index 96% rename from source/extensions/filters/http/adaptive_concurrency/concurrency_controller/gradient_controller.cc rename to source/extensions/filters/http/adaptive_concurrency/controller/gradient_controller.cc index e975e9b59275..cfdad0de0694 100644 --- a/source/extensions/filters/http/adaptive_concurrency/concurrency_controller/gradient_controller.cc +++ b/source/extensions/filters/http/adaptive_concurrency/controller/gradient_controller.cc @@ -1,4 +1,4 @@ -#include "extensions/filters/http/adaptive_concurrency/concurrency_controller/gradient_controller.h" +#include "extensions/filters/http/adaptive_concurrency/controller/gradient_controller.h" #include #include @@ -12,7 +12,7 @@ #include "common/protobuf/protobuf.h" #include "common/protobuf/utility.h" -#include "extensions/filters/http/adaptive_concurrency/concurrency_controller/concurrency_controller.h" +#include "extensions/filters/http/adaptive_concurrency/controller/controller.h" #include "absl/synchronization/mutex.h" @@ -20,7 +20,7 @@ namespace Envoy { namespace Extensions { namespace HttpFilters { namespace AdaptiveConcurrency { -namespace ConcurrencyController { +namespace Controller { GradientControllerConfig::GradientControllerConfig( const envoy::extensions::filters::http::adaptive_concurrency::v3::GradientControllerConfig& @@ -209,7 +209,7 @@ void GradientController::cancelLatencySample() { --num_rq_outstanding_; } -} // namespace ConcurrencyController +} // namespace Controller } // namespace AdaptiveConcurrency } // namespace HttpFilters } // namespace Extensions diff --git a/source/extensions/filters/http/adaptive_concurrency/concurrency_controller/gradient_controller.h b/source/extensions/filters/http/adaptive_concurrency/controller/gradient_controller.h similarity index 98% rename from source/extensions/filters/http/adaptive_concurrency/concurrency_controller/gradient_controller.h rename to source/extensions/filters/http/adaptive_concurrency/controller/gradient_controller.h index be59dc816e5b..5b415ad64db9 100644 --- a/source/extensions/filters/http/adaptive_concurrency/concurrency_controller/gradient_controller.h +++ b/source/extensions/filters/http/adaptive_concurrency/controller/gradient_controller.h @@ -8,7 +8,7 @@ #include "envoy/runtime/runtime.h" #include "envoy/stats/stats_macros.h" -#include "extensions/filters/http/adaptive_concurrency/concurrency_controller/concurrency_controller.h" +#include "extensions/filters/http/adaptive_concurrency/controller/controller.h" #include "absl/base/thread_annotations.h" #include "absl/strings/numbers.h" @@ -19,7 +19,7 @@ namespace Envoy { namespace Extensions { namespace HttpFilters { namespace AdaptiveConcurrency { -namespace ConcurrencyController { +namespace Controller { /** * All stats for the gradient controller. @@ -276,7 +276,7 @@ class GradientController : public ConcurrencyController { }; using GradientControllerSharedPtr = std::shared_ptr; -} // namespace ConcurrencyController +} // namespace Controller } // namespace AdaptiveConcurrency } // namespace HttpFilters } // namespace Extensions From b4b8249be9c6f664d3d98c001fd3f7db8050299c Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Mon, 16 Mar 2020 16:44:42 -0400 Subject: [PATCH 04/42] All but excluded tests now compile on Windows - replace WINDOWS_EXTENSIONS with very short WINDOWS_SKIP_TARGETS list - fixes kafka compilation (MSVC parses the literal of INT32_MIN incorrectly) - fixes luajit and moonjit compilation (only one jit is elected) - extensions _SKIP_TARGET lists converted from dict to list - compilation failures of the test packages are tagged skip_on_windows - timeouts in failing packages are tagged fails_on_windows - additional failing tests will be tagged in a subsequent commit Co-authored-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr Co-authored-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Co-authored-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr --- bazel/external/kafka_int32.patch | 27 +++ bazel/foreign_cc/BUILD | 18 +- bazel/foreign_cc/luajit.patch | 21 ++- bazel/foreign_cc/moonjit.patch | 21 ++- bazel/repositories.bzl | 6 +- ci/windows_ci_steps.sh | 10 +- source/exe/BUILD | 10 +- .../clusters/redis/redis_cluster.cc | 2 - .../redis_proxy/command_splitter_impl.cc | 8 +- .../quiche/platform/quic_iovec_impl.h | 4 +- source/extensions/stat_sinks/hystrix/BUILD | 2 +- .../extensions/stat_sinks/hystrix/hystrix.h | 4 +- test/common/buffer/owned_impl_test.cc | 34 ++-- test/common/buffer/watermark_buffer_test.cc | 6 + test/common/grpc/BUILD | 2 + test/common/http/BUILD | 2 + test/common/network/BUILD | 4 + test/common/network/dns_impl_test.cc | 12 +- test/common/router/BUILD | 2 + test/common/runtime/BUILD | 5 + test/common/signal/BUILD | 6 +- test/config_test/BUILD | 12 +- test/exe/BUILD | 18 +- test/exe/main_common_test.cc | 17 +- test/extensions/common/wasm/BUILD | 2 + .../http_inspector/http_inspector_test.cc | 162 ++++++++++-------- .../tls_inspector/tls_inspector_test.cc | 12 +- .../mysql_proxy/mysql_integration_test.cc | 3 + test/extensions/quic_listeners/quiche/BUILD | 60 +++++-- .../quic_listeners/quiche/integration/BUILD | 6 +- .../quic_listeners/quiche/platform/BUILD | 2 +- .../quiche/platform/quic_test_output_impl.cc | 6 +- .../quiche/quic_io_handle_wrapper_test.cc | 4 +- .../common/statsd/udp_statsd_test.cc | 4 +- test/extensions/tracers/xray/tracer_test.cc | 4 +- test/extensions/tracers/zipkin/tracer_test.cc | 2 +- test/extensions/transport_sockets/tls/BUILD | 2 + test/integration/BUILD | 18 +- test/integration/tcp_dump.cc | 10 +- test/main.cc | 29 ++++ test/mocks/network/io_handle.h | 2 +- test/server/BUILD | 18 +- test/server/config_validation/BUILD | 12 +- test/server/listener_manager_impl_test.cc | 10 +- test/server/listener_manager_impl_test.h | 2 +- test/server/server_test.cc | 10 ++ test/tools/router_check/test/BUILD | 2 + test/tools/type_whisperer/BUILD | 2 + windows/.bazelrc | 2 +- 49 files changed, 447 insertions(+), 192 deletions(-) create mode 100644 bazel/external/kafka_int32.patch diff --git a/bazel/external/kafka_int32.patch b/bazel/external/kafka_int32.patch new file mode 100644 index 000000000000..8b88fe335821 --- /dev/null +++ b/bazel/external/kafka_int32.patch @@ -0,0 +1,27 @@ +--- DescribeGroupsResponse.json 2020-03-25 16:12:16.373302600 -0400 ++++ DescribeGroupsResponse.json 2020-03-25 16:11:16.184156200 -0400 +@@ -63,7 +63,7 @@ + { "name": "MemberAssignment", "type": "bytes", "versions": "0+", + "about": "The current assignment provided by the group leader." } + ]}, +- { "name": "AuthorizedOperations", "type": "int32", "versions": "3+", "default": "-2147483648", ++ { "name": "AuthorizedOperations", "type": "int32", "versions": "3+", "default": "INT32_MIN", + "about": "32-bit bitfield to represent authorized operations for this group." } + ]} + ] + +--- MetadataResponse.json 2020-03-25 15:53:36.319161000 -0400 ++++ MetadataResponse.json 2020-03-25 15:54:11.510400000 -0400 +@@ -81,10 +81,10 @@ + { "name": "OfflineReplicas", "type": "[]int32", "versions": "5+", "ignorable": true, + "about": "The set of offline replicas of this partition." } + ]}, +- { "name": "TopicAuthorizedOperations", "type": "int32", "versions": "8+", "default": "-2147483648", ++ { "name": "TopicAuthorizedOperations", "type": "int32", "versions": "8+", "default": "INT32_MIN", + "about": "32-bit bitfield to represent authorized operations for this topic." } + ]}, +- { "name": "ClusterAuthorizedOperations", "type": "int32", "versions": "8+", "default": "-2147483648", ++ { "name": "ClusterAuthorizedOperations", "type": "int32", "versions": "8+", "default": "INT32_MIN", + "about": "32-bit bitfield to represent authorized operations for this cluster." } + ] + } diff --git a/bazel/foreign_cc/BUILD b/bazel/foreign_cc/BUILD index 24910612adf2..b2ee9cb74d7b 100644 --- a/bazel/foreign_cc/BUILD +++ b/bazel/foreign_cc/BUILD @@ -36,8 +36,6 @@ cc_library( ], ) -# autotools packages are unusable on Windows as-is -# TODO: Consider our own luajit.BUILD file as we do with many other packages configure_make( name = "luajit", configure_command = "build.py", @@ -51,10 +49,10 @@ configure_make( lib_source = "@com_github_luajit_luajit//:all", make_commands = [], out_include_dir = "include/luajit-2.1", - static_libraries = [ - "libluajit-5.1.a", - ], - tags = ["skip_on_windows"], + static_libraries = select({ + "//bazel:windows_x86_64": ["lua51.lib"], + "//conditions:default": ["libluajit-5.1.a"], + }), ) configure_make( @@ -70,10 +68,10 @@ configure_make( lib_source = "@com_github_moonjit_moonjit//:all", make_commands = [], out_include_dir = "include/moonjit-2.2", - static_libraries = [ - "libluajit-5.1.a", - ], - tags = ["skip_on_windows"], + static_libraries = select({ + "//bazel:windows_x86_64": ["lua51.lib"], + "//conditions:default": ["libluajit-5.1.a"], + }), ) envoy_cmake_external( diff --git a/bazel/foreign_cc/luajit.patch b/bazel/foreign_cc/luajit.patch index 82e8733a70fc..39d58d6dc3b0 100644 --- a/bazel/foreign_cc/luajit.patch +++ b/bazel/foreign_cc/luajit.patch @@ -48,7 +48,7 @@ new file mode 100755 index 0000000..9c71271 --- /dev/null +++ b/build.py -@@ -0,0 +1,39 @@ +@@ -0,0 +1,56 @@ +#!/usr/bin/env python + +import argparse @@ -86,5 +86,22 @@ index 0000000..9c71271 + + os.system('make V=1 PREFIX="{}" install'.format(args.prefix)) + -+main() ++def win_main(): ++ src_dir = os.path.dirname(os.path.realpath(__file__)) ++ dst_dir = os.getcwd() + "/luajit" ++ shutil.copytree(src_dir, os.path.basename(src_dir)) ++ os.chdir(os.path.basename(src_dir) + "/src") ++ os.system('msvcbuild.bat static') ++ os.makedirs(dst_dir + "/lib", exist_ok=True) ++ shutil.copy("lua51.lib", dst_dir + "/lib") ++ os.makedirs(dst_dir + "/include/luajit-2.1", exist_ok=True) ++ for header in ["lauxlib.h", "luaconf.h", "lua.h", "lua.hpp", "luajit.h", "lualib.h"]: ++ shutil.copy(header, dst_dir + "/include/luajit-2.1") ++ os.makedirs(dst_dir + "/bin", exist_ok=True) ++ shutil.copy("luajit.exe", dst_dir + "/bin") ++ ++if os.name == 'nt': ++ win_main() ++else: ++ main() + diff --git a/bazel/foreign_cc/moonjit.patch b/bazel/foreign_cc/moonjit.patch index 77679e2b13fa..c0d2c274eaae 100644 --- a/bazel/foreign_cc/moonjit.patch +++ b/bazel/foreign_cc/moonjit.patch @@ -48,7 +48,7 @@ new file mode 100755 index 0000000..9c71271 --- /dev/null +++ b/build.py -@@ -0,0 +1,39 @@ +@@ -0,0 +1,56 @@ +#!/usr/bin/env python + +import argparse @@ -86,5 +86,22 @@ index 0000000..9c71271 + + os.system('make V=1 PREFIX="{}" install'.format(args.prefix)) + -+main() ++def win_main(): ++ src_dir = os.path.dirname(os.path.realpath(__file__)) ++ dst_dir = os.getcwd() + "/moonjit" ++ shutil.copytree(src_dir, os.path.basename(src_dir)) ++ os.chdir(os.path.basename(src_dir) + "/src") ++ os.system('msvcbuild.bat static') ++ os.makedirs(dst_dir + "/lib", exist_ok=True) ++ shutil.copy("lua51.lib", dst_dir + "/lib") ++ os.makedirs(dst_dir + "/include/moonjit-2.2", exist_ok=True) ++ for header in ["lauxlib.h", "luaconf.h", "lua.h", "lua.hpp", "luajit.h", "lualib.h"]: ++ shutil.copy(header, dst_dir + "/include/moonjit-2.2") ++ os.makedirs(dst_dir + "/bin", exist_ok=True) ++ shutil.copy("luajit.exe", dst_dir + "/bin") ++ ++if os.name == 'nt': ++ win_main() ++else: ++ main() + diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 97bbded071fb..b1ea45f4c6fe 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -8,11 +8,6 @@ load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_languag PPC_SKIP_TARGETS = ["envoy.filters.http.lua"] WINDOWS_SKIP_TARGETS = [ - "envoy.filters.http.adaptive_concurrency", - "envoy.filters.network.kafka_broker", - "envoy.filters.network.mysql_proxy", - "envoy.stat_sinks.hystrix", - "envoy.stat_sinks.statsd", "envoy.tracers.dynamic_ot", "envoy.tracers.lightstep", "envoy.tracers.datadog", @@ -788,6 +783,7 @@ filegroup( http_archive( name = "kafka_source", build_file_content = KAFKASOURCE_BUILD_CONTENT, + patches = ["@envoy//bazel/external:kafka_int32.patch"], **REPOSITORY_LOCATIONS["kafka_source"] ) diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index 9677009b9965..e10c56e5ee1a 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -26,8 +26,14 @@ BAZEL_STARTUP_OPTIONS="--noworkspace_rc --bazelrc=windows/.bazelrc --output_base BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failures \ --test_output=all ${BAZEL_BUILD_EXTRA_OPTIONS} ${BAZEL_EXTRA_TEST_OPTIONS}" -bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //bazel/... --build_tag_filters=-skip_on_windows +# With all envoy-static and //test/ tree building, no need to test compile externals +# bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //bazel/... --build_tag_filters=-skip_on_windows bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //source/exe:envoy-static --build_tag_filters=-skip_on_windows -# bazel ${BAZEL_STARTUP_OPTIONS} test ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only --test_summary=terse --test_output=errors +# Test compilation of known MSVC-compatible test sources +bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only + +# Test invocations of known-working tests on Windows +# bazel ${BAZEL_STARTUP_OPTIONS} test ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows,-fails_on_windows --build_tests_only --test_summary=terse --test_output=errors + diff --git a/source/exe/BUILD b/source/exe/BUILD index 43ff9f36fd9f..867605c7663d 100644 --- a/source/exe/BUILD +++ b/source/exe/BUILD @@ -9,12 +9,8 @@ load( "envoy_cc_win32_library", "envoy_package", ) -load( - "//source/extensions:all_extensions.bzl", - "envoy_all_extensions", - "envoy_windows_extensions", -) -load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS") +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") envoy_package() @@ -41,7 +37,7 @@ envoy_cc_library( "//source/server:server_lib", "//source/server:listener_hooks_lib", ] + select({ - "//bazel:windows_x86_64": envoy_windows_extensions(), + "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), "//conditions:default": envoy_all_extensions(), }), diff --git a/source/extensions/clusters/redis/redis_cluster.cc b/source/extensions/clusters/redis/redis_cluster.cc index dc0ebae317c0..0d07abb071d2 100644 --- a/source/extensions/clusters/redis/redis_cluster.cc +++ b/source/extensions/clusters/redis/redis_cluster.cc @@ -1,7 +1,5 @@ #include "redis_cluster.h" -#include - #include "envoy/config/cluster/redis/redis_cluster.pb.h" #include "envoy/config/cluster/redis/redis_cluster.pb.validate.h" #include "envoy/config/cluster/v3/cluster.pb.h" diff --git a/source/extensions/filters/network/redis_proxy/command_splitter_impl.cc b/source/extensions/filters/network/redis_proxy/command_splitter_impl.cc index 0f7abdf4b793..adfbf7ff9fbe 100644 --- a/source/extensions/filters/network/redis_proxy/command_splitter_impl.cc +++ b/source/extensions/filters/network/redis_proxy/command_splitter_impl.cc @@ -189,7 +189,7 @@ SplitRequestPtr MGETRequest::create(Router& router, Common::Redis::RespValuePtr& request_ptr->pending_response_->asArray().swap(responses); Common::Redis::RespValueSharedPtr base_request = std::move(incoming_request); - for (uint64_t i = 1; i < base_request->asArray().size(); i++) { + for (uint32_t i = 1; i < base_request->asArray().size(); i++) { request_ptr->pending_requests_.emplace_back(*request_ptr, i - 1); PendingRequest& pending_request = request_ptr->pending_requests_.back(); @@ -265,8 +265,8 @@ SplitRequestPtr MSETRequest::create(Router& router, Common::Redis::RespValuePtr& request_ptr->pending_response_->type(Common::Redis::RespType::SimpleString); Common::Redis::RespValueSharedPtr base_request = std::move(incoming_request); - unsigned fragment_index = 0; - for (unsigned i = 1; i < base_request->asArray().size(); i += 2) { + uint32_t fragment_index = 0; + for (uint32_t i = 1; i < base_request->asArray().size(); i += 2) { request_ptr->pending_requests_.emplace_back(*request_ptr, fragment_index++); PendingRequest& pending_request = request_ptr->pending_requests_.back(); @@ -336,7 +336,7 @@ SplitRequestPtr SplitKeysSumResultRequest::create(Router& router, request_ptr->pending_response_->type(Common::Redis::RespType::Integer); Common::Redis::RespValueSharedPtr base_request = std::move(incoming_request); - for (unsigned i = 1; i < base_request->asArray().size(); i++) { + for (uint32_t i = 1; i < base_request->asArray().size(); i++) { request_ptr->pending_requests_.emplace_back(*request_ptr, i - 1); PendingRequest& pending_request = request_ptr->pending_requests_.back(); diff --git a/source/extensions/quic_listeners/quiche/platform/quic_iovec_impl.h b/source/extensions/quic_listeners/quiche/platform/quic_iovec_impl.h index 66ed85ce1aa7..eeffd32cb814 100644 --- a/source/extensions/quic_listeners/quiche/platform/quic_iovec_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/quic_iovec_impl.h @@ -6,6 +6,4 @@ // consumed or referenced directly by other Envoy code. It serves purely as a // porting layer for QUICHE. -// TODO(danzh) Add Windows support for iovec. -// Only works in platforms supports POSIX for now. -#include +#include "envoy/common/platform.h" diff --git a/source/extensions/stat_sinks/hystrix/BUILD b/source/extensions/stat_sinks/hystrix/BUILD index 8437dff366b0..d058088df9b2 100644 --- a/source/extensions/stat_sinks/hystrix/BUILD +++ b/source/extensions/stat_sinks/hystrix/BUILD @@ -17,11 +17,11 @@ envoy_cc_extension( hdrs = ["config.h"], security_posture = "data_plane_agnostic", deps = [ + ":hystrix_lib", "//include/envoy/registry", "//source/common/network:address_lib", "//source/common/network:resolver_lib", "//source/extensions/stat_sinks:well_known_names", - "//source/extensions/stat_sinks/hystrix:hystrix_lib", "//source/server:configuration_lib", "@envoy_api//envoy/config/metrics/v3:pkg_cc_proto", ], diff --git a/source/extensions/stat_sinks/hystrix/hystrix.h b/source/extensions/stat_sinks/hystrix/hystrix.h index e0daa8caae74..08aa4f6b0c7e 100644 --- a/source/extensions/stat_sinks/hystrix/hystrix.h +++ b/source/extensions/stat_sinks/hystrix/hystrix.h @@ -23,8 +23,8 @@ using QuantileLatencyMap = std::unordered_map; static const std::vector hystrix_quantiles = {0, 0.25, 0.5, 0.75, 0.90, 0.95, 0.99, 0.995, 1}; -struct { - const std::string AllowHeadersHystrix{"Accept, Cache-Control, X-Requested-With, Last-Event-ID"}; +static const struct { + absl::string_view AllowHeadersHystrix{"Accept, Cache-Control, X-Requested-With, Last-Event-ID"}; } AccessControlAllowHeadersValue; struct ClusterStatsCache { diff --git a/test/common/buffer/owned_impl_test.cc b/test/common/buffer/owned_impl_test.cc index d537bd657030..b9920cb465d7 100644 --- a/test/common/buffer/owned_impl_test.cc +++ b/test/common/buffer/owned_impl_test.cc @@ -650,19 +650,24 @@ TEST_F(OwnedImplTest, ReserveZeroCommit) { slices[i].len_ = 0; } buf.commit(slices, allocated_slices); - int pipe_fds[2] = {0, 0}; - ASSERT_EQ(::pipe(pipe_fds), 0); + os_fd_t pipe_fds[2] = {0, 0}; + auto& os_sys_calls = Api::OsSysCallsSingleton::get(); +#ifdef WIN32 + ASSERT_EQ(os_sys_calls.socketpair(AF_INET, SOCK_STREAM, 0, pipe_fds).rc_, 0); +#else + ASSERT_EQ(pipe(pipe_fds), 0); +#endif Network::IoSocketHandleImpl io_handle(pipe_fds[0]); - ASSERT_EQ(::fcntl(pipe_fds[0], F_SETFL, O_NONBLOCK), 0); - ASSERT_EQ(::fcntl(pipe_fds[1], F_SETFL, O_NONBLOCK), 0); + ASSERT_EQ(os_sys_calls.setsocketblocking(pipe_fds[0], false).rc_, 0); + ASSERT_EQ(os_sys_calls.setsocketblocking(pipe_fds[1], false).rc_, 0); const uint32_t max_length = 1953; std::string data(max_length, 'e'); - const ssize_t rc = ::write(pipe_fds[1], data.data(), max_length); + const ssize_t rc = os_sys_calls.write(pipe_fds[1], data.data(), max_length).rc_; ASSERT_GT(rc, 0); const uint32_t previous_length = buf.length(); Api::IoCallUint64Result result = buf.read(io_handle, max_length); ASSERT_EQ(result.rc_, static_cast(rc)); - ASSERT_EQ(::close(pipe_fds[1]), 0); + ASSERT_EQ(os_sys_calls.close(pipe_fds[1]).rc_, 0); ASSERT_EQ(previous_length, buf.search(data.data(), rc, previous_length)); EXPECT_EQ("bbbbb", buf.toString().substr(0, 5)); expectSlices({{5, 0, 4056}, {1953, 2103, 4056}}, buf); @@ -673,19 +678,24 @@ TEST_F(OwnedImplTest, ReadReserveAndCommit) { Buffer::OwnedImpl buf; buf.add("bbbbb"); - int pipe_fds[2] = {0, 0}; - ASSERT_EQ(::pipe(pipe_fds), 0); + os_fd_t pipe_fds[2] = {0, 0}; + auto& os_sys_calls = Api::OsSysCallsSingleton::get(); +#ifdef WIN32 + ASSERT_EQ(os_sys_calls.socketpair(AF_INET, SOCK_STREAM, 0, pipe_fds).rc_, 0); +#else + ASSERT_EQ(pipe(pipe_fds), 0); +#endif Network::IoSocketHandleImpl io_handle(pipe_fds[0]); - ASSERT_EQ(::fcntl(pipe_fds[0], F_SETFL, O_NONBLOCK), 0); - ASSERT_EQ(::fcntl(pipe_fds[1], F_SETFL, O_NONBLOCK), 0); + ASSERT_EQ(os_sys_calls.setsocketblocking(pipe_fds[0], false).rc_, 0); + ASSERT_EQ(os_sys_calls.setsocketblocking(pipe_fds[1], false).rc_, 0); const uint32_t read_length = 32768; std::string data = "e"; - const ssize_t rc = ::write(pipe_fds[1], data.data(), data.size()); + const ssize_t rc = os_sys_calls.write(pipe_fds[1], data.data(), data.size()).rc_; ASSERT_GT(rc, 0); Api::IoCallUint64Result result = buf.read(io_handle, read_length); ASSERT_EQ(result.rc_, static_cast(rc)); - ASSERT_EQ(::close(pipe_fds[1]), 0); + ASSERT_EQ(os_sys_calls.close(pipe_fds[1]).rc_, 0); EXPECT_EQ("bbbbbe", buf.toString()); expectSlices({{6, 4050, 4056}}, buf); } diff --git a/test/common/buffer/watermark_buffer_test.cc b/test/common/buffer/watermark_buffer_test.cc index 1010e649843b..f5c13fa7e177 100644 --- a/test/common/buffer/watermark_buffer_test.cc +++ b/test/common/buffer/watermark_buffer_test.cc @@ -1,5 +1,6 @@ #include +#include "common/api/os_sys_calls_impl.h" #include "common/buffer/buffer_impl.h" #include "common/buffer/watermark_buffer.h" #include "common/network/io_socket_handle_impl.h" @@ -199,7 +200,12 @@ TEST_F(WatermarkBufferTest, MoveOneByte) { TEST_F(WatermarkBufferTest, WatermarkFdFunctions) { os_fd_t pipe_fds[2] = {0, 0}; +#ifdef WIN32 + auto& os_sys_calls = Api::OsSysCallsSingleton::get(); + ASSERT_EQ(0, os_sys_calls.socketpair(AF_INET, SOCK_STREAM, 0, pipe_fds).rc_); +#else ASSERT_EQ(0, pipe(pipe_fds)); +#endif buffer_.add(TEN_BYTES, 10); buffer_.add(TEN_BYTES, 10); diff --git a/test/common/grpc/BUILD b/test/common/grpc/BUILD index d790518e77bb..612f7f798b5b 100644 --- a/test/common/grpc/BUILD +++ b/test/common/grpc/BUILD @@ -161,6 +161,8 @@ envoy_cc_test_library( envoy_cc_test( name = "grpc_client_integration_test", srcs = ["grpc_client_integration_test.cc"], + # Fails on windows; Connection is terminated early testing BasicStream/IPv4_EnvoyGrpc + tags = ["fails_on_windows"], deps = [ ":grpc_client_integration_test_harness_lib", "//source/common/grpc:async_client_lib", diff --git a/test/common/http/BUILD b/test/common/http/BUILD index c7dadc09bc49..a87abf713fca 100644 --- a/test/common/http/BUILD +++ b/test/common/http/BUILD @@ -49,6 +49,8 @@ envoy_cc_test( envoy_cc_test( name = "codec_client_test", srcs = ["codec_client_test.cc"], + # IpVersions/CodecNetworkTest.SendData/IPv4: Test times out on Windows. + tags = ["fails_on_windows"], deps = [ ":common_lib", "//source/common/buffer:buffer_lib", diff --git a/test/common/network/BUILD b/test/common/network/BUILD index b4cd4e76a405..f1bf473fb958 100644 --- a/test/common/network/BUILD +++ b/test/common/network/BUILD @@ -73,6 +73,8 @@ envoy_cc_test( envoy_cc_test( name = "connection_impl_test", srcs = ["connection_impl_test.cc"], + # Times out on Windows + tags = ["fails_on_windows"], deps = [ "//source/common/buffer:buffer_lib", "//source/common/common:empty_string", @@ -177,6 +179,8 @@ envoy_cc_test( envoy_cc_test( name = "listener_impl_test", srcs = ["listener_impl_test.cc"], + # Times out on Windows + tags = ["fails_on_windows"], deps = [ "//source/common/event:dispatcher_lib", "//source/common/network:address_lib", diff --git a/test/common/network/dns_impl_test.cc b/test/common/network/dns_impl_test.cc index c40716cac857..626567b2d347 100644 --- a/test/common/network/dns_impl_test.cc +++ b/test/common/network/dns_impl_test.cc @@ -1,13 +1,10 @@ -#include -#include -#include - #include #include #include #include #include +#include "envoy/common/platform.h" #include "envoy/config/core/v3/address.pb.h" #include "envoy/event/dispatcher.h" #include "envoy/network/address.h" @@ -34,6 +31,13 @@ #include "ares_dns.h" #include "gtest/gtest.h" +#if !defined(WIN32) +#include +#include +#else +#include "nameser.h" +#endif + using testing::_; using testing::Contains; using testing::InSequence; diff --git a/test/common/router/BUILD b/test/common/router/BUILD index 2ac9c91f26f3..c3cab9845d2c 100644 --- a/test/common/router/BUILD +++ b/test/common/router/BUILD @@ -221,6 +221,8 @@ envoy_cc_fuzz_test( name = "route_fuzz_test", srcs = ["route_fuzz_test.cc"], corpus = ":route_corpus", + # The corpus_from_config_impl currently does not work, the tests it runs do not pass + tags = ["skip_on_windows"], deps = [ ":route_fuzz_proto_cc_proto", "//source/common/router:config_lib", diff --git a/test/common/runtime/BUILD b/test/common/runtime/BUILD index 3bdc96107997..1c5c460b72a6 100644 --- a/test/common/runtime/BUILD +++ b/test/common/runtime/BUILD @@ -29,6 +29,8 @@ envoy_cc_test_library( envoy_cc_test( name = "runtime_protos_test", srcs = ["runtime_protos_test.cc"], + # Pass for the time being, test times out on windows + tags = ["fails_on_windows"], deps = [ "//source/common/runtime:runtime_lib", "//test/mocks/runtime:runtime_mocks", @@ -42,6 +44,9 @@ envoy_cc_test( name = "runtime_impl_test", srcs = ["runtime_impl_test.cc"], data = glob(["test_data/**"]) + ["filesystem_setup.sh"], + # Inexplicable failure promoting arguments to mock, see + # https://envoyproxy.slack.com/archives/CNAK09BSB/p1571946165007300 + tags = ["fails_on_windows"], deps = [ "//source/common/config:runtime_utility_lib", "//source/common/runtime:runtime_lib", diff --git a/test/common/signal/BUILD b/test/common/signal/BUILD index c29cfd2a56b3..746babe0fedf 100644 --- a/test/common/signal/BUILD +++ b/test/common/signal/BUILD @@ -11,7 +11,11 @@ envoy_package() envoy_cc_test( name = "signals_test", srcs = ["signals_test.cc"], - tags = ["backtrace"], + # Posix signal tests are irrelevant to Windows + tags = [ + "backtrace", + "skip_on_windows", + ], deps = [ "//source/common/signal:sigaction_lib", "//test/test_common:utility_lib", diff --git a/test/config_test/BUILD b/test/config_test/BUILD index 494341c4b6fd..a00de6bb96c4 100644 --- a/test/config_test/BUILD +++ b/test/config_test/BUILD @@ -6,10 +6,8 @@ load( "envoy_cc_test_library", "envoy_package", ) -load( - "//source/extensions:all_extensions.bzl", - "envoy_all_extensions", -) +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") envoy_package() @@ -45,5 +43,9 @@ envoy_cc_test_library( "//test/mocks/ssl:ssl_mocks", "//test/test_common:threadsafe_singleton_injector_lib", "//test/test_common:simulated_time_system_lib", - ] + envoy_all_extensions(), + ] + select({ + "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), + "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), + "//conditions:default": envoy_all_extensions(), + }), ) diff --git a/test/exe/BUILD b/test/exe/BUILD index 9c43e1b1ead8..b17fabe48075 100644 --- a/test/exe/BUILD +++ b/test/exe/BUILD @@ -17,6 +17,8 @@ envoy_sh_test( "//bazel:raw_build_id.ldscript", "//source/exe:envoy-static", ], + # The sh_test helper from Bazel does not work as expected, see: https://github.com/bazelbuild/bazel/issues/10959 + tags = ["fails_on_windows"], ) envoy_sh_test( @@ -24,8 +26,14 @@ envoy_sh_test( srcs = ["envoy_static_test.sh"], coverage = False, data = ["//source/exe:envoy-static"], + # For windows, we expect to use a .ps1 script that leverages dumpbin.exe, see: + # https://github.com/envoyproxy/envoy/pull/8280#pullrequestreview-290187328 + # The sh_test helper from Bazel does not work as expected, see: https://github.com/bazelbuild/bazel/issues/10959 # Sanitizers doesn't like statically linked lib(std)c++ and libgcc, skip this test in that context. - tags = ["no_san"], + tags = [ + "fails_on_windows", + "no_san", + ], ) envoy_sh_test( @@ -33,7 +41,11 @@ envoy_sh_test( srcs = ["pie_test.sh"], coverage = False, data = ["//source/exe:envoy-static"], - tags = ["nofips"], + # Since VS2015 or even earlier, link.exe defaults to PIE generation + tags = [ + "skip_on_windows", + "nofips", + ], ) envoy_sh_test( @@ -45,6 +57,8 @@ envoy_sh_test( "//bazel:raw_build_id.ldscript", "//source/exe:envoy-static", ], + # The sh_test helper from Bazel does not work as expected, see: https://github.com/bazelbuild/bazel/issues/10959 + tags = ["fails_on_windows"], ) envoy_cc_test( diff --git a/test/exe/main_common_test.cc b/test/exe/main_common_test.cc index b34207ccd5b5..cd7102737c74 100644 --- a/test/exe/main_common_test.cc +++ b/test/exe/main_common_test.cc @@ -59,7 +59,12 @@ class MainCommonTest : public testing::TestWithParam Api::SysCallSizeResult { + .WillOnce(Invoke([](os_fd_t, void*, size_t, int) -> Api::SysCallSizeResult { return Api::SysCallSizeResult{ssize_t(-1), 0}; })); EXPECT_CALL(dispatcher_, createFileEvent_(_, _, _, _)).Times(0); @@ -98,11 +98,12 @@ TEST_F(HttpInspectorTest, InlineReadInspectHttp10) { "a52df4a0-ed00-4a19-86a7-80e5049c6c84\r\nx-envoy-expected-rq-timeout-ms: " "15000\r\ncontent-length: 0\r\n\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce( + Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.0")}; EXPECT_CALL(dispatcher_, createFileEvent_(_, _, _, _)).Times(0); @@ -122,11 +123,12 @@ TEST_F(HttpInspectorTest, InlineReadParseError) { "a52df4a0-ed00-4a19-86a7-80e5049c6c84\r\nx-envoy-expected-rq-timeout-ms: " "15000\r\ncontent-length: 0\r\n\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce( + Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); EXPECT_CALL(dispatcher_, createFileEvent_(_, _, _, _)).Times(0); EXPECT_CALL(socket_, setRequestedApplicationProtocols(_)).Times(0); auto accepted = filter_->onAccept(cb_); @@ -143,11 +145,12 @@ TEST_F(HttpInspectorTest, InspectHttp10) { "15000\r\ncontent-length: 0\r\n\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce( + Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.0")}; @@ -166,11 +169,12 @@ TEST_F(HttpInspectorTest, InspectHttp11) { "15000\r\ncontent-length: 0\r\n\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce( + Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.1")}; @@ -189,11 +193,12 @@ TEST_F(HttpInspectorTest, InspectHttp11WithNonEmptyRequestBody) { "15000\r\ncontent-length: 3\r\n\r\nfoo"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce( + Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.1")}; @@ -209,11 +214,12 @@ TEST_F(HttpInspectorTest, ExtraSpaceInRequestLine) { // ^^ ^^ EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce( + Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.1")}; @@ -228,11 +234,12 @@ TEST_F(HttpInspectorTest, InvalidHttpMethod) { const absl::string_view header = "BAD /anything HTTP/1.1"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce( + Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); EXPECT_CALL(socket_, setRequestedApplicationProtocols(_)).Times(0); EXPECT_CALL(cb_, continueFilterChain(true)); @@ -245,11 +252,12 @@ TEST_F(HttpInspectorTest, InvalidHttpRequestLine) { const absl::string_view header = "BAD /anything HTTP/1.1\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce( + Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); EXPECT_CALL(socket_, setRequestedApplicationProtocols(_)).Times(0); EXPECT_CALL(cb_, continueFilterChain(_)); @@ -262,11 +270,12 @@ TEST_F(HttpInspectorTest, OldHttpProtocol) { const absl::string_view header = "GET /anything HTTP/0.9\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce( + Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.0")}; EXPECT_CALL(socket_, setRequestedApplicationProtocols(alpn_protos)); @@ -280,11 +289,12 @@ TEST_F(HttpInspectorTest, InvalidRequestLine) { const absl::string_view header = "GET /anything HTTP/1.1 BadRequestLine\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce( + Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); EXPECT_CALL(socket_, setRequestedApplicationProtocols(_)).Times(0); EXPECT_CALL(cb_, continueFilterChain(true)); @@ -304,11 +314,12 @@ TEST_F(HttpInspectorTest, InspectHttp2) { std::vector data = Hex::decode(header); EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&data](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= data.size()); - memcpy(buffer, data.data(), data.size()); - return Api::SysCallSizeResult{ssize_t(data.size()), 0}; - })); + .WillOnce( + Invoke([&data](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= data.size()); + memcpy(buffer, data.data(), data.size()); + return Api::SysCallSizeResult{ssize_t(data.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("h2c")}; @@ -325,11 +336,12 @@ TEST_F(HttpInspectorTest, InvalidConnectionPreface) { const std::vector data = Hex::decode(header); EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&data](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= data.size()); - memcpy(buffer, data.data(), data.size()); - return Api::SysCallSizeResult{ssize_t(data.size()), 0}; - })); + .WillOnce( + Invoke([&data](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= data.size()); + memcpy(buffer, data.data(), data.size()); + return Api::SysCallSizeResult{ssize_t(data.size()), 0}; + })); EXPECT_CALL(socket_, setRequestedApplicationProtocols(_)).Times(0); EXPECT_CALL(cb_, continueFilterChain(true)).Times(0); @@ -368,8 +380,8 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp2) { for (size_t i = 1; i <= 24; i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&data, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce(Invoke( + [&data, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= i); memcpy(buffer, data.data(), i); return Api::SysCallSizeResult{ssize_t(i), 0}; @@ -401,8 +413,8 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp2BadPreface) { for (size_t i = 1; i <= data.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&data, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce(Invoke( + [&data, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= i); memcpy(buffer, data.data(), i); return Api::SysCallSizeResult{ssize_t(i), 0}; @@ -433,8 +445,8 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp1) { for (size_t i = 1; i <= data.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&data, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce(Invoke( + [&data, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= i); memcpy(buffer, data.data(), i); return Api::SysCallSizeResult{ssize_t(i), 0}; @@ -467,7 +479,7 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp1IncompleteHeader) { for (size_t i = 1; i <= data.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&data, &end_stream, i](int, void* buffer, size_t length, + .WillOnce(Invoke([&data, &end_stream, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= i); memcpy(buffer, data.data(), i); @@ -499,8 +511,8 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp1IncompleteBadHeader) { for (size_t i = 1; i <= data.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&data, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce(Invoke( + [&data, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= i); memcpy(buffer, data.data(), i); return Api::SysCallSizeResult{ssize_t(i), 0}; @@ -533,7 +545,7 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp1BadProtocol) { for (size_t i = 1; i <= truncate_header.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&truncate_header, i](int, void* buffer, size_t length, + .WillOnce(Invoke([&truncate_header, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= truncate_header.size()); memcpy(buffer, truncate_header.data(), truncate_header.size()); @@ -577,8 +589,8 @@ TEST_F(HttpInspectorTest, Http1WithLargeRequestLine) { len = size_t(Config::MAX_INSPECT_SIZE / (3 - i)); } EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&data, len](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce(Invoke( + [&data, len](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= len); memcpy(buffer, data.data(), len); return Api::SysCallSizeResult{ssize_t(len), 0}; @@ -613,8 +625,8 @@ TEST_F(HttpInspectorTest, Http1WithLargeHeader) { for (size_t i = 1; i <= 20; i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&data, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce(Invoke( + [&data, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= data.size()); memcpy(buffer, data.data(), i); return Api::SysCallSizeResult{ssize_t(i), 0}; diff --git a/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc b/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc index 1969cac95f8f..8d1da06977a4 100644 --- a/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc +++ b/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc @@ -163,12 +163,12 @@ TEST_P(TlsInspectorTest, MultipleReads) { })); for (size_t i = 1; i <= client_hello.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke( - [&client_hello, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= client_hello.size()); - memcpy(buffer, client_hello.data(), client_hello.size()); - return Api::SysCallSizeResult{ssize_t(i), 0}; - })); + .WillOnce(Invoke([&client_hello, i](os_fd_t, void* buffer, size_t length, + int) -> Api::SysCallSizeResult { + ASSERT(length >= client_hello.size()); + memcpy(buffer, client_hello.data(), client_hello.size()); + return Api::SysCallSizeResult{ssize_t(i), 0}; + })); } } diff --git a/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc b/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc index 1a0a2cbe061d..d5b848105e38 100644 --- a/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc +++ b/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc @@ -1,5 +1,8 @@ +#ifndef WIN32 #include +#endif + #include "extensions/filters/network/mysql_proxy/mysql_codec.h" #include "extensions/filters/network/mysql_proxy/mysql_codec_clogin.h" #include "extensions/filters/network/mysql_proxy/mysql_codec_clogin_resp.h" diff --git a/test/extensions/quic_listeners/quiche/BUILD b/test/extensions/quic_listeners/quiche/BUILD index f7b52aed56d2..7e24810fe50b 100644 --- a/test/extensions/quic_listeners/quiche/BUILD +++ b/test/extensions/quic_listeners/quiche/BUILD @@ -27,7 +27,11 @@ envoy_cc_test( name = "envoy_quic_writer_test", srcs = ["envoy_quic_writer_test.cc"], external_deps = ["quiche_quic_platform"], - tags = ["nofips"], + # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows + tags = [ + "nofips", + "skip_on_windows", + ], deps = [ "//source/common/network:io_socket_error_lib", "//source/extensions/quic_listeners/quiche:envoy_quic_packet_writer_lib", @@ -52,7 +56,11 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_server_stream_test", srcs = ["envoy_quic_server_stream_test.cc"], - tags = ["nofips"], + # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows + tags = [ + "nofips", + "skip_on_windows", + ], deps = [ ":quic_test_utils_for_envoy_lib", ":test_utils_lib", @@ -72,7 +80,11 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_client_stream_test", srcs = ["envoy_quic_client_stream_test.cc"], - tags = ["nofips"], + # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows + tags = [ + "nofips", + "skip_on_windows", + ], deps = [ ":quic_test_utils_for_envoy_lib", ":test_utils_lib", @@ -92,7 +104,11 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_server_session_test", srcs = ["envoy_quic_server_session_test.cc"], - tags = ["nofips"], + # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows + tags = [ + "nofips", + "skip_on_windows", + ], deps = [ ":quic_test_utils_for_envoy_lib", "//include/envoy/stats:stats_macros", @@ -119,7 +135,11 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_client_session_test", srcs = ["envoy_quic_client_session_test.cc"], - tags = ["nofips"], + # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows + tags = [ + "nofips", + "skip_on_windows", + ], deps = [ ":quic_test_utils_for_envoy_lib", "//include/envoy/stats:stats_macros", @@ -140,7 +160,11 @@ envoy_cc_test( envoy_cc_test( name = "active_quic_listener_test", srcs = ["active_quic_listener_test.cc"], - tags = ["nofips"], + # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows + tags = [ + "nofips", + "skip_on_windows", + ], deps = [ ":quic_test_utils_for_envoy_lib", "//source/extensions/quic_listeners/quiche:active_quic_listener_lib", @@ -156,7 +180,11 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_dispatcher_test", srcs = ["envoy_quic_dispatcher_test.cc"], - tags = ["nofips"], + # quic_sent_packet_manager.cc does not compile error: warning C4715: 'quic::QuicSentPacketManager::OnRetransmissionTimeout': not all control paths return a value + tags = [ + "nofips", + "skip_on_windows", + ], deps = [ ":quic_test_utils_for_envoy_lib", "//include/envoy/stats:stats_macros", @@ -202,7 +230,11 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_utils_test", srcs = ["envoy_quic_utils_test.cc"], - tags = ["nofips"], + # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows + tags = [ + "nofips", + "skip_on_windows", + ], deps = [ ":quic_test_utils_for_envoy_lib", "//source/extensions/quic_listeners/quiche:envoy_quic_utils_lib", @@ -214,7 +246,11 @@ envoy_cc_test( envoy_cc_test( name = "active_quic_listener_config_test", srcs = ["active_quic_listener_config_test.cc"], - tags = ["nofips"], + # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows + tags = [ + "nofips", + "skip_on_windows", + ], deps = [ "//source/common/config:utility_lib", "//source/extensions/quic_listeners/quiche:active_quic_listener_config_lib", @@ -225,7 +261,11 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_simulated_watermark_buffer_test", srcs = ["envoy_quic_simulated_watermark_buffer_test.cc"], - tags = ["nofips"], + # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows + tags = [ + "nofips", + "skip_on_windows", + ], deps = ["//source/extensions/quic_listeners/quiche:envoy_quic_simulated_watermark_buffer_lib"], ) diff --git a/test/extensions/quic_listeners/quiche/integration/BUILD b/test/extensions/quic_listeners/quiche/integration/BUILD index e277da580d53..ec7a3cd5dcfa 100644 --- a/test/extensions/quic_listeners/quiche/integration/BUILD +++ b/test/extensions/quic_listeners/quiche/integration/BUILD @@ -12,7 +12,11 @@ envoy_cc_test( name = "quic_http_integration_test", srcs = ["quic_http_integration_test.cc"], data = ["//test/config/integration/certs"], - tags = ["nofips"], + # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows + tags = [ + "nofips", + "skip_on_windows", + ], deps = [ "//source/extensions/filters/http/dynamo:config", "//source/extensions/quic_listeners/quiche:active_quic_listener_config_lib", diff --git a/test/extensions/quic_listeners/quiche/platform/BUILD b/test/extensions/quic_listeners/quiche/platform/BUILD index ced7bf94658d..f48ced9263f2 100644 --- a/test/extensions/quic_listeners/quiche/platform/BUILD +++ b/test/extensions/quic_listeners/quiche/platform/BUILD @@ -205,7 +205,7 @@ envoy_cc_test_library( hdrs = ["quic_test_output_impl.h"], tags = ["nofips"], deps = [ - "//source/common/filesystem:filesystem_lib", + "//test/test_common:file_system_for_test_lib", "@com_googlesource_quiche//:quic_platform_base", "@com_googlesource_quiche//:quiche_common_platform", ], diff --git a/test/extensions/quic_listeners/quiche/platform/quic_test_output_impl.cc b/test/extensions/quic_listeners/quiche/platform/quic_test_output_impl.cc index 9b67b3d3131e..556f6cd3e18a 100644 --- a/test/extensions/quic_listeners/quiche/platform/quic_test_output_impl.cc +++ b/test/extensions/quic_listeners/quiche/platform/quic_test_output_impl.cc @@ -8,7 +8,7 @@ #include -#include "common/filesystem/filesystem_impl.h" +#include "test/test_common/file_system_for_test.h" #include "absl/time/clock.h" #include "absl/time/time.h" @@ -36,7 +36,7 @@ void QuicRecordTestOutputToFile(const std::string& filename, quiche::QuicheStrin output_dir += '/'; } - Envoy::Filesystem::InstanceImplPosix file_system; + Envoy::Filesystem::Instance& file_system = Envoy::Filesystem::fileSystemForTest(); if (!file_system.directoryExists(output_dir)) { QUIC_LOG(ERROR) << "Directory does not exist while writing test output: " << output_dir; return; @@ -87,7 +87,7 @@ bool QuicLoadTestOutputImpl(quiche::QuicheStringPiece filename, std::string* dat const std::string read_path = read_dir + filename.data(); - Envoy::Filesystem::InstanceImplPosix file_system; + Envoy::Filesystem::Instance& file_system = Envoy::Filesystem::fileSystemForTest(); if (!file_system.fileExists(read_path)) { QUIC_LOG(ERROR) << "Test output file does not exist: " << read_path; return false; diff --git a/test/extensions/quic_listeners/quiche/quic_io_handle_wrapper_test.cc b/test/extensions/quic_listeners/quiche/quic_io_handle_wrapper_test.cc index 5eb1d9629d36..63d2aef7b392 100644 --- a/test/extensions/quic_listeners/quiche/quic_io_handle_wrapper_test.cc +++ b/test/extensions/quic_listeners/quiche/quic_io_handle_wrapper_test.cc @@ -1,8 +1,8 @@ -#include - #include #include +#include "envoy/common/platform.h" + #include "common/network/address_impl.h" #include "extensions/quic_listeners/quiche/quic_io_handle_wrapper.h" diff --git a/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc b/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc index c35926dd4e5e..c2b3ea48542c 100644 --- a/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc +++ b/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc @@ -3,6 +3,7 @@ #include #include +#include "common/api/os_sys_calls_impl.h" #include "common/network/address_impl.h" #include "common/network/utility.h" @@ -55,7 +56,8 @@ TEST(UdpOverUdsStatsdSinkTest, InitWithPipeAddress) { // this uses low level networking calls because our abstractions in this area only work for IP // sockets. Revisit this also. auto io_handle = uds_address->socket(Network::Address::SocketType::Datagram); - RELEASE_ASSERT(fcntl(io_handle->fd(), F_SETFL, 0) != -1, ""); + RELEASE_ASSERT( + Api::OsSysCallsSingleton::get().setsocketblocking(io_handle->fd(), false).rc_ != -1, ""); uds_address->bind(io_handle->fd()); // Do the flush which should have somewhere to write now. diff --git a/test/extensions/tracers/xray/tracer_test.cc b/test/extensions/tracers/xray/tracer_test.cc index 6c15c69d6821..fa5bbd36493c 100644 --- a/test/extensions/tracers/xray/tracer_test.cc +++ b/test/extensions/tracers/xray/tracer_test.cc @@ -52,7 +52,7 @@ TEST_F(XRayTracerTest, SerializeSpanTest) { constexpr auto expected_x_forwarded_for = "false"; constexpr auto expected_upstream_address = "10.0.0.200"; - auto on_send = [](const std::string& json) { + auto on_send = [&](const std::string& json) { ASSERT_FALSE(json.empty()); daemon::Segment s; MessageUtil::loadFromJson(json, s, ProtobufMessage::getNullValidationVisitor()); @@ -102,7 +102,7 @@ TEST_F(XRayTracerTest, ChildSpanHasParentInfo) { const XRay::Span* xray_parent_span = static_cast(parent_span.get()); const std::string expected_parent_id = xray_parent_span->Id(); - auto on_send = [xray_parent_span, expected_parent_id](const std::string& json) { + auto on_send = [&](const std::string& json) { ASSERT_FALSE(json.empty()); daemon::Segment s; MessageUtil::loadFromJson(json, s, ProtobufMessage::getNullValidationVisitor()); diff --git a/test/extensions/tracers/zipkin/tracer_test.cc b/test/extensions/tracers/zipkin/tracer_test.cc index 5ef3a61c3cc7..11fc41075454 100644 --- a/test/extensions/tracers/zipkin/tracer_test.cc +++ b/test/extensions/tracers/zipkin/tracer_test.cc @@ -184,7 +184,7 @@ TEST_F(ZipkinTracerTest, SpanCreation) { ON_CALL(config, operationName()).WillByDefault(Return(Tracing::OperationName::Ingress)); TestRandomGenerator generator; - const uint generated_parent_id = generator.random(); + const uint64_t generated_parent_id = generator.random(); SpanContext modified_root_span_context(root_span_context.trace_id_high(), root_span_context.trace_id(), root_span_context.id(), generated_parent_id, root_span_context.sampled()); diff --git a/test/extensions/transport_sockets/tls/BUILD b/test/extensions/transport_sockets/tls/BUILD index 6e878a85d326..bc1b9b9cbf0f 100644 --- a/test/extensions/transport_sockets/tls/BUILD +++ b/test/extensions/transport_sockets/tls/BUILD @@ -24,6 +24,8 @@ envoy_cc_test( ], external_deps = ["ssl"], shard_count = 4, + # TODO(wrowe): Diagnose timeout error on Windows (skipped for the moment) + tags = ["fails_on_windows"], deps = [ ":test_private_key_method_provider_test_lib", "//include/envoy/network:transport_socket_interface", diff --git a/test/integration/BUILD b/test/integration/BUILD index b00bcd9add35..11d78164aea3 100644 --- a/test/integration/BUILD +++ b/test/integration/BUILD @@ -128,6 +128,8 @@ envoy_cc_test( envoy_cc_test( name = "eds_integration_test", srcs = ["eds_integration_test.cc"], + # Times out on Windows + tags = ["fails_on_windows"], deps = [ ":http_integration_lib", "//source/common/upstream:load_balancer_lib", @@ -230,6 +232,8 @@ envoy_sh_test( "//test/config/integration:server_config_files", "//tools:socket_passing", ], + # Hot restart does not apply on Windows, skipping + tags = ["skip_on_windows"], ) envoy_sh_test( @@ -240,6 +244,8 @@ envoy_sh_test( "//source/exe:envoy-static", "//test/config/integration:server_config_files", ], + # TODO: This script invocation does not work on Windows, see: https://github.com/bazelbuild/bazel/issues/10959 + tags = ["fails_on_windows"], ) envoy_cc_test( @@ -580,6 +586,8 @@ envoy_cc_test( "integration_test.cc", "integration_test.h", ], + # Times out on Windows + tags = ["fails_on_windows"], deps = [ ":http_integration_lib", "//source/common/http:header_map_lib", @@ -618,6 +626,8 @@ envoy_cc_test( "websocket_integration_test.cc", "websocket_integration_test.h", ], + # Times out on Windows + tags = ["fails_on_windows"], deps = [ ":http_protocol_integration_lib", "//source/common/http:header_map_lib", @@ -635,7 +645,13 @@ envoy_cc_test( "echo_integration_test.cc", ], # This test must be run in exclusive mode: see comments in AddRemoveListener - tags = ["exclusive"], + tags = [ + "exclusive", + # TODO(wrowe,sunjayBhatia): Skipping this on Windows as MSVC does allow invoking + # connection.close() from within the lambda that is passed to the RawConnectionDriver + # constructor + "skip_on_windows", + ], deps = [ ":integration_lib", "//source/extensions/filters/network/echo:config", diff --git a/test/integration/tcp_dump.cc b/test/integration/tcp_dump.cc index 95cd8b55c0e0..b8d7c8486156 100644 --- a/test/integration/tcp_dump.cc +++ b/test/integration/tcp_dump.cc @@ -1,12 +1,12 @@ #include "test/integration/tcp_dump.h" #include -#include -#include #include #include +#include "envoy/common/platform.h" + #include "common/common/assert.h" #include "common/common/fmt.h" @@ -14,6 +14,9 @@ namespace Envoy { TcpDump::TcpDump(const std::string& path, const std::string& iface, const std::vector& ports) { +#ifdef WIN32 + ENVOY_LOG_MISC(debug, "tcpdump not supported on windows"); +#else // Remove any extant pcap file. ::unlink(path.c_str()); // Derive the port filter expression. @@ -60,9 +63,11 @@ TcpDump::TcpDump(const std::string& path, const std::string& iface, // Give 50ms sleep. ::usleep(50000); } +#endif } TcpDump::~TcpDump() { +#ifndef WIN32 if (tcpdump_pid_ > 0) { RELEASE_ASSERT(::kill(tcpdump_pid_, SIGINT) == 0, ""); int status; @@ -71,6 +76,7 @@ TcpDump::~TcpDump() { RELEASE_ASSERT(WEXITSTATUS(status) == 0, ""); ENVOY_LOG_MISC(debug, "tcpdump terminated"); } +#endif } } // namespace Envoy diff --git a/test/main.cc b/test/main.cc index 132b9e8ae990..ae438952ea4f 100644 --- a/test/main.cc +++ b/test/main.cc @@ -13,10 +13,39 @@ #include "tools/cpp/runfiles/runfiles.h" +#if defined(WIN32) +static void noop_invalid_parameter_handler(const wchar_t* expression, const wchar_t* function, + const wchar_t* file, unsigned int line, + uintptr_t pReserved) { + return; +} +#endif + using bazel::tools::cpp::runfiles::Runfiles; // The main entry point (and the rest of this file) should have no logic in it, // this allows overriding by site specific versions of main.cc. int main(int argc, char** argv) { +#if defined(WIN32) + _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); + + _set_invalid_parameter_handler(noop_invalid_parameter_handler); + + WORD wVersionRequested; + WSADATA wsaData; + int err; + + /* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */ + wVersionRequested = MAKEWORD(2, 2); + + err = WSAStartup(wVersionRequested, &wsaData); + if (err != 0) { + /* Tell the user that we could not find a usable */ + /* Winsock DLL. */ + printf("WSAStartup failed with error: %d\n", err); + return 1; + } +#endif + #ifndef __APPLE__ absl::InitializeSymbolizer(argv[0]); #endif diff --git a/test/mocks/network/io_handle.h b/test/mocks/network/io_handle.h index 5a5691adda64..fa71a72a6962 100644 --- a/test/mocks/network/io_handle.h +++ b/test/mocks/network/io_handle.h @@ -13,7 +13,7 @@ class MockIoHandle : public IoHandle { MockIoHandle(); ~MockIoHandle(); - MOCK_METHOD(int, fd, (), (const)); + MOCK_METHOD(os_fd_t, fd, (), (const)); MOCK_METHOD(Api::IoCallUint64Result, close, ()); MOCK_METHOD(bool, isOpen, (), (const)); MOCK_METHOD(Api::IoCallUint64Result, readv, diff --git a/test/server/BUILD b/test/server/BUILD index d409bcf0f2f0..b7cc5b92ad53 100644 --- a/test/server/BUILD +++ b/test/server/BUILD @@ -9,10 +9,8 @@ load( "envoy_package", "envoy_select_hot_restart", ) -load( - "//source/extensions:all_extensions.bzl", - "envoy_all_extensions", -) +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") envoy_package() @@ -252,7 +250,11 @@ envoy_cc_test( envoy_cc_test( name = "listener_manager_impl_quic_only_test", srcs = ["listener_manager_impl_quic_only_test.cc"], - tags = ["nofips"], + tags = [ + "nofips", + # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows + "skip_on_windows", + ], deps = [ ":listener_manager_impl_test_lib", ":utility_lib", @@ -309,7 +311,11 @@ envoy_cc_fuzz_test( "//test/mocks/stats:stats_mocks", "//test/test_common:environment_lib", "//test/test_common:test_time_lib", - ] + envoy_all_extensions(), + ] + select({ + "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), + "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), + "//conditions:default": envoy_all_extensions(), + }), ) filegroup( diff --git a/test/server/config_validation/BUILD b/test/server/config_validation/BUILD index e00f954dc3df..f785888ac01c 100644 --- a/test/server/config_validation/BUILD +++ b/test/server/config_validation/BUILD @@ -1,10 +1,8 @@ licenses(["notice"]) # Apache 2 load("//bazel:envoy_build_system.bzl", "envoy_cc_fuzz_test", "envoy_cc_test", "envoy_package") -load( - "//source/extensions:all_extensions.bzl", - "envoy_all_extensions", -) +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") envoy_package() @@ -95,5 +93,9 @@ envoy_cc_fuzz_test( "//test/integration:integration_lib", "//test/mocks/server:server_mocks", "//test/test_common:environment_lib", - ] + envoy_all_extensions(), + ] + select({ + "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), + "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), + "//conditions:default": envoy_all_extensions(), + }), ) diff --git a/test/server/listener_manager_impl_test.cc b/test/server/listener_manager_impl_test.cc index 9dd43cabf762..d537869d2ba4 100644 --- a/test/server/listener_manager_impl_test.cc +++ b/test/server/listener_manager_impl_test.cc @@ -462,7 +462,7 @@ TEST_F(ListenerManagerImplWithRealFiltersTest, StatsScopeTest) { config: {} )EOF"; - EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, {false})); + EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, ListenSocketCreationParams(false))); manager_->addOrUpdateListener(parseListenerFromV2Yaml(yaml), "", true); manager_->listeners().front().get().listenerScope().counter("foo").inc(); @@ -1230,7 +1230,7 @@ name: foo ASSERT_TRUE(SOCKET_VALID(syscall_result.rc_)); ListenerHandle* listener_foo = expectListenerCreate(true, true); - EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, {false})) + EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, ListenSocketCreationParams(false))) .WillOnce(Invoke([this, &syscall_result, &real_listener_factory]( const Network::Address::InstanceConstSharedPtr& address, Network::Address::SocketType socket_type, @@ -1786,7 +1786,7 @@ name: foo )EOF"; ListenerHandle* listener_foo = expectListenerCreate(true, true); - EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, {false})); + EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, ListenSocketCreationParams(false))); EXPECT_CALL(listener_foo->target_, initialize()); EXPECT_TRUE(manager_->addOrUpdateListener(parseListenerFromV2Yaml(listener_foo_yaml), "", true)); @@ -3321,7 +3321,7 @@ TEST_F(ListenerManagerImplWithRealFiltersTest, OriginalDstFilter) { } class OriginalDstTestFilter : public Extensions::ListenerFilters::OriginalDst::OriginalDstFilter { - Network::Address::InstanceConstSharedPtr getOriginalDst(int) override { + Network::Address::InstanceConstSharedPtr getOriginalDst(os_fd_t) override { return Network::Address::InstanceConstSharedPtr{ new Network::Address::Ipv4Instance("127.0.0.2", 2345)}; } @@ -3397,7 +3397,7 @@ TEST_F(ListenerManagerImplWithRealFiltersTest, OriginalDstTestFilter) { class OriginalDstTestFilterIPv6 : public Extensions::ListenerFilters::OriginalDst::OriginalDstFilter { - Network::Address::InstanceConstSharedPtr getOriginalDst(int) override { + Network::Address::InstanceConstSharedPtr getOriginalDst(os_fd_t) override { return Network::Address::InstanceConstSharedPtr{ new Network::Address::Ipv6Instance("1::2", 2345)}; } diff --git a/test/server/listener_manager_impl_test.h b/test/server/listener_manager_impl_test.h index 772c90c606fa..30ee1a5d45ce 100644 --- a/test/server/listener_manager_impl_test.h +++ b/test/server/listener_manager_impl_test.h @@ -186,7 +186,7 @@ class ListenerManagerImplTest : public testing::Test { setsockopt_(_, expected_sockopt_level, expected_sockopt_name, _, sizeof(int))) .Times(expected_num_calls) .WillRepeatedly( - Invoke([expected_value](int, int, int, const void* optval, socklen_t) -> int { + Invoke([expected_value](os_fd_t, int, int, const void* optval, socklen_t) -> int { EXPECT_EQ(expected_value, *static_cast(optval)); return 0; })); diff --git a/test/server/server_test.cc b/test/server/server_test.cc index 55c787d2266a..f8fae00d7109 100644 --- a/test/server/server_test.cc +++ b/test/server/server_test.cc @@ -85,10 +85,12 @@ class RunHelperTest : public testing::Test { RunHelperTest() { InSequence s; +#ifndef WIN32 sigterm_ = new Event::MockSignalEvent(&dispatcher_); sigint_ = new Event::MockSignalEvent(&dispatcher_); sigusr1_ = new Event::MockSignalEvent(&dispatcher_); sighup_ = new Event::MockSignalEvent(&dispatcher_); +#endif EXPECT_CALL(overload_manager_, start()); EXPECT_CALL(cm_, setInitializedCb(_)).WillOnce(SaveArg<0>(&cm_init_callback_)); ON_CALL(server_, shutdown()).WillByDefault(Assign(&shutdown_, true)); @@ -108,10 +110,12 @@ class RunHelperTest : public testing::Test { ReadyWatcher start_workers_; std::unique_ptr helper_; std::function cm_init_callback_; +#ifndef WIN32 Event::MockSignalEvent* sigterm_; Event::MockSignalEvent* sigint_; Event::MockSignalEvent* sigusr1_; Event::MockSignalEvent* sighup_; +#endif bool shutdown_ = false; }; @@ -120,13 +124,18 @@ TEST_F(RunHelperTest, Normal) { cm_init_callback_(); } +// no signals on Windows +#ifndef WIN32 TEST_F(RunHelperTest, ShutdownBeforeCmInitialize) { EXPECT_CALL(start_workers_, ready()).Times(0); sigterm_->callback_(); EXPECT_CALL(server_, isShutdown()).WillOnce(Return(shutdown_)); cm_init_callback_(); } +#endif +// no signals on Windows +#ifndef WIN32 TEST_F(RunHelperTest, ShutdownBeforeInitManagerInit) { EXPECT_CALL(start_workers_, ready()).Times(0); Init::ExpectableTargetImpl target; @@ -137,6 +146,7 @@ TEST_F(RunHelperTest, ShutdownBeforeInitManagerInit) { EXPECT_CALL(server_, isShutdown()).WillOnce(Return(shutdown_)); target.ready(); } +#endif class InitializingInitManager : public Init::ManagerImpl { public: diff --git a/test/tools/router_check/test/BUILD b/test/tools/router_check/test/BUILD index 9ed7a3c3fe6e..4e8e7f8885b8 100644 --- a/test/tools/router_check/test/BUILD +++ b/test/tools/router_check/test/BUILD @@ -15,6 +15,8 @@ envoy_sh_test( ":configs", "//test/tools/router_check:router_check_tool", ], + # TODO: This script invocation does not work on Windows, see: https://github.com/bazelbuild/bazel/issues/10959 + tags = ["fails_on_windows"], ) filegroup( diff --git a/test/tools/type_whisperer/BUILD b/test/tools/type_whisperer/BUILD index 281d75874102..5d2787128058 100644 --- a/test/tools/type_whisperer/BUILD +++ b/test/tools/type_whisperer/BUILD @@ -7,5 +7,7 @@ envoy_package() envoy_cc_test( name = "api_type_db_test", srcs = ["api_type_db_test.cc"], + # MSVC does not allow strings over a certain length, see error C2026 + tags = ["skip_on_windows"], deps = ["//tools/type_whisperer:api_type_db_lib"], ) diff --git a/windows/.bazelrc b/windows/.bazelrc index 42e10cc7453e..9556c3e9f313 100644 --- a/windows/.bazelrc +++ b/windows/.bazelrc @@ -43,7 +43,7 @@ build:clang-cl --copt="-Wno-macro-redefined" build:clang-cl --copt="-Wno-builtin-macro-redefined" build:clang-cl --action_env=USE_CLANG_CL=1 -build --experimental_enable_runfiles +build --enable_runfiles=yes build --features=compiler_param_file build --features=fully_static_link build --features=static_link_msvcrt From 519f71272d3b86438c9a6891aa15355437f1f429 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Thu, 26 Mar 2020 13:51:26 -0400 Subject: [PATCH 05/42] Fix formatting and clean up test main invocation of WSAStartup Signed-off-by: William A Rowe Jr Co-authored-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia Co-authored-by: Sunjay Bhatia --- source/exe/win32/platform_impl.cc | 3 +-- test/exe/BUILD | 2 +- test/main.cc | 9 +-------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/source/exe/win32/platform_impl.cc b/source/exe/win32/platform_impl.cc index 5db56c722521..b6791d703c3a 100644 --- a/source/exe/win32/platform_impl.cc +++ b/source/exe/win32/platform_impl.cc @@ -11,8 +11,7 @@ PlatformImpl::PlatformImpl() file_system_(std::make_unique()) { const WORD wVersionRequested = MAKEWORD(2, 2); WSADATA wsaData; - const int rc = ::WSAStartup(wVersionRequested, &wsaData); - RELEASE_ASSERT(rc == 0, "WSAStartup failed with error"); + RELEASE_ASSERT(WSAStartup(wVersionRequested, &wsaData) == 0, "WSAStartup failed with error"); } PlatformImpl::~PlatformImpl() { ::WSACleanup(); } diff --git a/test/exe/BUILD b/test/exe/BUILD index b17fabe48075..7540aafa7525 100644 --- a/test/exe/BUILD +++ b/test/exe/BUILD @@ -43,8 +43,8 @@ envoy_sh_test( data = ["//source/exe:envoy-static"], # Since VS2015 or even earlier, link.exe defaults to PIE generation tags = [ - "skip_on_windows", "nofips", + "skip_on_windows", ], ) diff --git a/test/main.cc b/test/main.cc index ae438952ea4f..06f87f6239e1 100644 --- a/test/main.cc +++ b/test/main.cc @@ -34,16 +34,9 @@ int main(int argc, char** argv) { WSADATA wsaData; int err; - /* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */ wVersionRequested = MAKEWORD(2, 2); - err = WSAStartup(wVersionRequested, &wsaData); - if (err != 0) { - /* Tell the user that we could not find a usable */ - /* Winsock DLL. */ - printf("WSAStartup failed with error: %d\n", err); - return 1; - } + RELEASE_ASSERT(WSAStartup(wVersionRequested, &wsaData) == 0, ""); #endif #ifndef __APPLE__ From 5dac9d5e2872115f2287a37621d2c3a082b27bea Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Thu, 26 Mar 2020 14:56:18 -0400 Subject: [PATCH 06/42] Windows CI steps ensures correct link.exe etc. on the PATH Also make creation of TMPDIR symlink idempotent Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr Co-authored-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr --- ci/windows_ci_steps.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index e10c56e5ee1a..b5d92d7133d8 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -20,7 +20,12 @@ df -h # rules_foreign_cc does not currently use bazel output/temp directories by default, it uses mktemp # which respects the value of the TMPDIR environment variable drive="$(readlink -f $TMPDIR | cut -d '/' -f2)" -/c/windows/system32/cmd.exe "/c mklink /d $drive:\\$drive $drive:\\" +/c/windows/system32/cmd.exe "/c if not exist $drive:\\$drive mklink /d $drive:\\$drive $drive:\\" + +# Set up PATH to ensure executables from installed software and system to not conflict with those +# from MSVC (e.g. link.exe from mingw64 or find.exe from C:\windows\system32 do not conflict with +# desired executables with those same names). +export PATH=$(echo $PATH | sed "s#::#:#g;s#:/usr/bin:#:#g;s#:/mingw64/bin:#:#ig;s/$/:\/mingw64\/bin/;s#:/c/windows/system32:#:#ig;s/$/:\/usr\/bin:\/c\/windows\/system32/;") BAZEL_STARTUP_OPTIONS="--noworkspace_rc --bazelrc=windows/.bazelrc --output_base=c:/_eb" BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failures \ From b24bef28081c349df8228de8df90bd436c7ca37c Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Thu, 26 Mar 2020 16:13:19 -0400 Subject: [PATCH 07/42] Prepend VS tools to the path Also adjust path find/replace to be more exact Signed-off-by: William A Rowe Jr Co-authored-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia Co-authored-by: Sunjay Bhatia --- .azure-pipelines/windows.yml | 2 ++ ci/windows_ci_steps.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/windows.yml b/.azure-pipelines/windows.yml index 232b739acf8e..8c1b0c848a1d 100644 --- a/.azure-pipelines/windows.yml +++ b/.azure-pipelines/windows.yml @@ -13,9 +13,11 @@ jobs: - powershell: | .\ci\windows_ci_setup.ps1 Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR" + Write-Host "##vso[task.prependpath]$env:VC_TOOLS_BIN_X64" displayName: "Install dependencies" env: TOOLS_BIN_DIR: $(Pipeline.Workspace)\bin + VC_TOOLS_BIN_X64: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VCTools\\MSVC\\14.24.28314\\bin\\HostX64\\x64" - bash: ci/windows_ci_steps.sh displayName: "Run Windows CI" diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index b5d92d7133d8..992c59f19cdb 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -25,7 +25,7 @@ drive="$(readlink -f $TMPDIR | cut -d '/' -f2)" # Set up PATH to ensure executables from installed software and system to not conflict with those # from MSVC (e.g. link.exe from mingw64 or find.exe from C:\windows\system32 do not conflict with # desired executables with those same names). -export PATH=$(echo $PATH | sed "s#::#:#g;s#:/usr/bin:#:#g;s#:/mingw64/bin:#:#ig;s/$/:\/mingw64\/bin/;s#:/c/windows/system32:#:#ig;s/$/:\/usr\/bin:\/c\/windows\/system32/;") +export PATH=$(echo :$PATH: | sed "s#::#:#g;s#:/usr/bin:#:#g;s#:/mingw64/bin:#:#ig;s#:/c/windows/system32:#:#ig;s/$/\/usr\/bin:\/mingw64\/bin:\/c\/windows\/system32/;s/^://") BAZEL_STARTUP_OPTIONS="--noworkspace_rc --bazelrc=windows/.bazelrc --output_base=c:/_eb" BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failures \ From 046849dd06d122ec404d2258791cc1d63d03fcd9 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Fri, 27 Mar 2020 12:57:38 -0400 Subject: [PATCH 08/42] Add a proper msys2 toolchain as recommended by Bazel Will stop using git's somewhat ill-behaved bash.exe. First in the path is the flavor that the Azure environment will elect for each bash step. Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- .azure-pipelines/windows.yml | 6 ++++-- ci/windows_ci_setup.ps1 | 21 ++++++++++++++++++--- ci/windows_ci_steps.sh | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.azure-pipelines/windows.yml b/.azure-pipelines/windows.yml index 8c1b0c848a1d..f8dbf8369772 100644 --- a/.azure-pipelines/windows.yml +++ b/.azure-pipelines/windows.yml @@ -12,11 +12,13 @@ jobs: steps: - powershell: | .\ci\windows_ci_setup.ps1 + Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR\bin;$env:TOOLS_BIN_DIR\usr\bin" + Write-Host "##vso[task.prependpath]$env:VC_TOOLS_BIN_X64;$env:VC_CMAKE_PATH\CMake\bin;$env:VC_CMAKE_PATH\Ninja" Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR" - Write-Host "##vso[task.prependpath]$env:VC_TOOLS_BIN_X64" displayName: "Install dependencies" env: TOOLS_BIN_DIR: $(Pipeline.Workspace)\bin + VC_CMAKE_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake" VC_TOOLS_BIN_X64: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VCTools\\MSVC\\14.24.28314\\bin\\HostX64\\x64" - bash: ci/windows_ci_steps.sh @@ -24,4 +26,4 @@ jobs: env: TMPDIR: $(Agent.TempDirectory) BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC" - BAZEL_SH: "C:\\Program Files\\Git\\bin\\bash.exe" + BAZEL_SH: $(Pipeline.Workspace)/bin/bin/bash.exe diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index c0709a75cadc..374a0e9befa1 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -26,10 +26,25 @@ function Checksum mkdir "$env:TOOLS_BIN_DIR" $wc = New-Object System.Net.WebClient $wc.DownloadFile("https://github.com/bazelbuild/bazelisk/releases/download/v1.0/bazelisk-windows-amd64.exe", "$env:TOOLS_BIN_DIR\bazel.exe") -$wc.DownloadFile("https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip", "$env:TOOLS_BIN_DIR\ninja-win.zip") +# See https://sourceforge.net/projects/msys2/files/Base/x86_64/ for msys2 download source +$wc.DownloadFile("http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20190524.tar.xz", "$env:TEMP\msys2.tar.xz") +# VSBuildTools/VS2019 already provides ninja 1.8.2 +# $wc.DownloadFile("https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip", "$env:TOOLS_BIN_DIR\ninja-win.zip") # Check the SHA256 file hash of each downloaded file. Checksum $env:TOOLS_BIN_DIR\bazel.exe 96395ee9e3fb9f4499fcaffa8a94dd72b0748f495f366bc4be44dbf09d6827fc SHA256 -Checksum $env:TOOLS_BIN_DIR\ninja-win.zip 2d70010633ddaacc3af4ffbd21e22fae90d158674a09e132e06424ba3ab036e9 SHA256 +Checksum $env:TOOLS_BIN_DIR\msys2.tar.xz 168e156fa9f00d90a8445676c023c63be6e82f71487f4e2688ab5cb13b345383 SHA256 +# Checksum $env:TOOLS_BIN_DIR\ninja-win.zip 2d70010633ddaacc3af4ffbd21e22fae90d158674a09e132e06424ba3ab036e9 SHA256 -Unzip "$env:TOOLS_BIN_DIR\ninja-win.zip" "$env:TOOLS_BIN_DIR" +# Unzip "$env:TOOLS_BIN_DIR\ninja-win.zip" "$env:TOOLS_BIN_DIR" + +# Unpack and install msys2 and required packages +$tarpath="$env:ProgramFiles\Git\usr\bin\tar.exe" +&"$tarpath" -xJf "$env:TEMP\msys2.tar.xz" -C "$env:TOOLS_BIN_DIR" +$env:PATH = "$env:TOOLS_BIN_DIR\mingw64\bin;$env:TOOLS_BIN_DIR\usr\bin;$env:Path" +bash.exe -c "pacman-key --init 2>&1" +bash.exe -c "pacman-key --populate msys2 2>&1" +pacman.exe -Syyuu --noconfirm +pacman.exe -Syuu --noconfirm +pacman.exe -S --noconfirm --needed diffutils patch unzip zip +pacman.exe -Scc --noconfirm diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index 992c59f19cdb..79d1f4d5bd33 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -25,7 +25,7 @@ drive="$(readlink -f $TMPDIR | cut -d '/' -f2)" # Set up PATH to ensure executables from installed software and system to not conflict with those # from MSVC (e.g. link.exe from mingw64 or find.exe from C:\windows\system32 do not conflict with # desired executables with those same names). -export PATH=$(echo :$PATH: | sed "s#::#:#g;s#:/usr/bin:#:#g;s#:/mingw64/bin:#:#ig;s#:/c/windows/system32:#:#ig;s/$/\/usr\/bin:\/mingw64\/bin:\/c\/windows\/system32/;s/^://") +# export PATH=$(echo :$PATH: | sed "s#::#:#g;s#:/usr/bin:#:#g;s#:/mingw64/bin:#:#ig;s#:/c/windows/system32:#:#ig;s/$/\/usr\/bin:\/mingw64\/bin:\/c\/windows\/system32/;s/^://") BAZEL_STARTUP_OPTIONS="--noworkspace_rc --bazelrc=windows/.bazelrc --output_base=c:/_eb" BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failures \ From 210ee5df7261d78ce5e220b479cd78400e532131 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Fri, 27 Mar 2020 13:19:02 -0400 Subject: [PATCH 09/42] Fix download path for msys2.tar.xz Add comment explaining why we update the PATH temporarily Signed-off-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia --- ci/windows_ci_setup.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index 374a0e9befa1..db6086d30108 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -33,7 +33,7 @@ $wc.DownloadFile("http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-2019052 # Check the SHA256 file hash of each downloaded file. Checksum $env:TOOLS_BIN_DIR\bazel.exe 96395ee9e3fb9f4499fcaffa8a94dd72b0748f495f366bc4be44dbf09d6827fc SHA256 -Checksum $env:TOOLS_BIN_DIR\msys2.tar.xz 168e156fa9f00d90a8445676c023c63be6e82f71487f4e2688ab5cb13b345383 SHA256 +Checksum $env:TEMP\msys2.tar.xz 168e156fa9f00d90a8445676c023c63be6e82f71487f4e2688ab5cb13b345383 SHA256 # Checksum $env:TOOLS_BIN_DIR\ninja-win.zip 2d70010633ddaacc3af4ffbd21e22fae90d158674a09e132e06424ba3ab036e9 SHA256 # Unzip "$env:TOOLS_BIN_DIR\ninja-win.zip" "$env:TOOLS_BIN_DIR" @@ -41,6 +41,7 @@ Checksum $env:TOOLS_BIN_DIR\msys2.tar.xz 168e156fa9f00d90a8445676c023c63be6e82f7 # Unpack and install msys2 and required packages $tarpath="$env:ProgramFiles\Git\usr\bin\tar.exe" &"$tarpath" -xJf "$env:TEMP\msys2.tar.xz" -C "$env:TOOLS_BIN_DIR" +# Add utils to the path for msys2 setup $env:PATH = "$env:TOOLS_BIN_DIR\mingw64\bin;$env:TOOLS_BIN_DIR\usr\bin;$env:Path" bash.exe -c "pacman-key --init 2>&1" bash.exe -c "pacman-key --populate msys2 2>&1" From 9e0ec463a71f5c0bd295333172841b0c0439e995 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Fri, 27 Mar 2020 13:27:35 -0400 Subject: [PATCH 10/42] Fix tar path so it doesnt try to connect to a remote when tar sees 'C:' it assumes a uri Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- ci/windows_ci_setup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index db6086d30108..c9d1754b99a3 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -40,7 +40,7 @@ Checksum $env:TEMP\msys2.tar.xz 168e156fa9f00d90a8445676c023c63be6e82f71487f4e26 # Unpack and install msys2 and required packages $tarpath="$env:ProgramFiles\Git\usr\bin\tar.exe" -&"$tarpath" -xJf "$env:TEMP\msys2.tar.xz" -C "$env:TOOLS_BIN_DIR" +&"$tarpath" -xJf "/$env:TEMP/msys2.tar.xz".replace(':', '') -C "$env:TOOLS_BIN_DIR" # Add utils to the path for msys2 setup $env:PATH = "$env:TOOLS_BIN_DIR\mingw64\bin;$env:TOOLS_BIN_DIR\usr\bin;$env:Path" bash.exe -c "pacman-key --init 2>&1" From 6b8711004be5fd08b6ff22b424ca6b6a3222fac2 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Fri, 27 Mar 2020 13:32:49 -0400 Subject: [PATCH 11/42] Adjust tar change directory path Signed-off-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia --- ci/windows_ci_setup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index c9d1754b99a3..846501d78f88 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -40,7 +40,7 @@ Checksum $env:TEMP\msys2.tar.xz 168e156fa9f00d90a8445676c023c63be6e82f71487f4e26 # Unpack and install msys2 and required packages $tarpath="$env:ProgramFiles\Git\usr\bin\tar.exe" -&"$tarpath" -xJf "/$env:TEMP/msys2.tar.xz".replace(':', '') -C "$env:TOOLS_BIN_DIR" +&"$tarpath" -Jxf "/$env:TEMP/msys2.tar.xz".replace(':', '') -C "/$env:TOOLS_BIN_DIR".replace(':', '') # Add utils to the path for msys2 setup $env:PATH = "$env:TOOLS_BIN_DIR\mingw64\bin;$env:TOOLS_BIN_DIR\usr\bin;$env:Path" bash.exe -c "pacman-key --init 2>&1" From 5c0ce5f0edeefada02859cc8b71968257302a8bb Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Fri, 27 Mar 2020 13:48:05 -0400 Subject: [PATCH 12/42] Use unix style paths with tar only Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- ci/windows_ci_setup.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index 846501d78f88..59155567794a 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -40,7 +40,9 @@ Checksum $env:TEMP\msys2.tar.xz 168e156fa9f00d90a8445676c023c63be6e82f71487f4e26 # Unpack and install msys2 and required packages $tarpath="$env:ProgramFiles\Git\usr\bin\tar.exe" -&"$tarpath" -Jxf "/$env:TEMP/msys2.tar.xz".replace(':', '') -C "/$env:TOOLS_BIN_DIR".replace(':', '') +$msys2TarPathClean = "/$env:TEMP/msys2.tar.xz".replace(':', '').replace('\', '/') +$outDirClean = "/$env:TOOLS_BIN_DIR".replace(':', '').replace('\', '/') +&"$tarpath" -Jxf $msys2TarPathClean -C $outDirClean # Add utils to the path for msys2 setup $env:PATH = "$env:TOOLS_BIN_DIR\mingw64\bin;$env:TOOLS_BIN_DIR\usr\bin;$env:Path" bash.exe -c "pacman-key --init 2>&1" From 12f4d3629840040199624f355385afa6979edf20 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Fri, 27 Mar 2020 13:53:54 -0400 Subject: [PATCH 13/42] msys2 has a subdir named msys64, put that properly on the PATH Signed-off-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia --- .azure-pipelines/windows.yml | 2 +- ci/windows_ci_setup.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/windows.yml b/.azure-pipelines/windows.yml index f8dbf8369772..b1c7bcd8da18 100644 --- a/.azure-pipelines/windows.yml +++ b/.azure-pipelines/windows.yml @@ -12,7 +12,7 @@ jobs: steps: - powershell: | .\ci\windows_ci_setup.ps1 - Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR\bin;$env:TOOLS_BIN_DIR\usr\bin" + Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR\msys64\bin;$env:TOOLS_BIN_DIR\msys64\usr\bin" Write-Host "##vso[task.prependpath]$env:VC_TOOLS_BIN_X64;$env:VC_CMAKE_PATH\CMake\bin;$env:VC_CMAKE_PATH\Ninja" Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR" displayName: "Install dependencies" diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index 59155567794a..9d786b0d6161 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -44,7 +44,7 @@ $msys2TarPathClean = "/$env:TEMP/msys2.tar.xz".replace(':', '').replace('\', '/' $outDirClean = "/$env:TOOLS_BIN_DIR".replace(':', '').replace('\', '/') &"$tarpath" -Jxf $msys2TarPathClean -C $outDirClean # Add utils to the path for msys2 setup -$env:PATH = "$env:TOOLS_BIN_DIR\mingw64\bin;$env:TOOLS_BIN_DIR\usr\bin;$env:Path" +$env:PATH = "$env:TOOLS_BIN_DIR\msys64\usr\bin;$env:TOOLS_BIN_DIR\msys64\mingw64\bin;$env:Path" bash.exe -c "pacman-key --init 2>&1" bash.exe -c "pacman-key --populate msys2 2>&1" pacman.exe -Syyuu --noconfirm From 466c7a075d6a21758cc695787d65e316fc4302c3 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Fri, 27 Mar 2020 14:24:48 -0400 Subject: [PATCH 14/42] Redirect pacman stderr to stout - so the powershell task does not fail on warnings - also replace unzip, zip with compression for a more full suite of tools Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- ci/windows_ci_setup.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index 9d786b0d6161..cbfb3ab2eae7 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -47,7 +47,7 @@ $outDirClean = "/$env:TOOLS_BIN_DIR".replace(':', '').replace('\', '/') $env:PATH = "$env:TOOLS_BIN_DIR\msys64\usr\bin;$env:TOOLS_BIN_DIR\msys64\mingw64\bin;$env:Path" bash.exe -c "pacman-key --init 2>&1" bash.exe -c "pacman-key --populate msys2 2>&1" -pacman.exe -Syyuu --noconfirm -pacman.exe -Syuu --noconfirm -pacman.exe -S --noconfirm --needed diffutils patch unzip zip -pacman.exe -Scc --noconfirm +pacman.exe -Syyuu --noconfirm 2>&1 +pacman.exe -Syuu --noconfirm 2>&1 +pacman.exe -S --noconfirm --needed compression diffutils patch 2>&1 +pacman.exe -Scc --noconfirm 2>&1 From 9b01e892e6df206a7d0f207970b0880554da26e1 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Fri, 27 Mar 2020 14:32:02 -0400 Subject: [PATCH 15/42] Use bash for pacman.exe invocation So we don't have to deal with powershell redirection Signed-off-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia --- ci/windows_ci_setup.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index cbfb3ab2eae7..25726858bda4 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -47,7 +47,7 @@ $outDirClean = "/$env:TOOLS_BIN_DIR".replace(':', '').replace('\', '/') $env:PATH = "$env:TOOLS_BIN_DIR\msys64\usr\bin;$env:TOOLS_BIN_DIR\msys64\mingw64\bin;$env:Path" bash.exe -c "pacman-key --init 2>&1" bash.exe -c "pacman-key --populate msys2 2>&1" -pacman.exe -Syyuu --noconfirm 2>&1 -pacman.exe -Syuu --noconfirm 2>&1 -pacman.exe -S --noconfirm --needed compression diffutils patch 2>&1 -pacman.exe -Scc --noconfirm 2>&1 +bash.exe -c "pacman.exe -Syyuu --noconfirm 2>&1" +bash.exe -c "pacman.exe -Syuu --noconfirm 2>&1" +bash.exe -c "pacman.exe -S --noconfirm --needed compression diffutils patch 2>&1" +bash.exe -c "pacman.exe -Scc --noconfirm 2>&1" From 4e1141afddfcc08b553e0be09e13be0cd015412a Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Fri, 27 Mar 2020 14:41:52 -0400 Subject: [PATCH 16/42] change cmd.exe invocation the previous syntax was working with git bash, we're using msys2 bash so potentially there are differences, use the more "correct" looking invocation Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- ci/windows_ci_steps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index 79d1f4d5bd33..e73642f817c4 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -20,7 +20,7 @@ df -h # rules_foreign_cc does not currently use bazel output/temp directories by default, it uses mktemp # which respects the value of the TMPDIR environment variable drive="$(readlink -f $TMPDIR | cut -d '/' -f2)" -/c/windows/system32/cmd.exe "/c if not exist $drive:\\$drive mklink /d $drive:\\$drive $drive:\\" +/c/windows/system32/cmd.exe /c "if not exist $drive:\\$drive mklink /d $drive:\\$drive $drive:\\" # Set up PATH to ensure executables from installed software and system to not conflict with those # from MSVC (e.g. link.exe from mingw64 or find.exe from C:\windows\system32 do not conflict with From 3bbbdd5ee19aa82ef5b07dfbb8672f32a93288f5 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Fri, 27 Mar 2020 14:49:15 -0400 Subject: [PATCH 17/42] Use bash to check existence, cmd.exe is not working Signed-off-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia --- ci/windows_ci_steps.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index e73642f817c4..1cd2711f92a6 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -20,7 +20,9 @@ df -h # rules_foreign_cc does not currently use bazel output/temp directories by default, it uses mktemp # which respects the value of the TMPDIR environment variable drive="$(readlink -f $TMPDIR | cut -d '/' -f2)" -/c/windows/system32/cmd.exe /c "if not exist $drive:\\$drive mklink /d $drive:\\$drive $drive:\\" +if [ ! -e "/$drive/$drive" ]; then + /c/windows/system32/cmd.exe "/c mklink /d $drive:\\$drive $drive:\\" +fi # Set up PATH to ensure executables from installed software and system to not conflict with those # from MSVC (e.g. link.exe from mingw64 or find.exe from C:\windows\system32 do not conflict with From 2a364ad49f88439a18dc93c038ddcc16ecc49df6 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Fri, 27 Mar 2020 14:54:53 -0400 Subject: [PATCH 18/42] See if MSYS2_ARG_CONV_EXCL helps Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- .azure-pipelines/windows.yml | 3 ++- ci/windows_ci_steps.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/windows.yml b/.azure-pipelines/windows.yml index b1c7bcd8da18..795f16932971 100644 --- a/.azure-pipelines/windows.yml +++ b/.azure-pipelines/windows.yml @@ -24,6 +24,7 @@ jobs: - bash: ci/windows_ci_steps.sh displayName: "Run Windows CI" env: - TMPDIR: $(Agent.TempDirectory) BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC" BAZEL_SH: $(Pipeline.Workspace)/bin/bin/bash.exe + MSYS2_ARG_CONV_EXCL: "*" + TMPDIR: $(Agent.TempDirectory) diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index 1cd2711f92a6..ac6fa3b43a0e 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -21,7 +21,7 @@ df -h # which respects the value of the TMPDIR environment variable drive="$(readlink -f $TMPDIR | cut -d '/' -f2)" if [ ! -e "/$drive/$drive" ]; then - /c/windows/system32/cmd.exe "/c mklink /d $drive:\\$drive $drive:\\" + /c/windows/system32/cmd.exe /c "mklink /d $drive:\\$drive $drive:\\" fi # Set up PATH to ensure executables from installed software and system to not conflict with those From 18f63924a231593a3d1da98b64b0c1bc7fe5b3c6 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Fri, 27 Mar 2020 15:03:57 -0400 Subject: [PATCH 19/42] Strip msys64 out of extracted msys2 path Signed-off-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia --- .azure-pipelines/windows.yml | 2 +- ci/windows_ci_setup.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/windows.yml b/.azure-pipelines/windows.yml index 795f16932971..b9064fd5cae5 100644 --- a/.azure-pipelines/windows.yml +++ b/.azure-pipelines/windows.yml @@ -12,7 +12,7 @@ jobs: steps: - powershell: | .\ci\windows_ci_setup.ps1 - Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR\msys64\bin;$env:TOOLS_BIN_DIR\msys64\usr\bin" + Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR\bin;$env:TOOLS_BIN_DIR\usr\bin" Write-Host "##vso[task.prependpath]$env:VC_TOOLS_BIN_X64;$env:VC_CMAKE_PATH\CMake\bin;$env:VC_CMAKE_PATH\Ninja" Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR" displayName: "Install dependencies" diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index 25726858bda4..25ab0d9eee84 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -42,9 +42,9 @@ Checksum $env:TEMP\msys2.tar.xz 168e156fa9f00d90a8445676c023c63be6e82f71487f4e26 $tarpath="$env:ProgramFiles\Git\usr\bin\tar.exe" $msys2TarPathClean = "/$env:TEMP/msys2.tar.xz".replace(':', '').replace('\', '/') $outDirClean = "/$env:TOOLS_BIN_DIR".replace(':', '').replace('\', '/') -&"$tarpath" -Jxf $msys2TarPathClean -C $outDirClean +&"$tarpath" -Jxf $msys2TarPathClean -C $outDirClean --strip-components=1 # Add utils to the path for msys2 setup -$env:PATH = "$env:TOOLS_BIN_DIR\msys64\usr\bin;$env:TOOLS_BIN_DIR\msys64\mingw64\bin;$env:Path" +$env:PATH = "$env:TOOLS_BIN_DIR\usr\bin;$env:TOOLS_BIN_DIR\mingw64\bin;$env:Path" bash.exe -c "pacman-key --init 2>&1" bash.exe -c "pacman-key --populate msys2 2>&1" bash.exe -c "pacman.exe -Syyuu --noconfirm 2>&1" From f79a6945acee7f4577e2e93b99f27d4015d20316 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Fri, 27 Mar 2020 15:13:31 -0400 Subject: [PATCH 20/42] Fix BAZEL_SH path Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- .azure-pipelines/windows.yml | 4 ++-- ci/windows_ci_setup.ps1 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines/windows.yml b/.azure-pipelines/windows.yml index b9064fd5cae5..39c978c844eb 100644 --- a/.azure-pipelines/windows.yml +++ b/.azure-pipelines/windows.yml @@ -12,7 +12,7 @@ jobs: steps: - powershell: | .\ci\windows_ci_setup.ps1 - Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR\bin;$env:TOOLS_BIN_DIR\usr\bin" + Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR\usr\bin" Write-Host "##vso[task.prependpath]$env:VC_TOOLS_BIN_X64;$env:VC_CMAKE_PATH\CMake\bin;$env:VC_CMAKE_PATH\Ninja" Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR" displayName: "Install dependencies" @@ -25,6 +25,6 @@ jobs: displayName: "Run Windows CI" env: BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC" - BAZEL_SH: $(Pipeline.Workspace)/bin/bin/bash.exe + BAZEL_SH: $(Pipeline.Workspace)/bin/usr/bin/bash.exe MSYS2_ARG_CONV_EXCL: "*" TMPDIR: $(Agent.TempDirectory) diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index 25ab0d9eee84..ce43ee8ea804 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -44,7 +44,7 @@ $msys2TarPathClean = "/$env:TEMP/msys2.tar.xz".replace(':', '').replace('\', '/' $outDirClean = "/$env:TOOLS_BIN_DIR".replace(':', '').replace('\', '/') &"$tarpath" -Jxf $msys2TarPathClean -C $outDirClean --strip-components=1 # Add utils to the path for msys2 setup -$env:PATH = "$env:TOOLS_BIN_DIR\usr\bin;$env:TOOLS_BIN_DIR\mingw64\bin;$env:Path" +$env:PATH = "$env:TOOLS_BIN_DIR\usr\bin;$env:TOOLS_BIN_DIR\mingw64\bin;$env:PATH" bash.exe -c "pacman-key --init 2>&1" bash.exe -c "pacman-key --populate msys2 2>&1" bash.exe -c "pacman.exe -Syyuu --noconfirm 2>&1" From 18184be91958354794cb7051cd15a63f3f782694 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Fri, 27 Mar 2020 15:29:01 -0400 Subject: [PATCH 21/42] Fix path typo to find link.exe Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- .azure-pipelines/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/windows.yml b/.azure-pipelines/windows.yml index 39c978c844eb..ad69a7406859 100644 --- a/.azure-pipelines/windows.yml +++ b/.azure-pipelines/windows.yml @@ -19,7 +19,7 @@ jobs: env: TOOLS_BIN_DIR: $(Pipeline.Workspace)\bin VC_CMAKE_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake" - VC_TOOLS_BIN_X64: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VCTools\\MSVC\\14.24.28314\\bin\\HostX64\\x64" + VC_TOOLS_BIN_X64: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64" - bash: ci/windows_ci_steps.sh displayName: "Run Windows CI" From a98a534f2c94ff9a4f45d4f6f62e22f8f561b411 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Fri, 27 Mar 2020 15:37:49 -0400 Subject: [PATCH 22/42] Cleanup unneeded content Cmake+Ninja should be coming from Visual Studio Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- ci/windows_ci_setup.ps1 | 13 ------------- ci/windows_ci_steps.sh | 5 ----- 2 files changed, 18 deletions(-) diff --git a/ci/windows_ci_setup.ps1 b/ci/windows_ci_setup.ps1 index ce43ee8ea804..c39f2c083e22 100644 --- a/ci/windows_ci_setup.ps1 +++ b/ci/windows_ci_setup.ps1 @@ -2,14 +2,6 @@ # The list of installed software can be found at: # https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md -Add-Type -AssemblyName System.IO.Compression.FileSystem -function Unzip -{ - param([string]$zipfile, [string]$outpath) - - [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) -} - function Checksum { param([string]$filepath, [string]$expected, [string]$algorithm) @@ -28,15 +20,10 @@ $wc = New-Object System.Net.WebClient $wc.DownloadFile("https://github.com/bazelbuild/bazelisk/releases/download/v1.0/bazelisk-windows-amd64.exe", "$env:TOOLS_BIN_DIR\bazel.exe") # See https://sourceforge.net/projects/msys2/files/Base/x86_64/ for msys2 download source $wc.DownloadFile("http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20190524.tar.xz", "$env:TEMP\msys2.tar.xz") -# VSBuildTools/VS2019 already provides ninja 1.8.2 -# $wc.DownloadFile("https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip", "$env:TOOLS_BIN_DIR\ninja-win.zip") # Check the SHA256 file hash of each downloaded file. Checksum $env:TOOLS_BIN_DIR\bazel.exe 96395ee9e3fb9f4499fcaffa8a94dd72b0748f495f366bc4be44dbf09d6827fc SHA256 Checksum $env:TEMP\msys2.tar.xz 168e156fa9f00d90a8445676c023c63be6e82f71487f4e2688ab5cb13b345383 SHA256 -# Checksum $env:TOOLS_BIN_DIR\ninja-win.zip 2d70010633ddaacc3af4ffbd21e22fae90d158674a09e132e06424ba3ab036e9 SHA256 - -# Unzip "$env:TOOLS_BIN_DIR\ninja-win.zip" "$env:TOOLS_BIN_DIR" # Unpack and install msys2 and required packages $tarpath="$env:ProgramFiles\Git\usr\bin\tar.exe" diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index ac6fa3b43a0e..0a67a0793734 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -24,11 +24,6 @@ if [ ! -e "/$drive/$drive" ]; then /c/windows/system32/cmd.exe /c "mklink /d $drive:\\$drive $drive:\\" fi -# Set up PATH to ensure executables from installed software and system to not conflict with those -# from MSVC (e.g. link.exe from mingw64 or find.exe from C:\windows\system32 do not conflict with -# desired executables with those same names). -# export PATH=$(echo :$PATH: | sed "s#::#:#g;s#:/usr/bin:#:#g;s#:/mingw64/bin:#:#ig;s#:/c/windows/system32:#:#ig;s/$/\/usr\/bin:\/mingw64\/bin:\/c\/windows\/system32/;s/^://") - BAZEL_STARTUP_OPTIONS="--noworkspace_rc --bazelrc=windows/.bazelrc --output_base=c:/_eb" BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failures \ --test_output=all ${BAZEL_BUILD_EXTRA_OPTIONS} ${BAZEL_EXTRA_TEST_OPTIONS}" From 6cf3c9fe0653573043c2f2eee8bf8a10a33b3d92 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Mon, 30 Mar 2020 17:23:33 -0400 Subject: [PATCH 23/42] Shrink bazel's java heap as suggested by Lizan Signed-off-by: William A Rowe Jr --- windows/.bazelrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/windows/.bazelrc b/windows/.bazelrc index 9556c3e9f313..f477bc098f30 100644 --- a/windows/.bazelrc +++ b/windows/.bazelrc @@ -4,7 +4,8 @@ build --action_env=PATH build --action_env=TMPDIR # see top-level .bazelrc for explanation -startup --host_jvm_args=-Xmx2g +# Smaller on windows (512k vs 2g) due to fewer parallel built tasks +startup --host_jvm_args=-Xmx512m build --define signal_trace=disabled build --define hot_restart=disabled From b587f562b73cd12a42607844ce97c9b01a6e5907 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Tue, 31 Mar 2020 10:47:16 -0400 Subject: [PATCH 24/42] Add back our changes to the windows pipeline They were removed by the recent master changes that squashed the pipelines into one file Co-authored-by: William A Rowe Jr Signed-off-by: William A Rowe Jr Co-authored-by: Sunjay Bhatia Signed-off-by: Sunjay Bhatia --- .azure-pipelines/pipelines.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/pipelines.yml b/.azure-pipelines/pipelines.yml index 350b4f8671c9..72058732678a 100644 --- a/.azure-pipelines/pipelines.yml +++ b/.azure-pipelines/pipelines.yml @@ -131,14 +131,19 @@ jobs: steps: - powershell: | .\ci\windows_ci_setup.ps1 + Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR\usr\bin" + Write-Host "##vso[task.prependpath]$env:VC_TOOLS_BIN_X64;$env:VC_CMAKE_PATH\CMake\bin;$env:VC_CMAKE_PATH\Ninja" Write-Host "##vso[task.prependpath]$env:TOOLS_BIN_DIR" displayName: "Install dependencies" env: TOOLS_BIN_DIR: $(Pipeline.Workspace)\bin + VC_CMAKE_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake" + VC_TOOLS_BIN_X64: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64" - bash: ci/windows_ci_steps.sh displayName: "Run Windows CI" env: - TMPDIR: $(Agent.TempDirectory) BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC" - BAZEL_SH: "C:\\Program Files\\Git\\bin\\bash.exe" + BAZEL_SH: $(Pipeline.Workspace)/bin/usr/bin/bash.exe + MSYS2_ARG_CONV_EXCL: "*" + TMPDIR: $(Agent.TempDirectory) From 94ca13d4ec7c3b6d48429ab9a492d2967f4a2a17 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Thu, 2 Apr 2020 09:57:08 -0400 Subject: [PATCH 25/42] Disable building tests for now We will reenable once we have a solution for faster builds in CI but we would like to get this branch/code out for contributors to consume Co-authored-by: William A Rowe Jr Signed-off-by: William A Rowe Jr Co-authored-by: Sunjay Bhatia Signed-off-by: Sunjay Bhatia --- ci/windows_ci_steps.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index 0a67a0793734..6e042b76322a 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -33,8 +33,10 @@ BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failur bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //source/exe:envoy-static --build_tag_filters=-skip_on_windows +# TODO(sunjayBhatia, wrowe): We are disabling building/running tests for now as the AZP pipelines +# workers do not provide enough resources for us to produce fast enouge or reliable enough builds. # Test compilation of known MSVC-compatible test sources -bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only +# bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only # Test invocations of known-working tests on Windows # bazel ${BAZEL_STARTUP_OPTIONS} test ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows,-fails_on_windows --build_tests_only --test_summary=terse --test_output=errors From e3e5db085589b38d7d7ec8dc5140acef4a67fc93 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Tue, 7 Apr 2020 15:00:25 -0400 Subject: [PATCH 26/42] Bump VC version Co-authored-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- .azure-pipelines/pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/pipelines.yml b/.azure-pipelines/pipelines.yml index 24ecb6b209b4..24edbda1340b 100644 --- a/.azure-pipelines/pipelines.yml +++ b/.azure-pipelines/pipelines.yml @@ -139,7 +139,7 @@ jobs: env: TOOLS_BIN_DIR: $(Pipeline.Workspace)\bin VC_CMAKE_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake" - VC_TOOLS_BIN_X64: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64" + VC_TOOLS_BIN_X64: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX64\\x64" - bash: ci/windows_ci_steps.sh displayName: "Run Windows CI" From ceb05573947072681590b121e7428aec5e57d63c Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Wed, 8 Apr 2020 09:54:43 -0400 Subject: [PATCH 27/42] See if recent change to bazel memory usage is enough to let tests compile Co-authored-by: Sunjay Bhatia Signed-off-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Signed-off-by: William A Rowe Jr --- ci/windows_ci_steps.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index 6e042b76322a..0a67a0793734 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -33,10 +33,8 @@ BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failur bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //source/exe:envoy-static --build_tag_filters=-skip_on_windows -# TODO(sunjayBhatia, wrowe): We are disabling building/running tests for now as the AZP pipelines -# workers do not provide enough resources for us to produce fast enouge or reliable enough builds. # Test compilation of known MSVC-compatible test sources -# bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only +bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only # Test invocations of known-working tests on Windows # bazel ${BAZEL_STARTUP_OPTIONS} test ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows,-fails_on_windows --build_tests_only --test_summary=terse --test_output=errors From d854b90f9f0ecf90bdf4bcb4794c139db2244b62 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Wed, 8 Apr 2020 14:52:43 -0400 Subject: [PATCH 28/42] Revert "See if recent change to bazel memory usage is enough to let tests compile" This reverts commit ceb05573947072681590b121e7428aec5e57d63c. Signed-off-by: William A Rowe Jr --- ci/windows_ci_steps.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index 0a67a0793734..6e042b76322a 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -33,8 +33,10 @@ BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failur bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //source/exe:envoy-static --build_tag_filters=-skip_on_windows +# TODO(sunjayBhatia, wrowe): We are disabling building/running tests for now as the AZP pipelines +# workers do not provide enough resources for us to produce fast enouge or reliable enough builds. # Test compilation of known MSVC-compatible test sources -bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only +# bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only # Test invocations of known-working tests on Windows # bazel ${BAZEL_STARTUP_OPTIONS} test ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows,-fails_on_windows --build_tests_only --test_summary=terse --test_output=errors From 06f1d0c0e5af034648aeda8a590bc29bb6941bbe Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Thu, 9 Apr 2020 10:22:20 -0400 Subject: [PATCH 29/42] Merge windows into unified workspace .bazelrc - Drop a now-unused setup file (see ci/ instead) Co-authored-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- .bazelrc | 43 ++++++++++++++++++++++- ci/build_setup.ps1 | 2 +- ci/windows_ci_steps.sh | 2 +- windows/.bazelrc | 50 -------------------------- windows/setup/workstation_setup.ps1 | 54 ----------------------------- 5 files changed, 44 insertions(+), 107 deletions(-) delete mode 100644 windows/.bazelrc delete mode 100644 windows/setup/workstation_setup.ps1 diff --git a/.bazelrc b/.bazelrc index 648beb564106..93c39cead1dc 100644 --- a/.bazelrc +++ b/.bazelrc @@ -10,7 +10,7 @@ # Startup options cannot be selected via config. startup --host_jvm_args=-Xmx2g -build --workspace_status_command=bazel/get_workspace_status +build --workspace_status_command="bash bazel/get_workspace_status" build --experimental_local_memory_estimate build --experimental_strict_action_env=true build --host_force_python=PY3 @@ -205,5 +205,46 @@ build:compdb --strip=always build:compdb --build_tag_filters=-nocompdb build:compdb --define=ENVOY_CONFIG_COMPILATION_DATABASE=1 +# Windows build quirks +build:windows --action_env=TMPDIR +build:windows --define signal_trace=disabled +build:windows --define hot_restart=disabled +build:windows --define tcmalloc=disabled +build:windows --define manual_stamp=manual_stamp + +# Should not be required after upstream fix to bazel, +# and already a no-op to linux/macos builds +# see issue https://github.com/bazelbuild/rules_foreign_cc/issues/301 +build:windows --copt="-DCARES_STATICLIB" +build:windows --copt="-DNGHTTP2_STATICLIB" +build:windows --copt="-DCURL_STATICLIB" + +# Required to work around build defects on Windows MSVC cl +# Unguarded gcc pragmas in quiche are not recognized by MSVC +build:msvc-cl --copt="/wd4068" +# Allows 'nodiscard' function return values to be discarded +build:msvc-cl --copt="/wd4834" +# Allows inline functions to be undefined +build:msvc-cl --copt="/wd4506" +build:msvc-cl --copt="-D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING" + +# Required to work around Windows clang-cl build defects +# Ignore conflicting definitions of _WIN32_WINNT +# Overriding __TIME__ etc is problematic (and is actually an invalid no-op) +build:clang-cl --copt="-Wno-macro-redefined" +build:clang-cl --copt="-Wno-builtin-macro-redefined" +build:clang-cl --action_env=USE_CLANG_CL=1 + +# Defaults to 'auto' - Off for windows, so override to linux behavior +build:windows --enable_runfiles=yes + +# This should become adopted by bazel as the default +build:windows --features=compiler_param_file + +# These options attempt to force a monolithic binary including the CRT +build:windows --features=fully_static_link +build:windows --features=static_link_msvcrt +build:windows --dynamic_mode=off + try-import %workspace%/clang.bazelrc try-import %workspace%/user.bazelrc diff --git a/ci/build_setup.ps1 b/ci/build_setup.ps1 index b9768397f604..9d64fff8f1ca 100755 --- a/ci/build_setup.ps1 +++ b/ci/build_setup.ps1 @@ -17,5 +17,5 @@ $env:ENVOY_SRCDIR = [System.IO.Path]::GetFullPath("$PSScriptRoot\..") echo "ENVOY_BAZEL_ROOT: $env:ENVOY_BAZEL_ROOT" echo "ENVOY_SRCDIR: $env:ENVOY_SRCDIR" -$env:BAZEL_BASE_OPTIONS="--noworkspace_rc --output_base=$env:ENVOY_BAZEL_ROOT --bazelrc=$env:ENVOY_SRCDIR\windows\.bazelrc" +$env:BAZEL_BASE_OPTIONS="--output_base=$env:ENVOY_BAZEL_ROOT" $env:BAZEL_BUILD_OPTIONS="--config=msvc-cl --features=compiler_param_file --strategy=Genrule=standalone --spawn_strategy=standalone --verbose_failures --jobs=$env:NUM_CPUS --show_task_finish --test_output=all $env:BAZEL_BUILD_EXTRA_OPTIONS $env:BAZEL_EXTRA_TEST_OPTIONS" diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index 6e042b76322a..702e5b0a2eda 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -24,7 +24,7 @@ if [ ! -e "/$drive/$drive" ]; then /c/windows/system32/cmd.exe /c "mklink /d $drive:\\$drive $drive:\\" fi -BAZEL_STARTUP_OPTIONS="--noworkspace_rc --bazelrc=windows/.bazelrc --output_base=c:/_eb" +BAZEL_STARTUP_OPTIONS="--output_base=c:/_eb" BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failures \ --test_output=all ${BAZEL_BUILD_EXTRA_OPTIONS} ${BAZEL_EXTRA_TEST_OPTIONS}" diff --git a/windows/.bazelrc b/windows/.bazelrc deleted file mode 100644 index bdc3da0b31f5..000000000000 --- a/windows/.bazelrc +++ /dev/null @@ -1,50 +0,0 @@ -# Windows/Envoy specific Bazel build/test options. - -build --action_env=PATH -build --action_env=TMPDIR - -build --experimental_local_memory_estimate - -build --define signal_trace=disabled -build --define hot_restart=disabled -build --define tcmalloc=disabled -build --define manual_stamp=manual_stamp - -build --workspace_status_command="bash bazel/get_workspace_status" -build --host_javabase=@bazel_tools//tools/jdk:remote_jdk11 -build --javabase=@bazel_tools//tools/jdk:remote_jdk11 -build --enable_platform_specific_config - -# Experimental: We already have absl in the build, define absl=1 -# to tell googletest to use absl for backtrace (this appears to be -# broken on msvc-cl dbg builds) -build --define absl=1 - -# Should not be required after upstream fix, see issue; -# https://github.com/bazelbuild/rules_foreign_cc/issues/301 -build --copt="-DCARES_STATICLIB" -build --copt="-DNGHTTP2_STATICLIB" -build --copt="-DCURL_STATICLIB" - -# Required to work around quiche build defect -# Unguarded gcc pragmas are not recognized by MSVC -build:msvc-cl --copt="/wd4068" -# Allows 'nodiscard' function return values to be discarded -build:msvc-cl --copt="/wd4834" -# Allows inline functions to be undefined -build:msvc-cl --copt="/wd4506" -build:msvc-cl --copt="-D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING" - -# Required to work around clang build defects -# Conflicting definitions of _WIN32_WINNT -# Overriding __TIME__ etc is problematic -build:clang-cl --copt="-Wno-macro-redefined" -build:clang-cl --copt="-Wno-builtin-macro-redefined" -build:clang-cl --action_env=USE_CLANG_CL=1 - -build --enable_runfiles=yes -build --features=compiler_param_file -build --features=fully_static_link -build --features=static_link_msvcrt -build --dynamic_mode=off - diff --git a/windows/setup/workstation_setup.ps1 b/windows/setup/workstation_setup.ps1 deleted file mode 100644 index bf253519602e..000000000000 --- a/windows/setup/workstation_setup.ps1 +++ /dev/null @@ -1,54 +0,0 @@ -$ErrorActionPreference = "Stop"; -$ProgressPreference="SilentlyContinue" - -trap { $host.SetShouldExit(1) } - -Start-BitsTransfer "https://aka.ms/vs/15/release/vs_buildtools.exe" "$env:TEMP\vs_buildtools.exe" - -# Install VS Build Tools in a directory without spaces to work around: https://github.com/bazelbuild/bazel/issues/4496 -# otherwise none of the go code will build (c++ is fine) - -$vsInstallDir="c:\VSBuildTools\2017" -echo "Installing VS Build Tools..." -cmd.exe /s /c "$env:TEMP\vs_buildtools.exe --installPath $vsInstallDir --passive --wait --norestart --nocache --add Microsoft.VisualStudio.Component.VC.CoreBuildTools --add Microsoft.VisualStudio.Component.VC.Redist.14.Latest --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.Windows10SDK.17134" - -if ($LASTEXITCODE -ne 0) { - echo "VS Build Tools install failed: $LASTEXITCODE" - exit $LASTEXITCODE -} -Remove-Item "$env:TEMP\vs_buildtools.exe" -echo "Done" - -Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - -choco install make bazel cmake ninja git -y -if ($LASTEXITCODE -ne 0) { - echo "choco install failed: $LASTEXITCODE" - exit $LASTEXITCODE -} - -$envoyBazelRootDir = "c:\_eb" - -$env:ENVOY_BAZEL_ROOT=$envoyBazelRootDir -setx ENVOY_BAZEL_ROOT $envoyBazelRootDir > $nul -if ($LASTEXITCODE -ne 0) { - exit $LASTEXITCODE -} - -$env:PATH ="$env:PATH;c:\tools\msys64\usr\bin;c:\make\bin;c:\Program Files\CMake\bin;C:\Python27;c:\programdata\chocolatey\bin;C:\Program Files\Git\bin" -setx PATH $env:PATH > $nul -if ($LASTEXITCODE -ne 0) { - exit $LASTEXITCODE -} - -$env:BAZEL_VC="$vsInstallDir\VC" -setx BAZEL_VC $env:BAZEL_VC > $nul -if ($LASTEXITCODE -ne 0) { - exit $LASTEXITCODE -} - -$env:BAZEL_SH="C:\tools\msys64\usr\bin\bash.exe" -setx BAZEL_SH $env:BAZEL_SH > $nul -if ($LASTEXITCODE -ne 0) { - exit $LASTEXITCODE -} From 3f51093f76c30c7f97c0e913e7ec32427ec16576 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Thu, 9 Apr 2020 14:33:32 -0400 Subject: [PATCH 30/42] Revert back to correct way of filtering via extension name envoy_all_extensions() returns a list of extension targets, not names Co-authored-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia Signed-off-by: William A Rowe Jr --- test/extensions/extensions_build_system.bzl | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/test/extensions/extensions_build_system.bzl b/test/extensions/extensions_build_system.bzl index 3a944896086f..b92680fced5a 100644 --- a/test/extensions/extensions_build_system.bzl +++ b/test/extensions/extensions_build_system.bzl @@ -1,5 +1,5 @@ load("//bazel:envoy_build_system.bzl", "envoy_benchmark_test", "envoy_cc_benchmark_binary", "envoy_cc_mock", "envoy_cc_test", "envoy_cc_test_binary", "envoy_cc_test_library") -load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("@envoy_build_config//:extensions_build_config.bzl", "EXTENSIONS") # All extension tests should use this version of envoy_cc_test(). It allows compiling out # tests for extensions that the user does not wish to include in their build. @@ -8,46 +8,52 @@ def envoy_extension_cc_test( name, extension_name, **kwargs): - if not extension_name in envoy_all_extensions(): + if not extension_name in EXTENSIONS: return + envoy_cc_test(name, **kwargs) def envoy_extension_cc_test_library( name, extension_name, **kwargs): - if not extension_name in envoy_all_extensions(): + if not extension_name in EXTENSIONS: return + envoy_cc_test_library(name, **kwargs) def envoy_extension_cc_mock( name, extension_name, **kwargs): - if not extension_name in envoy_all_extensions(): + if not extension_name in EXTENSIONS: return + envoy_cc_mock(name, **kwargs) def envoy_extension_cc_test_binary( name, extension_name, **kwargs): - if not extension_name in envoy_all_extensions(): + if not extension_name in EXTENSIONS: return + envoy_cc_test_binary(name, **kwargs) def envoy_extension_cc_benchmark_binary( name, extension_name, **kwargs): - if not extension_name in envoy_all_extensions(): + if not extension_name in EXTENSIONS: return + envoy_cc_benchmark_binary(name, **kwargs) def envoy_extension_benchmark_test( name, extension_name, **kwargs): - if not extension_name in envoy_all_extensions(): + if not extension_name in EXTENSIONS: return + envoy_benchmark_test(name, **kwargs) From dd87ac51e00d54a034ad8a38d82570001bb191a3 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Tue, 14 Apr 2020 14:34:38 -0400 Subject: [PATCH 31/42] Various Windows compilation fixes - matchers_test.cc: do not return address of literal - test/extensions/filters/network/direct_response/BUILD: skip test with constructor+lambda that does not compile on Windows - codec_impl_test.cc: MSVC pre-processing does not like the multline string passed to EXPECT_EQ macro, pull into intermediate variable - test/extensions/filters/network/thrift_proxy/mocks.h: avoid downcastAndValidate being called on google::protobuf::Struct, it seems there is no 'Validate()' method for that type MSVC can find, instead mimic the mocking pattern in dubbo_proxy and mock a test-specific FactoryBase class - fix comment typo Co-authored-by: Sunjay Bhatia Signed-off-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Signed-off-by: William A Rowe Jr --- ci/windows_ci_steps.sh | 2 +- .../filters/common/rbac/matchers_test.cc | 9 ++++-- .../filters/network/direct_response/BUILD | 6 ++++ .../network/mongo_proxy/codec_impl_test.cc | 10 ++++--- .../filters/network/thrift_proxy/mocks.cc | 2 +- .../filters/network/thrift_proxy/mocks.h | 30 ++++++++++++++++++- 6 files changed, 49 insertions(+), 10 deletions(-) diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index 702e5b0a2eda..0ded44c4dd82 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -34,7 +34,7 @@ BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failur bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //source/exe:envoy-static --build_tag_filters=-skip_on_windows # TODO(sunjayBhatia, wrowe): We are disabling building/running tests for now as the AZP pipelines -# workers do not provide enough resources for us to produce fast enouge or reliable enough builds. +# workers do not provide enough resources for us to produce fast enough or reliable enough builds. # Test compilation of known MSVC-compatible test sources # bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only diff --git a/test/extensions/filters/common/rbac/matchers_test.cc b/test/extensions/filters/common/rbac/matchers_test.cc index 7aa0456585dc..d710859f9d73 100644 --- a/test/extensions/filters/common/rbac/matchers_test.cc +++ b/test/extensions/filters/common/rbac/matchers_test.cc @@ -248,9 +248,10 @@ TEST(AuthenticatedMatcher, uriSanPeerCertificate) { const std::vector uri_sans{"foo", "baz"}; const std::vector dns_sans; + const std::string subject = "subject"; EXPECT_CALL(*ssl, uriSanPeerCertificate()).WillRepeatedly(Return(uri_sans)); EXPECT_CALL(*ssl, dnsSansPeerCertificate()).WillRepeatedly(Return(dns_sans)); - EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef("subject")); + EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef(subject)); EXPECT_CALL(Const(conn), ssl()).WillRepeatedly(Return(ssl)); @@ -272,6 +273,7 @@ TEST(AuthenticatedMatcher, dnsSanPeerCertificate) { const std::vector uri_sans{"uri_foo"}; const std::vector dns_sans{"foo", "baz"}; + const std::string subject = "subject"; EXPECT_CALL(*ssl, uriSanPeerCertificate()).WillRepeatedly(Return(uri_sans)); EXPECT_CALL(Const(conn), ssl()).WillRepeatedly(Return(ssl)); @@ -279,7 +281,7 @@ TEST(AuthenticatedMatcher, dnsSanPeerCertificate) { EXPECT_CALL(*ssl, dnsSansPeerCertificate()).WillRepeatedly(Return(dns_sans)); EXPECT_CALL(Const(conn), ssl()).WillRepeatedly(Return(ssl)); - EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef("subject")); + EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef(subject)); // We should get check if any DNS SAN matches as URI SAN is not available. envoy::config::rbac::v3::Principal::Authenticated auth; @@ -374,9 +376,10 @@ TEST(PolicyMatcher, PolicyMatcher) { const std::vector uri_sans{"bar", "baz"}; const std::vector dns_sans; + const std::string subject = "subject"; EXPECT_CALL(*ssl, uriSanPeerCertificate()).Times(4).WillRepeatedly(Return(uri_sans)); EXPECT_CALL(*ssl, dnsSansPeerCertificate()).WillRepeatedly(Return(dns_sans)); - EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef("subject")); + EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef(subject)); EXPECT_CALL(Const(conn), ssl()).Times(2).WillRepeatedly(Return(ssl)); EXPECT_CALL(Const(info), downstreamLocalAddress()).Times(2).WillRepeatedly(ReturnRef(addr)); diff --git a/test/extensions/filters/network/direct_response/BUILD b/test/extensions/filters/network/direct_response/BUILD index aa56a9f94f50..5fa43c2946b9 100644 --- a/test/extensions/filters/network/direct_response/BUILD +++ b/test/extensions/filters/network/direct_response/BUILD @@ -17,6 +17,12 @@ envoy_extension_cc_test( "direct_response_integration_test.cc", ], extension_name = "envoy.filters.network.direct_response", + tags = [ + # TODO(wrowe,sunjayBhatia): Skipping this on Windows as MSVC does allow invoking + # connection.close() from within the lambda that is passed to the RawConnectionDriver + # constructor + "skip_on_windows", + ], deps = [ "//source/extensions/filters/network/direct_response:config", "//test/integration:integration_lib", diff --git a/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc b/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc index 63ea96b3c9a7..1c960dd87150 100644 --- a/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc +++ b/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc @@ -332,10 +332,12 @@ TEST_F(MongoCodecImplTest, QueryToStringWithEscape) { query.numberToReturn(-1); query.query(Bson::DocumentImpl::create()->addString("string_need_esc", "{\"foo\": \"bar\n\"}")); - EXPECT_EQ(R"EOF({"opcode": "OP_QUERY", "id": 1, "response_to": 1, "flags": "0x4", )EOF" - R"EOF("collection": "test", "skip": 20, "return": -1, "query": )EOF" - R"EOF({"string_need_esc": "{\"foo\": \"bar\n\"}"}, "fields": {}})EOF", - query.toString(true)); + const std::string expectedQuery = + R"EOF({"opcode": "OP_QUERY", "id": 1, "response_to": 1, "flags": "0x4", )EOF" + R"EOF("collection": "test", "skip": 20, "return": -1, "query": )EOF" + R"EOF({"string_need_esc": "{\"foo\": \"bar\n\"}"}, "fields": {}})EOF"; + + EXPECT_EQ(query.toString(true), expectedQuery); EXPECT_NO_THROW(Json::Factory::loadFromString(query.toString(true))); EXPECT_NO_THROW(Json::Factory::loadFromString(query.toString(false))); diff --git a/test/extensions/filters/network/thrift_proxy/mocks.cc b/test/extensions/filters/network/thrift_proxy/mocks.cc index ee57deef2893..9101b27f4bcb 100644 --- a/test/extensions/filters/network/thrift_proxy/mocks.cc +++ b/test/extensions/filters/network/thrift_proxy/mocks.cc @@ -93,7 +93,7 @@ MockDecoderFilterCallbacks::MockDecoderFilterCallbacks() { MockDecoderFilterCallbacks::~MockDecoderFilterCallbacks() = default; MockFilterConfigFactory::MockFilterConfigFactory() - : FactoryBase("envoy.filters.thrift.mock_filter") { + : MockFactoryBase("envoy.filters.thrift.mock_filter") { mock_filter_ = std::make_shared>(); } diff --git a/test/extensions/filters/network/thrift_proxy/mocks.h b/test/extensions/filters/network/thrift_proxy/mocks.h index d7d9098df2c5..906ca196824a 100644 --- a/test/extensions/filters/network/thrift_proxy/mocks.h +++ b/test/extensions/filters/network/thrift_proxy/mocks.h @@ -258,7 +258,35 @@ class MockDecoderFilterCallbacks : public DecoderFilterCallbacks { std::shared_ptr route_; }; -class MockFilterConfigFactory : public ThriftFilters::FactoryBase { +template class MockFactoryBase : public NamedThriftFilterConfigFactory { +public: + FilterFactoryCb + createFilterFactoryFromProto(const Protobuf::Message& proto_config, + const std::string& stats_prefix, + Server::Configuration::FactoryContext& context) override { + const auto& typed_config = dynamic_cast(proto_config); + return createFilterFactoryFromProtoTyped(typed_config, stats_prefix, context); + } + + ProtobufTypes::MessagePtr createEmptyConfigProto() override { + return std::make_unique(); + } + + std::string name() const override { return name_; } + +protected: + MockFactoryBase(const std::string& name) : name_(name) {} + +private: + virtual FilterFactoryCb + createFilterFactoryFromProtoTyped(const ConfigProto& proto_config, + const std::string& stats_prefix, + Server::Configuration::FactoryContext& context) PURE; + + const std::string name_; +}; + +class MockFilterConfigFactory : public MockFactoryBase { public: MockFilterConfigFactory(); ~MockFilterConfigFactory() override; From 7d9ba7e0326c47a7ae8736a59be3d3ac975f8790 Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Tue, 14 Apr 2020 16:25:42 -0400 Subject: [PATCH 32/42] Add workaround for PR 10777 See https://github.com/envoyproxy/envoy/pull/10777 for discussion Co-authored-by: William A Rowe Jr Signed-off-by: William A Rowe Jr Co-authored-by: Sunjay Bhatia Signed-off-by: Sunjay Bhatia --- source/common/http/status.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/common/http/status.cc b/source/common/http/status.cc index 96aa910bd934..6051df640a83 100644 --- a/source/common/http/status.cc +++ b/source/common/http/status.cc @@ -21,6 +21,8 @@ absl::string_view statusCodeToString(StatusCode code) { return "PrematureResponseError"; case StatusCode::CodecClientError: return "CodecClientError"; + default: + RELEASE_ASSERT(false, "Invalid StatusCode value"); } } From e852c9a044ea58aff66ce96de3cc478f2ff2237c Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Wed, 15 Apr 2020 14:05:54 -0400 Subject: [PATCH 33/42] Revert changes working around missing return Signed-off-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Co-authored-by: Sunjay Bhatia --- source/common/http/status.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/common/http/status.cc b/source/common/http/status.cc index bd20bf1b2782..166b154a3d2b 100644 --- a/source/common/http/status.cc +++ b/source/common/http/status.cc @@ -21,8 +21,6 @@ absl::string_view statusCodeToString(StatusCode code) { return "PrematureResponseError"; case StatusCode::CodecClientError: return "CodecClientError"; - default: - RELEASE_ASSERT(false, "Invalid StatusCode value"); } NOT_REACHED_GCOVR_EXCL_LINE; } From 3c111f70b6aab633a8de228a394a07f6dc8f57c0 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Thu, 16 Apr 2020 16:35:14 -0400 Subject: [PATCH 34/42] Fix typo in comment Signed-off-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Co-authored-by: Sunjay Bhatia --- test/extensions/filters/network/direct_response/BUILD | 2 +- test/integration/BUILD | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/extensions/filters/network/direct_response/BUILD b/test/extensions/filters/network/direct_response/BUILD index 5fa43c2946b9..a828acc3d659 100644 --- a/test/extensions/filters/network/direct_response/BUILD +++ b/test/extensions/filters/network/direct_response/BUILD @@ -18,7 +18,7 @@ envoy_extension_cc_test( ], extension_name = "envoy.filters.network.direct_response", tags = [ - # TODO(wrowe,sunjayBhatia): Skipping this on Windows as MSVC does allow invoking + # TODO(wrowe,sunjayBhatia): Skipping this on Windows as MSVC does not allow invoking # connection.close() from within the lambda that is passed to the RawConnectionDriver # constructor "skip_on_windows", diff --git a/test/integration/BUILD b/test/integration/BUILD index d1c9bec4ae9f..19b7b26eea6f 100644 --- a/test/integration/BUILD +++ b/test/integration/BUILD @@ -645,7 +645,7 @@ envoy_cc_test( # Uncomment this line to run this test repeatedly in exclusive mode if not using docker-sandbox, # or RBE, see comments in AddRemoveListener. # "exclusive", - # TODO(wrowe,sunjayBhatia): Skipping this on Windows as MSVC does allow invoking + # TODO(wrowe,sunjayBhatia): Skipping this on Windows as MSVC does not allow invoking # connection.close() from within the lambda that is passed to the RawConnectionDriver # constructor "skip_on_windows", From 6036c92b279be48745c9b6562345fdf89933ae4f Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Thu, 16 Apr 2020 16:59:12 -0400 Subject: [PATCH 35/42] Remove changes in test/ tree to simplify PR - remaining changes in PR represent required diff for enabling many extensions on Windows and restructuring of how extensions are included on Windows - fixes for compilation of extensions sources - enables foreign cc builds of luajit/moonjit/kafka - still some extensions that do not compile on Windows due to more significant defects, will be addressed in subsequent PRs - also contains some simplification of bazelrc and CI setup Signed-off-by: William A Rowe Jr Signed-off-by: Sunjay Bhatia Co-authored-by: William A Rowe Jr Co-authored-by: Sunjay Bhatia --- test/common/buffer/owned_impl_test.cc | 34 ++-- test/common/buffer/watermark_buffer_test.cc | 6 - test/common/grpc/BUILD | 2 - test/common/http/BUILD | 2 - test/common/http/http2/codec_impl_test.cc | 3 + test/common/network/BUILD | 4 - test/common/network/dns_impl_test.cc | 12 +- test/common/router/BUILD | 2 - test/common/runtime/BUILD | 5 - test/common/signal/BUILD | 6 +- test/config_test/BUILD | 12 +- test/exe/BUILD | 18 +- test/exe/main_common_test.cc | 17 +- test/extensions/common/wasm/BUILD | 2 - .../filters/common/rbac/matchers_test.cc | 9 +- .../http_inspector/http_inspector_test.cc | 162 ++++++++---------- .../tls_inspector/tls_inspector_test.cc | 12 +- .../filters/network/direct_response/BUILD | 6 - .../network/mongo_proxy/codec_impl_test.cc | 10 +- .../mysql_proxy/mysql_integration_test.cc | 3 - test/extensions/quic_listeners/quiche/BUILD | 60 ++----- .../quic_listeners/quiche/integration/BUILD | 6 +- .../quic_listeners/quiche/platform/BUILD | 2 +- .../quiche/platform/quic_test_output_impl.cc | 6 +- .../quiche/quic_io_handle_wrapper_test.cc | 4 +- .../common/statsd/udp_statsd_test.cc | 4 +- test/extensions/tracers/common/ot/BUILD | 10 +- test/extensions/tracers/datadog/BUILD | 4 - test/extensions/tracers/dynamic_ot/BUILD | 4 - test/extensions/tracers/lightstep/BUILD | 4 - test/extensions/tracers/opencensus/BUILD | 4 - test/extensions/tracers/xray/tracer_test.cc | 4 +- test/extensions/tracers/zipkin/tracer_test.cc | 2 +- test/extensions/transport_sockets/tls/BUILD | 2 - test/integration/BUILD | 22 +-- test/integration/tcp_dump.cc | 10 +- test/main.cc | 22 --- test/mocks/network/io_handle.h | 2 +- test/server/BUILD | 18 +- test/server/config_validation/BUILD | 12 +- test/server/listener_manager_impl_test.cc | 10 +- test/server/listener_manager_impl_test.h | 2 +- test/server/server_test.cc | 10 -- test/tools/router_check/test/BUILD | 2 - test/tools/type_whisperer/BUILD | 2 - 45 files changed, 165 insertions(+), 390 deletions(-) diff --git a/test/common/buffer/owned_impl_test.cc b/test/common/buffer/owned_impl_test.cc index bd06b3233da8..6934fc63c2f4 100644 --- a/test/common/buffer/owned_impl_test.cc +++ b/test/common/buffer/owned_impl_test.cc @@ -649,24 +649,19 @@ TEST_F(OwnedImplTest, ReserveZeroCommit) { slices[i].len_ = 0; } buf.commit(slices, allocated_slices); - os_fd_t pipe_fds[2] = {0, 0}; - auto& os_sys_calls = Api::OsSysCallsSingleton::get(); -#ifdef WIN32 - ASSERT_EQ(os_sys_calls.socketpair(AF_INET, SOCK_STREAM, 0, pipe_fds).rc_, 0); -#else - ASSERT_EQ(pipe(pipe_fds), 0); -#endif + int pipe_fds[2] = {0, 0}; + ASSERT_EQ(::pipe(pipe_fds), 0); Network::IoSocketHandleImpl io_handle(pipe_fds[0]); - ASSERT_EQ(os_sys_calls.setsocketblocking(pipe_fds[0], false).rc_, 0); - ASSERT_EQ(os_sys_calls.setsocketblocking(pipe_fds[1], false).rc_, 0); + ASSERT_EQ(::fcntl(pipe_fds[0], F_SETFL, O_NONBLOCK), 0); + ASSERT_EQ(::fcntl(pipe_fds[1], F_SETFL, O_NONBLOCK), 0); const uint32_t max_length = 1953; std::string data(max_length, 'e'); - const ssize_t rc = os_sys_calls.write(pipe_fds[1], data.data(), max_length).rc_; + const ssize_t rc = ::write(pipe_fds[1], data.data(), max_length); ASSERT_GT(rc, 0); const uint32_t previous_length = buf.length(); Api::IoCallUint64Result result = buf.read(io_handle, max_length); ASSERT_EQ(result.rc_, static_cast(rc)); - ASSERT_EQ(os_sys_calls.close(pipe_fds[1]).rc_, 0); + ASSERT_EQ(::close(pipe_fds[1]), 0); ASSERT_EQ(previous_length, buf.search(data.data(), rc, previous_length)); EXPECT_EQ("bbbbb", buf.toString().substr(0, 5)); expectSlices({{5, 0, 4056}, {1953, 2103, 4056}}, buf); @@ -677,24 +672,19 @@ TEST_F(OwnedImplTest, ReadReserveAndCommit) { Buffer::OwnedImpl buf; buf.add("bbbbb"); - os_fd_t pipe_fds[2] = {0, 0}; - auto& os_sys_calls = Api::OsSysCallsSingleton::get(); -#ifdef WIN32 - ASSERT_EQ(os_sys_calls.socketpair(AF_INET, SOCK_STREAM, 0, pipe_fds).rc_, 0); -#else - ASSERT_EQ(pipe(pipe_fds), 0); -#endif + int pipe_fds[2] = {0, 0}; + ASSERT_EQ(::pipe(pipe_fds), 0); Network::IoSocketHandleImpl io_handle(pipe_fds[0]); - ASSERT_EQ(os_sys_calls.setsocketblocking(pipe_fds[0], false).rc_, 0); - ASSERT_EQ(os_sys_calls.setsocketblocking(pipe_fds[1], false).rc_, 0); + ASSERT_EQ(::fcntl(pipe_fds[0], F_SETFL, O_NONBLOCK), 0); + ASSERT_EQ(::fcntl(pipe_fds[1], F_SETFL, O_NONBLOCK), 0); const uint32_t read_length = 32768; std::string data = "e"; - const ssize_t rc = os_sys_calls.write(pipe_fds[1], data.data(), data.size()).rc_; + const ssize_t rc = ::write(pipe_fds[1], data.data(), data.size()); ASSERT_GT(rc, 0); Api::IoCallUint64Result result = buf.read(io_handle, read_length); ASSERT_EQ(result.rc_, static_cast(rc)); - ASSERT_EQ(os_sys_calls.close(pipe_fds[1]).rc_, 0); + ASSERT_EQ(::close(pipe_fds[1]), 0); EXPECT_EQ("bbbbbe", buf.toString()); expectSlices({{6, 4050, 4056}}, buf); } diff --git a/test/common/buffer/watermark_buffer_test.cc b/test/common/buffer/watermark_buffer_test.cc index f5c13fa7e177..1010e649843b 100644 --- a/test/common/buffer/watermark_buffer_test.cc +++ b/test/common/buffer/watermark_buffer_test.cc @@ -1,6 +1,5 @@ #include -#include "common/api/os_sys_calls_impl.h" #include "common/buffer/buffer_impl.h" #include "common/buffer/watermark_buffer.h" #include "common/network/io_socket_handle_impl.h" @@ -200,12 +199,7 @@ TEST_F(WatermarkBufferTest, MoveOneByte) { TEST_F(WatermarkBufferTest, WatermarkFdFunctions) { os_fd_t pipe_fds[2] = {0, 0}; -#ifdef WIN32 - auto& os_sys_calls = Api::OsSysCallsSingleton::get(); - ASSERT_EQ(0, os_sys_calls.socketpair(AF_INET, SOCK_STREAM, 0, pipe_fds).rc_); -#else ASSERT_EQ(0, pipe(pipe_fds)); -#endif buffer_.add(TEN_BYTES, 10); buffer_.add(TEN_BYTES, 10); diff --git a/test/common/grpc/BUILD b/test/common/grpc/BUILD index 612f7f798b5b..d790518e77bb 100644 --- a/test/common/grpc/BUILD +++ b/test/common/grpc/BUILD @@ -161,8 +161,6 @@ envoy_cc_test_library( envoy_cc_test( name = "grpc_client_integration_test", srcs = ["grpc_client_integration_test.cc"], - # Fails on windows; Connection is terminated early testing BasicStream/IPv4_EnvoyGrpc - tags = ["fails_on_windows"], deps = [ ":grpc_client_integration_test_harness_lib", "//source/common/grpc:async_client_lib", diff --git a/test/common/http/BUILD b/test/common/http/BUILD index 91fc3ec75460..5382d74c085c 100644 --- a/test/common/http/BUILD +++ b/test/common/http/BUILD @@ -49,8 +49,6 @@ envoy_cc_test( envoy_cc_test( name = "codec_client_test", srcs = ["codec_client_test.cc"], - # IpVersions/CodecNetworkTest.SendData/IPv4: Test times out on Windows. - tags = ["fails_on_windows"], deps = [ ":common_lib", "//source/common/buffer:buffer_lib", diff --git a/test/common/http/http2/codec_impl_test.cc b/test/common/http/http2/codec_impl_test.cc index 6d0f671cd284..e44c29198a2e 100644 --- a/test/common/http/http2/codec_impl_test.cc +++ b/test/common/http/http2/codec_impl_test.cc @@ -987,6 +987,9 @@ TEST_P(Http2CodecImplTest, WatermarkUnderEndStream) { response_encoder_->encodeHeaders(response_headers, true); } +class Http2CodecImplSettingsBasicTest : public Http2CodecImplTest {}; +TEST_P(Http2CodecImplSettingsBasicTest, ) {} + class Http2CodecImplStreamLimitTest : public Http2CodecImplTest {}; // Regression test for issue #3076. diff --git a/test/common/network/BUILD b/test/common/network/BUILD index 3f9b79c5e7a6..5c56a6262709 100644 --- a/test/common/network/BUILD +++ b/test/common/network/BUILD @@ -73,8 +73,6 @@ envoy_cc_test( envoy_cc_test( name = "connection_impl_test", srcs = ["connection_impl_test.cc"], - # Times out on Windows - tags = ["fails_on_windows"], deps = [ "//source/common/buffer:buffer_lib", "//source/common/common:empty_string", @@ -179,8 +177,6 @@ envoy_cc_test( envoy_cc_test( name = "listener_impl_test", srcs = ["listener_impl_test.cc"], - # Times out on Windows - tags = ["fails_on_windows"], deps = [ "//source/common/event:dispatcher_lib", "//source/common/network:address_lib", diff --git a/test/common/network/dns_impl_test.cc b/test/common/network/dns_impl_test.cc index 38abf99b904a..d2f41dc1b4f2 100644 --- a/test/common/network/dns_impl_test.cc +++ b/test/common/network/dns_impl_test.cc @@ -1,10 +1,13 @@ +#include +#include +#include + #include #include #include #include #include -#include "envoy/common/platform.h" #include "envoy/config/core/v3/address.pb.h" #include "envoy/event/dispatcher.h" #include "envoy/network/address.h" @@ -31,13 +34,6 @@ #include "ares_dns.h" #include "gtest/gtest.h" -#if !defined(WIN32) -#include -#include -#else -#include "nameser.h" -#endif - using testing::_; using testing::Contains; using testing::InSequence; diff --git a/test/common/router/BUILD b/test/common/router/BUILD index c3cab9845d2c..2ac9c91f26f3 100644 --- a/test/common/router/BUILD +++ b/test/common/router/BUILD @@ -221,8 +221,6 @@ envoy_cc_fuzz_test( name = "route_fuzz_test", srcs = ["route_fuzz_test.cc"], corpus = ":route_corpus", - # The corpus_from_config_impl currently does not work, the tests it runs do not pass - tags = ["skip_on_windows"], deps = [ ":route_fuzz_proto_cc_proto", "//source/common/router:config_lib", diff --git a/test/common/runtime/BUILD b/test/common/runtime/BUILD index 1df1476d4149..c2cd9d5be4be 100644 --- a/test/common/runtime/BUILD +++ b/test/common/runtime/BUILD @@ -29,8 +29,6 @@ envoy_cc_test_library( envoy_cc_test( name = "runtime_protos_test", srcs = ["runtime_protos_test.cc"], - # Pass for the time being, test times out on windows - tags = ["fails_on_windows"], deps = [ "//source/common/runtime:runtime_lib", "//test/mocks/runtime:runtime_mocks", @@ -44,9 +42,6 @@ envoy_cc_test( name = "runtime_impl_test", srcs = ["runtime_impl_test.cc"], data = glob(["test_data/**"]) + ["filesystem_setup.sh"], - # Inexplicable failure promoting arguments to mock, see - # https://envoyproxy.slack.com/archives/CNAK09BSB/p1571946165007300 - tags = ["fails_on_windows"], deps = [ "//source/common/config:runtime_utility_lib", "//source/common/runtime:runtime_lib", diff --git a/test/common/signal/BUILD b/test/common/signal/BUILD index 746babe0fedf..c29cfd2a56b3 100644 --- a/test/common/signal/BUILD +++ b/test/common/signal/BUILD @@ -11,11 +11,7 @@ envoy_package() envoy_cc_test( name = "signals_test", srcs = ["signals_test.cc"], - # Posix signal tests are irrelevant to Windows - tags = [ - "backtrace", - "skip_on_windows", - ], + tags = ["backtrace"], deps = [ "//source/common/signal:sigaction_lib", "//test/test_common:utility_lib", diff --git a/test/config_test/BUILD b/test/config_test/BUILD index a00de6bb96c4..494341c4b6fd 100644 --- a/test/config_test/BUILD +++ b/test/config_test/BUILD @@ -6,8 +6,10 @@ load( "envoy_cc_test_library", "envoy_package", ) -load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") -load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") +load( + "//source/extensions:all_extensions.bzl", + "envoy_all_extensions", +) envoy_package() @@ -43,9 +45,5 @@ envoy_cc_test_library( "//test/mocks/ssl:ssl_mocks", "//test/test_common:threadsafe_singleton_injector_lib", "//test/test_common:simulated_time_system_lib", - ] + select({ - "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), - "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), - "//conditions:default": envoy_all_extensions(), - }), + ] + envoy_all_extensions(), ) diff --git a/test/exe/BUILD b/test/exe/BUILD index 7540aafa7525..9c43e1b1ead8 100644 --- a/test/exe/BUILD +++ b/test/exe/BUILD @@ -17,8 +17,6 @@ envoy_sh_test( "//bazel:raw_build_id.ldscript", "//source/exe:envoy-static", ], - # The sh_test helper from Bazel does not work as expected, see: https://github.com/bazelbuild/bazel/issues/10959 - tags = ["fails_on_windows"], ) envoy_sh_test( @@ -26,14 +24,8 @@ envoy_sh_test( srcs = ["envoy_static_test.sh"], coverage = False, data = ["//source/exe:envoy-static"], - # For windows, we expect to use a .ps1 script that leverages dumpbin.exe, see: - # https://github.com/envoyproxy/envoy/pull/8280#pullrequestreview-290187328 - # The sh_test helper from Bazel does not work as expected, see: https://github.com/bazelbuild/bazel/issues/10959 # Sanitizers doesn't like statically linked lib(std)c++ and libgcc, skip this test in that context. - tags = [ - "fails_on_windows", - "no_san", - ], + tags = ["no_san"], ) envoy_sh_test( @@ -41,11 +33,7 @@ envoy_sh_test( srcs = ["pie_test.sh"], coverage = False, data = ["//source/exe:envoy-static"], - # Since VS2015 or even earlier, link.exe defaults to PIE generation - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], ) envoy_sh_test( @@ -57,8 +45,6 @@ envoy_sh_test( "//bazel:raw_build_id.ldscript", "//source/exe:envoy-static", ], - # The sh_test helper from Bazel does not work as expected, see: https://github.com/bazelbuild/bazel/issues/10959 - tags = ["fails_on_windows"], ) envoy_cc_test( diff --git a/test/exe/main_common_test.cc b/test/exe/main_common_test.cc index 78fe3aeebfcf..ac625f349a07 100644 --- a/test/exe/main_common_test.cc +++ b/test/exe/main_common_test.cc @@ -59,12 +59,7 @@ class MainCommonTest : public testing::TestWithParam uri_sans{"foo", "baz"}; const std::vector dns_sans; - const std::string subject = "subject"; EXPECT_CALL(*ssl, uriSanPeerCertificate()).WillRepeatedly(Return(uri_sans)); EXPECT_CALL(*ssl, dnsSansPeerCertificate()).WillRepeatedly(Return(dns_sans)); - EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef(subject)); + EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef("subject")); EXPECT_CALL(Const(conn), ssl()).WillRepeatedly(Return(ssl)); @@ -273,7 +272,6 @@ TEST(AuthenticatedMatcher, dnsSanPeerCertificate) { const std::vector uri_sans{"uri_foo"}; const std::vector dns_sans{"foo", "baz"}; - const std::string subject = "subject"; EXPECT_CALL(*ssl, uriSanPeerCertificate()).WillRepeatedly(Return(uri_sans)); EXPECT_CALL(Const(conn), ssl()).WillRepeatedly(Return(ssl)); @@ -281,7 +279,7 @@ TEST(AuthenticatedMatcher, dnsSanPeerCertificate) { EXPECT_CALL(*ssl, dnsSansPeerCertificate()).WillRepeatedly(Return(dns_sans)); EXPECT_CALL(Const(conn), ssl()).WillRepeatedly(Return(ssl)); - EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef(subject)); + EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef("subject")); // We should get check if any DNS SAN matches as URI SAN is not available. envoy::config::rbac::v3::Principal::Authenticated auth; @@ -376,10 +374,9 @@ TEST(PolicyMatcher, PolicyMatcher) { const std::vector uri_sans{"bar", "baz"}; const std::vector dns_sans; - const std::string subject = "subject"; EXPECT_CALL(*ssl, uriSanPeerCertificate()).Times(4).WillRepeatedly(Return(uri_sans)); EXPECT_CALL(*ssl, dnsSansPeerCertificate()).WillRepeatedly(Return(dns_sans)); - EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef(subject)); + EXPECT_CALL(*ssl, subjectPeerCertificate()).WillRepeatedly(ReturnRef("subject")); EXPECT_CALL(Const(conn), ssl()).Times(2).WillRepeatedly(Return(ssl)); EXPECT_CALL(Const(info), downstreamLocalAddress()).Times(2).WillRepeatedly(ReturnRef(addr)); diff --git a/test/extensions/filters/listener/http_inspector/http_inspector_test.cc b/test/extensions/filters/listener/http_inspector/http_inspector_test.cc index c55189470427..b028974fcb8d 100644 --- a/test/extensions/filters/listener/http_inspector/http_inspector_test.cc +++ b/test/extensions/filters/listener/http_inspector/http_inspector_test.cc @@ -78,7 +78,7 @@ TEST_F(HttpInspectorTest, SkipHttpInspectForTLS) { TEST_F(HttpInspectorTest, InlineReadIoError) { init(/*include_inline_recv=*/false); EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([](os_fd_t, void*, size_t, int) -> Api::SysCallSizeResult { + .WillOnce(Invoke([](int, void*, size_t, int) -> Api::SysCallSizeResult { return Api::SysCallSizeResult{ssize_t(-1), 0}; })); EXPECT_CALL(dispatcher_, createFileEvent_(_, _, _, _)).Times(0); @@ -98,12 +98,11 @@ TEST_F(HttpInspectorTest, InlineReadInspectHttp10) { "a52df4a0-ed00-4a19-86a7-80e5049c6c84\r\nx-envoy-expected-rq-timeout-ms: " "15000\r\ncontent-length: 0\r\n\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.0")}; EXPECT_CALL(dispatcher_, createFileEvent_(_, _, _, _)).Times(0); @@ -123,12 +122,11 @@ TEST_F(HttpInspectorTest, InlineReadParseError) { "a52df4a0-ed00-4a19-86a7-80e5049c6c84\r\nx-envoy-expected-rq-timeout-ms: " "15000\r\ncontent-length: 0\r\n\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); EXPECT_CALL(dispatcher_, createFileEvent_(_, _, _, _)).Times(0); EXPECT_CALL(socket_, setRequestedApplicationProtocols(_)).Times(0); auto accepted = filter_->onAccept(cb_); @@ -145,12 +143,11 @@ TEST_F(HttpInspectorTest, InspectHttp10) { "15000\r\ncontent-length: 0\r\n\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.0")}; @@ -169,12 +166,11 @@ TEST_F(HttpInspectorTest, InspectHttp11) { "15000\r\ncontent-length: 0\r\n\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.1")}; @@ -193,12 +189,11 @@ TEST_F(HttpInspectorTest, InspectHttp11WithNonEmptyRequestBody) { "15000\r\ncontent-length: 3\r\n\r\nfoo"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.1")}; @@ -214,12 +209,11 @@ TEST_F(HttpInspectorTest, ExtraSpaceInRequestLine) { // ^^ ^^ EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.1")}; @@ -234,12 +228,11 @@ TEST_F(HttpInspectorTest, InvalidHttpMethod) { const absl::string_view header = "BAD /anything HTTP/1.1"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); EXPECT_CALL(socket_, setRequestedApplicationProtocols(_)).Times(0); EXPECT_CALL(cb_, continueFilterChain(true)); @@ -252,12 +245,11 @@ TEST_F(HttpInspectorTest, InvalidHttpRequestLine) { const absl::string_view header = "BAD /anything HTTP/1.1\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); EXPECT_CALL(socket_, setRequestedApplicationProtocols(_)).Times(0); EXPECT_CALL(cb_, continueFilterChain(_)); @@ -270,12 +262,11 @@ TEST_F(HttpInspectorTest, OldHttpProtocol) { const absl::string_view header = "GET /anything HTTP/0.9\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("http/1.0")}; EXPECT_CALL(socket_, setRequestedApplicationProtocols(alpn_protos)); @@ -289,12 +280,11 @@ TEST_F(HttpInspectorTest, InvalidRequestLine) { const absl::string_view header = "GET /anything HTTP/1.1 BadRequestLine\r\n"; EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&header](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= header.size()); - memcpy(buffer, header.data(), header.size()); - return Api::SysCallSizeResult{ssize_t(header.size()), 0}; - })); + .WillOnce(Invoke([&header](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= header.size()); + memcpy(buffer, header.data(), header.size()); + return Api::SysCallSizeResult{ssize_t(header.size()), 0}; + })); EXPECT_CALL(socket_, setRequestedApplicationProtocols(_)).Times(0); EXPECT_CALL(cb_, continueFilterChain(true)); @@ -314,12 +304,11 @@ TEST_F(HttpInspectorTest, InspectHttp2) { std::vector data = Hex::decode(header); EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&data](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= data.size()); - memcpy(buffer, data.data(), data.size()); - return Api::SysCallSizeResult{ssize_t(data.size()), 0}; - })); + .WillOnce(Invoke([&data](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= data.size()); + memcpy(buffer, data.data(), data.size()); + return Api::SysCallSizeResult{ssize_t(data.size()), 0}; + })); const std::vector alpn_protos{absl::string_view("h2c")}; @@ -336,12 +325,11 @@ TEST_F(HttpInspectorTest, InvalidConnectionPreface) { const std::vector data = Hex::decode(header); EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce( - Invoke([&data](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { - ASSERT(length >= data.size()); - memcpy(buffer, data.data(), data.size()); - return Api::SysCallSizeResult{ssize_t(data.size()), 0}; - })); + .WillOnce(Invoke([&data](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= data.size()); + memcpy(buffer, data.data(), data.size()); + return Api::SysCallSizeResult{ssize_t(data.size()), 0}; + })); EXPECT_CALL(socket_, setRequestedApplicationProtocols(_)).Times(0); EXPECT_CALL(cb_, continueFilterChain(true)).Times(0); @@ -380,8 +368,8 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp2) { for (size_t i = 1; i <= 24; i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke( - [&data, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce( + Invoke([&data, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= i); memcpy(buffer, data.data(), i); return Api::SysCallSizeResult{ssize_t(i), 0}; @@ -413,8 +401,8 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp2BadPreface) { for (size_t i = 1; i <= data.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke( - [&data, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce( + Invoke([&data, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= i); memcpy(buffer, data.data(), i); return Api::SysCallSizeResult{ssize_t(i), 0}; @@ -445,8 +433,8 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp1) { for (size_t i = 1; i <= data.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke( - [&data, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce( + Invoke([&data, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= i); memcpy(buffer, data.data(), i); return Api::SysCallSizeResult{ssize_t(i), 0}; @@ -479,7 +467,7 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp1IncompleteHeader) { for (size_t i = 1; i <= data.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&data, &end_stream, i](os_fd_t, void* buffer, size_t length, + .WillOnce(Invoke([&data, &end_stream, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= i); memcpy(buffer, data.data(), i); @@ -511,8 +499,8 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp1IncompleteBadHeader) { for (size_t i = 1; i <= data.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke( - [&data, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce( + Invoke([&data, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= i); memcpy(buffer, data.data(), i); return Api::SysCallSizeResult{ssize_t(i), 0}; @@ -545,7 +533,7 @@ TEST_F(HttpInspectorTest, MultipleReadsHttp1BadProtocol) { for (size_t i = 1; i <= truncate_header.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&truncate_header, i](os_fd_t, void* buffer, size_t length, + .WillOnce(Invoke([&truncate_header, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= truncate_header.size()); memcpy(buffer, truncate_header.data(), truncate_header.size()); @@ -589,8 +577,8 @@ TEST_F(HttpInspectorTest, Http1WithLargeRequestLine) { len = size_t(Config::MAX_INSPECT_SIZE / (3 - i)); } EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke( - [&data, len](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce( + Invoke([&data, len](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= len); memcpy(buffer, data.data(), len); return Api::SysCallSizeResult{ssize_t(len), 0}; @@ -625,8 +613,8 @@ TEST_F(HttpInspectorTest, Http1WithLargeHeader) { for (size_t i = 1; i <= 20; i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke( - [&data, i](os_fd_t, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + .WillOnce( + Invoke([&data, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { ASSERT(length >= data.size()); memcpy(buffer, data.data(), i); return Api::SysCallSizeResult{ssize_t(i), 0}; diff --git a/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc b/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc index 8d1da06977a4..1969cac95f8f 100644 --- a/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc +++ b/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc @@ -163,12 +163,12 @@ TEST_P(TlsInspectorTest, MultipleReads) { })); for (size_t i = 1; i <= client_hello.size(); i++) { EXPECT_CALL(os_sys_calls_, recv(42, _, _, MSG_PEEK)) - .WillOnce(Invoke([&client_hello, i](os_fd_t, void* buffer, size_t length, - int) -> Api::SysCallSizeResult { - ASSERT(length >= client_hello.size()); - memcpy(buffer, client_hello.data(), client_hello.size()); - return Api::SysCallSizeResult{ssize_t(i), 0}; - })); + .WillOnce(Invoke( + [&client_hello, i](int, void* buffer, size_t length, int) -> Api::SysCallSizeResult { + ASSERT(length >= client_hello.size()); + memcpy(buffer, client_hello.data(), client_hello.size()); + return Api::SysCallSizeResult{ssize_t(i), 0}; + })); } } diff --git a/test/extensions/filters/network/direct_response/BUILD b/test/extensions/filters/network/direct_response/BUILD index a828acc3d659..aa56a9f94f50 100644 --- a/test/extensions/filters/network/direct_response/BUILD +++ b/test/extensions/filters/network/direct_response/BUILD @@ -17,12 +17,6 @@ envoy_extension_cc_test( "direct_response_integration_test.cc", ], extension_name = "envoy.filters.network.direct_response", - tags = [ - # TODO(wrowe,sunjayBhatia): Skipping this on Windows as MSVC does not allow invoking - # connection.close() from within the lambda that is passed to the RawConnectionDriver - # constructor - "skip_on_windows", - ], deps = [ "//source/extensions/filters/network/direct_response:config", "//test/integration:integration_lib", diff --git a/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc b/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc index 1c960dd87150..63ea96b3c9a7 100644 --- a/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc +++ b/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc @@ -332,12 +332,10 @@ TEST_F(MongoCodecImplTest, QueryToStringWithEscape) { query.numberToReturn(-1); query.query(Bson::DocumentImpl::create()->addString("string_need_esc", "{\"foo\": \"bar\n\"}")); - const std::string expectedQuery = - R"EOF({"opcode": "OP_QUERY", "id": 1, "response_to": 1, "flags": "0x4", )EOF" - R"EOF("collection": "test", "skip": 20, "return": -1, "query": )EOF" - R"EOF({"string_need_esc": "{\"foo\": \"bar\n\"}"}, "fields": {}})EOF"; - - EXPECT_EQ(query.toString(true), expectedQuery); + EXPECT_EQ(R"EOF({"opcode": "OP_QUERY", "id": 1, "response_to": 1, "flags": "0x4", )EOF" + R"EOF("collection": "test", "skip": 20, "return": -1, "query": )EOF" + R"EOF({"string_need_esc": "{\"foo\": \"bar\n\"}"}, "fields": {}})EOF", + query.toString(true)); EXPECT_NO_THROW(Json::Factory::loadFromString(query.toString(true))); EXPECT_NO_THROW(Json::Factory::loadFromString(query.toString(false))); diff --git a/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc b/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc index d5b848105e38..1a0a2cbe061d 100644 --- a/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc +++ b/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc @@ -1,8 +1,5 @@ -#ifndef WIN32 #include -#endif - #include "extensions/filters/network/mysql_proxy/mysql_codec.h" #include "extensions/filters/network/mysql_proxy/mysql_codec_clogin.h" #include "extensions/filters/network/mysql_proxy/mysql_codec_clogin_resp.h" diff --git a/test/extensions/quic_listeners/quiche/BUILD b/test/extensions/quic_listeners/quiche/BUILD index 7e24810fe50b..f7b52aed56d2 100644 --- a/test/extensions/quic_listeners/quiche/BUILD +++ b/test/extensions/quic_listeners/quiche/BUILD @@ -27,11 +27,7 @@ envoy_cc_test( name = "envoy_quic_writer_test", srcs = ["envoy_quic_writer_test.cc"], external_deps = ["quiche_quic_platform"], - # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], deps = [ "//source/common/network:io_socket_error_lib", "//source/extensions/quic_listeners/quiche:envoy_quic_packet_writer_lib", @@ -56,11 +52,7 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_server_stream_test", srcs = ["envoy_quic_server_stream_test.cc"], - # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], deps = [ ":quic_test_utils_for_envoy_lib", ":test_utils_lib", @@ -80,11 +72,7 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_client_stream_test", srcs = ["envoy_quic_client_stream_test.cc"], - # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], deps = [ ":quic_test_utils_for_envoy_lib", ":test_utils_lib", @@ -104,11 +92,7 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_server_session_test", srcs = ["envoy_quic_server_session_test.cc"], - # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], deps = [ ":quic_test_utils_for_envoy_lib", "//include/envoy/stats:stats_macros", @@ -135,11 +119,7 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_client_session_test", srcs = ["envoy_quic_client_session_test.cc"], - # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], deps = [ ":quic_test_utils_for_envoy_lib", "//include/envoy/stats:stats_macros", @@ -160,11 +140,7 @@ envoy_cc_test( envoy_cc_test( name = "active_quic_listener_test", srcs = ["active_quic_listener_test.cc"], - # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], deps = [ ":quic_test_utils_for_envoy_lib", "//source/extensions/quic_listeners/quiche:active_quic_listener_lib", @@ -180,11 +156,7 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_dispatcher_test", srcs = ["envoy_quic_dispatcher_test.cc"], - # quic_sent_packet_manager.cc does not compile error: warning C4715: 'quic::QuicSentPacketManager::OnRetransmissionTimeout': not all control paths return a value - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], deps = [ ":quic_test_utils_for_envoy_lib", "//include/envoy/stats:stats_macros", @@ -230,11 +202,7 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_utils_test", srcs = ["envoy_quic_utils_test.cc"], - # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], deps = [ ":quic_test_utils_for_envoy_lib", "//source/extensions/quic_listeners/quiche:envoy_quic_utils_lib", @@ -246,11 +214,7 @@ envoy_cc_test( envoy_cc_test( name = "active_quic_listener_config_test", srcs = ["active_quic_listener_config_test.cc"], - # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], deps = [ "//source/common/config:utility_lib", "//source/extensions/quic_listeners/quiche:active_quic_listener_config_lib", @@ -261,11 +225,7 @@ envoy_cc_test( envoy_cc_test( name = "envoy_quic_simulated_watermark_buffer_test", srcs = ["envoy_quic_simulated_watermark_buffer_test.cc"], - # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], deps = ["//source/extensions/quic_listeners/quiche:envoy_quic_simulated_watermark_buffer_lib"], ) diff --git a/test/extensions/quic_listeners/quiche/integration/BUILD b/test/extensions/quic_listeners/quiche/integration/BUILD index ec7a3cd5dcfa..e277da580d53 100644 --- a/test/extensions/quic_listeners/quiche/integration/BUILD +++ b/test/extensions/quic_listeners/quiche/integration/BUILD @@ -12,11 +12,7 @@ envoy_cc_test( name = "quic_http_integration_test", srcs = ["quic_http_integration_test.cc"], data = ["//test/config/integration/certs"], - # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows - tags = [ - "nofips", - "skip_on_windows", - ], + tags = ["nofips"], deps = [ "//source/extensions/filters/http/dynamo:config", "//source/extensions/quic_listeners/quiche:active_quic_listener_config_lib", diff --git a/test/extensions/quic_listeners/quiche/platform/BUILD b/test/extensions/quic_listeners/quiche/platform/BUILD index f48ced9263f2..ced7bf94658d 100644 --- a/test/extensions/quic_listeners/quiche/platform/BUILD +++ b/test/extensions/quic_listeners/quiche/platform/BUILD @@ -205,7 +205,7 @@ envoy_cc_test_library( hdrs = ["quic_test_output_impl.h"], tags = ["nofips"], deps = [ - "//test/test_common:file_system_for_test_lib", + "//source/common/filesystem:filesystem_lib", "@com_googlesource_quiche//:quic_platform_base", "@com_googlesource_quiche//:quiche_common_platform", ], diff --git a/test/extensions/quic_listeners/quiche/platform/quic_test_output_impl.cc b/test/extensions/quic_listeners/quiche/platform/quic_test_output_impl.cc index 556f6cd3e18a..9b67b3d3131e 100644 --- a/test/extensions/quic_listeners/quiche/platform/quic_test_output_impl.cc +++ b/test/extensions/quic_listeners/quiche/platform/quic_test_output_impl.cc @@ -8,7 +8,7 @@ #include -#include "test/test_common/file_system_for_test.h" +#include "common/filesystem/filesystem_impl.h" #include "absl/time/clock.h" #include "absl/time/time.h" @@ -36,7 +36,7 @@ void QuicRecordTestOutputToFile(const std::string& filename, quiche::QuicheStrin output_dir += '/'; } - Envoy::Filesystem::Instance& file_system = Envoy::Filesystem::fileSystemForTest(); + Envoy::Filesystem::InstanceImplPosix file_system; if (!file_system.directoryExists(output_dir)) { QUIC_LOG(ERROR) << "Directory does not exist while writing test output: " << output_dir; return; @@ -87,7 +87,7 @@ bool QuicLoadTestOutputImpl(quiche::QuicheStringPiece filename, std::string* dat const std::string read_path = read_dir + filename.data(); - Envoy::Filesystem::Instance& file_system = Envoy::Filesystem::fileSystemForTest(); + Envoy::Filesystem::InstanceImplPosix file_system; if (!file_system.fileExists(read_path)) { QUIC_LOG(ERROR) << "Test output file does not exist: " << read_path; return false; diff --git a/test/extensions/quic_listeners/quiche/quic_io_handle_wrapper_test.cc b/test/extensions/quic_listeners/quiche/quic_io_handle_wrapper_test.cc index 63d2aef7b392..5eb1d9629d36 100644 --- a/test/extensions/quic_listeners/quiche/quic_io_handle_wrapper_test.cc +++ b/test/extensions/quic_listeners/quiche/quic_io_handle_wrapper_test.cc @@ -1,8 +1,8 @@ +#include + #include #include -#include "envoy/common/platform.h" - #include "common/network/address_impl.h" #include "extensions/quic_listeners/quiche/quic_io_handle_wrapper.h" diff --git a/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc b/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc index c2b3ea48542c..c35926dd4e5e 100644 --- a/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc +++ b/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc @@ -3,7 +3,6 @@ #include #include -#include "common/api/os_sys_calls_impl.h" #include "common/network/address_impl.h" #include "common/network/utility.h" @@ -56,8 +55,7 @@ TEST(UdpOverUdsStatsdSinkTest, InitWithPipeAddress) { // this uses low level networking calls because our abstractions in this area only work for IP // sockets. Revisit this also. auto io_handle = uds_address->socket(Network::Address::SocketType::Datagram); - RELEASE_ASSERT( - Api::OsSysCallsSingleton::get().setsocketblocking(io_handle->fd(), false).rc_ != -1, ""); + RELEASE_ASSERT(fcntl(io_handle->fd(), F_SETFL, 0) != -1, ""); uds_address->bind(io_handle->fd()); // Do the flush which should have somewhere to write now. diff --git a/test/extensions/tracers/common/ot/BUILD b/test/extensions/tracers/common/ot/BUILD index 76fd9d8b1378..fba078c13bbc 100644 --- a/test/extensions/tracers/common/ot/BUILD +++ b/test/extensions/tracers/common/ot/BUILD @@ -2,23 +2,17 @@ licenses(["notice"]) # Apache 2 load( "//bazel:envoy_build_system.bzl", + "envoy_cc_test", "envoy_package", ) -load( - "//test/extensions:extensions_build_system.bzl", - "envoy_extension_cc_test", -) envoy_package() -envoy_extension_cc_test( +envoy_cc_test( name = "opentracing_driver_impl_test", srcs = [ "opentracing_driver_impl_test.cc", ], - extension_name = "envoy.tracers.dynamic_ot", - # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions - tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/dynamic_ot:dynamic_opentracing_driver_lib", "//test/mocks/http:http_mocks", diff --git a/test/extensions/tracers/datadog/BUILD b/test/extensions/tracers/datadog/BUILD index 1e6b94c6e0f0..6ba8482ffdb5 100644 --- a/test/extensions/tracers/datadog/BUILD +++ b/test/extensions/tracers/datadog/BUILD @@ -17,8 +17,6 @@ envoy_extension_cc_test( "datadog_tracer_impl_test.cc", ], extension_name = "envoy.tracers.datadog", - # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions - tags = ["skip_on_windows"], deps = [ "//source/common/common:base64_lib", "//source/common/http:header_map_lib", @@ -42,8 +40,6 @@ envoy_extension_cc_test( name = "config_test", srcs = ["config_test.cc"], extension_name = "envoy.tracers.datadog", - # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions - tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/datadog:config", "//test/mocks/server:server_mocks", diff --git a/test/extensions/tracers/dynamic_ot/BUILD b/test/extensions/tracers/dynamic_ot/BUILD index 4037befe21f9..4a7382e0efc0 100644 --- a/test/extensions/tracers/dynamic_ot/BUILD +++ b/test/extensions/tracers/dynamic_ot/BUILD @@ -20,8 +20,6 @@ envoy_extension_cc_test( "@io_opentracing_cpp//mocktracer:libmocktracer_plugin.so", ], extension_name = "envoy.tracers.dynamic_ot", - # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions - tags = ["skip_on_windows"], deps = [ "//source/common/http:header_map_lib", "//source/extensions/tracers/dynamic_ot:dynamic_opentracing_driver_lib", @@ -39,8 +37,6 @@ envoy_extension_cc_test( "@io_opentracing_cpp//mocktracer:libmocktracer_plugin.so", ], extension_name = "envoy.tracers.dynamic_ot", - # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions - tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/dynamic_ot:config", "//test/mocks/server:server_mocks", diff --git a/test/extensions/tracers/lightstep/BUILD b/test/extensions/tracers/lightstep/BUILD index 40815b572d75..0d9ea91ba326 100644 --- a/test/extensions/tracers/lightstep/BUILD +++ b/test/extensions/tracers/lightstep/BUILD @@ -17,8 +17,6 @@ envoy_extension_cc_test( "lightstep_tracer_impl_test.cc", ], extension_name = "envoy.tracers.lightstep", - # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions - tags = ["skip_on_windows"], deps = [ "//source/common/common:base64_lib", "//source/common/http:header_map_lib", @@ -44,8 +42,6 @@ envoy_extension_cc_test( name = "config_test", srcs = ["config_test.cc"], extension_name = "envoy.tracers.lightstep", - # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions - tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/lightstep:config", "//test/mocks/server:server_mocks", diff --git a/test/extensions/tracers/opencensus/BUILD b/test/extensions/tracers/opencensus/BUILD index 9aa809b29f8d..01b231bc240b 100644 --- a/test/extensions/tracers/opencensus/BUILD +++ b/test/extensions/tracers/opencensus/BUILD @@ -15,8 +15,6 @@ envoy_extension_cc_test( name = "tracer_test", srcs = ["tracer_test.cc"], extension_name = "envoy.tracers.opencensus", - # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions - tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/opencensus:opencensus_tracer_impl", "//test/mocks/http:http_mocks", @@ -30,8 +28,6 @@ envoy_extension_cc_test( name = "config_test", srcs = ["config_test.cc"], extension_name = "envoy.tracers.opencensus", - # TODO(wrowe): envoy_extension_ rules don't currently exclude windows extensions - tags = ["skip_on_windows"], deps = [ "//source/extensions/tracers/opencensus:config", "//test/mocks/server:server_mocks", diff --git a/test/extensions/tracers/xray/tracer_test.cc b/test/extensions/tracers/xray/tracer_test.cc index ef7b721c565c..ae0dc558cb2d 100644 --- a/test/extensions/tracers/xray/tracer_test.cc +++ b/test/extensions/tracers/xray/tracer_test.cc @@ -52,7 +52,7 @@ TEST_F(XRayTracerTest, SerializeSpanTest) { constexpr auto expected_x_forwarded_for = "false"; constexpr auto expected_upstream_address = "10.0.0.200"; - auto on_send = [&](const std::string& json) { + auto on_send = [](const std::string& json) { ASSERT_FALSE(json.empty()); daemon::Segment s; MessageUtil::loadFromJson(json, s, ProtobufMessage::getNullValidationVisitor()); @@ -102,7 +102,7 @@ TEST_F(XRayTracerTest, ChildSpanHasParentInfo) { const XRay::Span* xray_parent_span = static_cast(parent_span.get()); const std::string expected_parent_id = xray_parent_span->Id(); - auto on_send = [&](const std::string& json) { + auto on_send = [xray_parent_span, expected_parent_id](const std::string& json) { ASSERT_FALSE(json.empty()); daemon::Segment s; MessageUtil::loadFromJson(json, s, ProtobufMessage::getNullValidationVisitor()); diff --git a/test/extensions/tracers/zipkin/tracer_test.cc b/test/extensions/tracers/zipkin/tracer_test.cc index 878af93da699..320c1df4e5ed 100644 --- a/test/extensions/tracers/zipkin/tracer_test.cc +++ b/test/extensions/tracers/zipkin/tracer_test.cc @@ -184,7 +184,7 @@ TEST_F(ZipkinTracerTest, SpanCreation) { ON_CALL(config, operationName()).WillByDefault(Return(Tracing::OperationName::Ingress)); TestRandomGenerator generator; - const uint64_t generated_parent_id = generator.random(); + const uint generated_parent_id = generator.random(); SpanContext modified_root_span_context(root_span_context.trace_id_high(), root_span_context.trace_id(), root_span_context.id(), generated_parent_id, root_span_context.sampled()); diff --git a/test/extensions/transport_sockets/tls/BUILD b/test/extensions/transport_sockets/tls/BUILD index bc1b9b9cbf0f..6e878a85d326 100644 --- a/test/extensions/transport_sockets/tls/BUILD +++ b/test/extensions/transport_sockets/tls/BUILD @@ -24,8 +24,6 @@ envoy_cc_test( ], external_deps = ["ssl"], shard_count = 4, - # TODO(wrowe): Diagnose timeout error on Windows (skipped for the moment) - tags = ["fails_on_windows"], deps = [ ":test_private_key_method_provider_test_lib", "//include/envoy/network:transport_socket_interface", diff --git a/test/integration/BUILD b/test/integration/BUILD index 19b7b26eea6f..24fbc6f4b806 100644 --- a/test/integration/BUILD +++ b/test/integration/BUILD @@ -127,8 +127,6 @@ envoy_cc_test( envoy_cc_test( name = "eds_integration_test", srcs = ["eds_integration_test.cc"], - # Times out on Windows - tags = ["fails_on_windows"], deps = [ ":http_integration_lib", "//source/common/upstream:load_balancer_lib", @@ -230,8 +228,6 @@ envoy_sh_test( "//test/config/integration:server_config_files", "//tools:socket_passing", ], - # Hot restart does not apply on Windows, skipping - tags = ["skip_on_windows"], ) envoy_sh_test( @@ -242,8 +238,6 @@ envoy_sh_test( "//source/exe:envoy-static", "//test/config/integration:server_config_files", ], - # TODO: This script invocation does not work on Windows, see: https://github.com/bazelbuild/bazel/issues/10959 - tags = ["fails_on_windows"], ) envoy_cc_test( @@ -583,8 +577,6 @@ envoy_cc_test( "integration_test.cc", "integration_test.h", ], - # Times out on Windows - tags = ["fails_on_windows"], deps = [ ":http_integration_lib", "//source/common/http:header_map_lib", @@ -623,8 +615,6 @@ envoy_cc_test( "websocket_integration_test.cc", "websocket_integration_test.h", ], - # Times out on Windows - tags = ["fails_on_windows"], deps = [ ":http_protocol_integration_lib", "//source/common/http:header_map_lib", @@ -641,15 +631,9 @@ envoy_cc_test( srcs = [ "echo_integration_test.cc", ], - tags = [ - # Uncomment this line to run this test repeatedly in exclusive mode if not using docker-sandbox, - # or RBE, see comments in AddRemoveListener. - # "exclusive", - # TODO(wrowe,sunjayBhatia): Skipping this on Windows as MSVC does not allow invoking - # connection.close() from within the lambda that is passed to the RawConnectionDriver - # constructor - "skip_on_windows", - ], + # Uncomment this line to run this test repeatedly in exclusive mode if not using docker-sandbox, + # or RBE, see comments in AddRemoveListener. + # tags = ["exclusive"], deps = [ ":integration_lib", "//source/extensions/filters/network/echo:config", diff --git a/test/integration/tcp_dump.cc b/test/integration/tcp_dump.cc index b8d7c8486156..95cd8b55c0e0 100644 --- a/test/integration/tcp_dump.cc +++ b/test/integration/tcp_dump.cc @@ -1,12 +1,12 @@ #include "test/integration/tcp_dump.h" #include +#include +#include #include #include -#include "envoy/common/platform.h" - #include "common/common/assert.h" #include "common/common/fmt.h" @@ -14,9 +14,6 @@ namespace Envoy { TcpDump::TcpDump(const std::string& path, const std::string& iface, const std::vector& ports) { -#ifdef WIN32 - ENVOY_LOG_MISC(debug, "tcpdump not supported on windows"); -#else // Remove any extant pcap file. ::unlink(path.c_str()); // Derive the port filter expression. @@ -63,11 +60,9 @@ TcpDump::TcpDump(const std::string& path, const std::string& iface, // Give 50ms sleep. ::usleep(50000); } -#endif } TcpDump::~TcpDump() { -#ifndef WIN32 if (tcpdump_pid_ > 0) { RELEASE_ASSERT(::kill(tcpdump_pid_, SIGINT) == 0, ""); int status; @@ -76,7 +71,6 @@ TcpDump::~TcpDump() { RELEASE_ASSERT(WEXITSTATUS(status) == 0, ""); ENVOY_LOG_MISC(debug, "tcpdump terminated"); } -#endif } } // namespace Envoy diff --git a/test/main.cc b/test/main.cc index 06f87f6239e1..132b9e8ae990 100644 --- a/test/main.cc +++ b/test/main.cc @@ -13,32 +13,10 @@ #include "tools/cpp/runfiles/runfiles.h" -#if defined(WIN32) -static void noop_invalid_parameter_handler(const wchar_t* expression, const wchar_t* function, - const wchar_t* file, unsigned int line, - uintptr_t pReserved) { - return; -} -#endif - using bazel::tools::cpp::runfiles::Runfiles; // The main entry point (and the rest of this file) should have no logic in it, // this allows overriding by site specific versions of main.cc. int main(int argc, char** argv) { -#if defined(WIN32) - _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); - - _set_invalid_parameter_handler(noop_invalid_parameter_handler); - - WORD wVersionRequested; - WSADATA wsaData; - int err; - - wVersionRequested = MAKEWORD(2, 2); - - RELEASE_ASSERT(WSAStartup(wVersionRequested, &wsaData) == 0, ""); -#endif - #ifndef __APPLE__ absl::InitializeSymbolizer(argv[0]); #endif diff --git a/test/mocks/network/io_handle.h b/test/mocks/network/io_handle.h index 460d90f7c428..787ea202f464 100644 --- a/test/mocks/network/io_handle.h +++ b/test/mocks/network/io_handle.h @@ -13,7 +13,7 @@ class MockIoHandle : public IoHandle { MockIoHandle(); ~MockIoHandle() override; - MOCK_METHOD(os_fd_t, fd, (), (const)); + MOCK_METHOD(int, fd, (), (const)); MOCK_METHOD(Api::IoCallUint64Result, close, ()); MOCK_METHOD(bool, isOpen, (), (const)); MOCK_METHOD(Api::IoCallUint64Result, readv, diff --git a/test/server/BUILD b/test/server/BUILD index eb90f57bfaaa..e3c1cdaa06e7 100644 --- a/test/server/BUILD +++ b/test/server/BUILD @@ -10,8 +10,10 @@ load( "envoy_package", "envoy_select_hot_restart", ) -load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") -load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") +load( + "//source/extensions:all_extensions.bzl", + "envoy_all_extensions", +) envoy_package() @@ -252,11 +254,7 @@ envoy_cc_test( envoy_cc_test( name = "listener_manager_impl_quic_only_test", srcs = ["listener_manager_impl_quic_only_test.cc"], - tags = [ - "nofips", - # Skipping as quiche quic_stream_send_buffer.cc does not currently compile on Windows - "skip_on_windows", - ], + tags = ["nofips"], deps = [ ":listener_manager_impl_test_lib", ":utility_lib", @@ -313,11 +311,7 @@ envoy_cc_fuzz_test( "//test/mocks/stats:stats_mocks", "//test/test_common:environment_lib", "//test/test_common:test_time_lib", - ] + select({ - "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), - "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), - "//conditions:default": envoy_all_extensions(), - }), + ] + envoy_all_extensions(), ) filegroup( diff --git a/test/server/config_validation/BUILD b/test/server/config_validation/BUILD index f785888ac01c..e00f954dc3df 100644 --- a/test/server/config_validation/BUILD +++ b/test/server/config_validation/BUILD @@ -1,8 +1,10 @@ licenses(["notice"]) # Apache 2 load("//bazel:envoy_build_system.bzl", "envoy_cc_fuzz_test", "envoy_cc_test", "envoy_package") -load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") -load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") +load( + "//source/extensions:all_extensions.bzl", + "envoy_all_extensions", +) envoy_package() @@ -93,9 +95,5 @@ envoy_cc_fuzz_test( "//test/integration:integration_lib", "//test/mocks/server:server_mocks", "//test/test_common:environment_lib", - ] + select({ - "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), - "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), - "//conditions:default": envoy_all_extensions(), - }), + ] + envoy_all_extensions(), ) diff --git a/test/server/listener_manager_impl_test.cc b/test/server/listener_manager_impl_test.cc index 419f2dd1162f..c2713bcc48b4 100644 --- a/test/server/listener_manager_impl_test.cc +++ b/test/server/listener_manager_impl_test.cc @@ -461,7 +461,7 @@ TEST_F(ListenerManagerImplWithRealFiltersTest, StatsScopeTest) { config: {} )EOF"; - EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, ListenSocketCreationParams(false))); + EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, {false})); manager_->addOrUpdateListener(parseListenerFromV2Yaml(yaml), "", true); manager_->listeners().front().get().listenerScope().counterFromString("foo").inc(); @@ -1229,7 +1229,7 @@ name: foo ASSERT_TRUE(SOCKET_VALID(syscall_result.rc_)); ListenerHandle* listener_foo = expectListenerCreate(true, true); - EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, ListenSocketCreationParams(false))) + EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, {false})) .WillOnce(Invoke([this, &syscall_result, &real_listener_factory]( const Network::Address::InstanceConstSharedPtr& address, Network::Address::SocketType socket_type, @@ -1787,7 +1787,7 @@ name: foo )EOF"; ListenerHandle* listener_foo = expectListenerCreate(true, true); - EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, ListenSocketCreationParams(false))); + EXPECT_CALL(listener_factory_, createListenSocket(_, _, _, {false})); EXPECT_CALL(listener_foo->target_, initialize()); EXPECT_TRUE(manager_->addOrUpdateListener(parseListenerFromV2Yaml(listener_foo_yaml), "", true)); @@ -3341,7 +3341,7 @@ TEST_F(ListenerManagerImplWithRealFiltersTest, OriginalDstFilter) { } class OriginalDstTestFilter : public Extensions::ListenerFilters::OriginalDst::OriginalDstFilter { - Network::Address::InstanceConstSharedPtr getOriginalDst(os_fd_t) override { + Network::Address::InstanceConstSharedPtr getOriginalDst(int) override { return Network::Address::InstanceConstSharedPtr{ new Network::Address::Ipv4Instance("127.0.0.2", 2345)}; } @@ -3415,7 +3415,7 @@ TEST_F(ListenerManagerImplWithRealFiltersTest, OriginalDstTestFilter) { class OriginalDstTestFilterIPv6 : public Extensions::ListenerFilters::OriginalDst::OriginalDstFilter { - Network::Address::InstanceConstSharedPtr getOriginalDst(os_fd_t) override { + Network::Address::InstanceConstSharedPtr getOriginalDst(int) override { return Network::Address::InstanceConstSharedPtr{ new Network::Address::Ipv6Instance("1::2", 2345)}; } diff --git a/test/server/listener_manager_impl_test.h b/test/server/listener_manager_impl_test.h index 49a29cc4a6dc..2ab79f6f487b 100644 --- a/test/server/listener_manager_impl_test.h +++ b/test/server/listener_manager_impl_test.h @@ -193,7 +193,7 @@ class ListenerManagerImplTest : public testing::Test { setsockopt_(_, expected_sockopt_level, expected_sockopt_name, _, sizeof(int))) .Times(expected_num_calls) .WillRepeatedly( - Invoke([expected_value](os_fd_t, int, int, const void* optval, socklen_t) -> int { + Invoke([expected_value](int, int, int, const void* optval, socklen_t) -> int { EXPECT_EQ(expected_value, *static_cast(optval)); return 0; })); diff --git a/test/server/server_test.cc b/test/server/server_test.cc index 6c8a9798c8b9..7bca3cbf697e 100644 --- a/test/server/server_test.cc +++ b/test/server/server_test.cc @@ -86,12 +86,10 @@ class RunHelperTest : public testing::Test { RunHelperTest() { InSequence s; -#ifndef WIN32 sigterm_ = new Event::MockSignalEvent(&dispatcher_); sigint_ = new Event::MockSignalEvent(&dispatcher_); sigusr1_ = new Event::MockSignalEvent(&dispatcher_); sighup_ = new Event::MockSignalEvent(&dispatcher_); -#endif EXPECT_CALL(overload_manager_, start()); EXPECT_CALL(cm_, setInitializedCb(_)).WillOnce(SaveArg<0>(&cm_init_callback_)); ON_CALL(server_, shutdown()).WillByDefault(Assign(&shutdown_, true)); @@ -111,12 +109,10 @@ class RunHelperTest : public testing::Test { ReadyWatcher start_workers_; std::unique_ptr helper_; std::function cm_init_callback_; -#ifndef WIN32 Event::MockSignalEvent* sigterm_; Event::MockSignalEvent* sigint_; Event::MockSignalEvent* sigusr1_; Event::MockSignalEvent* sighup_; -#endif bool shutdown_ = false; }; @@ -125,18 +121,13 @@ TEST_F(RunHelperTest, Normal) { cm_init_callback_(); } -// no signals on Windows -#ifndef WIN32 TEST_F(RunHelperTest, ShutdownBeforeCmInitialize) { EXPECT_CALL(start_workers_, ready()).Times(0); sigterm_->callback_(); EXPECT_CALL(server_, isShutdown()).WillOnce(Return(shutdown_)); cm_init_callback_(); } -#endif -// no signals on Windows -#ifndef WIN32 TEST_F(RunHelperTest, ShutdownBeforeInitManagerInit) { EXPECT_CALL(start_workers_, ready()).Times(0); Init::ExpectableTargetImpl target; @@ -147,7 +138,6 @@ TEST_F(RunHelperTest, ShutdownBeforeInitManagerInit) { EXPECT_CALL(server_, isShutdown()).WillOnce(Return(shutdown_)); target.ready(); } -#endif class InitializingInitManager : public Init::ManagerImpl { public: diff --git a/test/tools/router_check/test/BUILD b/test/tools/router_check/test/BUILD index 4e8e7f8885b8..9ed7a3c3fe6e 100644 --- a/test/tools/router_check/test/BUILD +++ b/test/tools/router_check/test/BUILD @@ -15,8 +15,6 @@ envoy_sh_test( ":configs", "//test/tools/router_check:router_check_tool", ], - # TODO: This script invocation does not work on Windows, see: https://github.com/bazelbuild/bazel/issues/10959 - tags = ["fails_on_windows"], ) filegroup( diff --git a/test/tools/type_whisperer/BUILD b/test/tools/type_whisperer/BUILD index 5d2787128058..281d75874102 100644 --- a/test/tools/type_whisperer/BUILD +++ b/test/tools/type_whisperer/BUILD @@ -7,7 +7,5 @@ envoy_package() envoy_cc_test( name = "api_type_db_test", srcs = ["api_type_db_test.cc"], - # MSVC does not allow strings over a certain length, see error C2026 - tags = ["skip_on_windows"], deps = ["//tools/type_whisperer:api_type_db_lib"], ) From e77b7a3317c939a9ecbc0971be582dbd6b596de1 Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Thu, 16 Apr 2020 23:51:54 -0400 Subject: [PATCH 36/42] Restore WINDOWS_SKIP_TARGETS logic to PR 10542 This logic applies to the build schema for Windows, not specific windows test fixes and exclusions. Signed-off-by: William A Rowe Jr Co-authored-by: William A Rowe Jr Co-authored-by: Sunjay Bhatia --- test/config_test/BUILD | 12 +++++++----- test/server/BUILD | 12 +++++++----- test/server/config_validation/BUILD | 12 +++++++----- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/test/config_test/BUILD b/test/config_test/BUILD index 494341c4b6fd..a00de6bb96c4 100644 --- a/test/config_test/BUILD +++ b/test/config_test/BUILD @@ -6,10 +6,8 @@ load( "envoy_cc_test_library", "envoy_package", ) -load( - "//source/extensions:all_extensions.bzl", - "envoy_all_extensions", -) +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") envoy_package() @@ -45,5 +43,9 @@ envoy_cc_test_library( "//test/mocks/ssl:ssl_mocks", "//test/test_common:threadsafe_singleton_injector_lib", "//test/test_common:simulated_time_system_lib", - ] + envoy_all_extensions(), + ] + select({ + "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), + "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), + "//conditions:default": envoy_all_extensions(), + }), ) diff --git a/test/server/BUILD b/test/server/BUILD index e3c1cdaa06e7..6dded97d08a3 100644 --- a/test/server/BUILD +++ b/test/server/BUILD @@ -10,10 +10,8 @@ load( "envoy_package", "envoy_select_hot_restart", ) -load( - "//source/extensions:all_extensions.bzl", - "envoy_all_extensions", -) +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") envoy_package() @@ -311,7 +309,11 @@ envoy_cc_fuzz_test( "//test/mocks/stats:stats_mocks", "//test/test_common:environment_lib", "//test/test_common:test_time_lib", - ] + envoy_all_extensions(), + ] + select({ + "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), + "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), + "//conditions:default": envoy_all_extensions(), + }), ) filegroup( diff --git a/test/server/config_validation/BUILD b/test/server/config_validation/BUILD index e00f954dc3df..f785888ac01c 100644 --- a/test/server/config_validation/BUILD +++ b/test/server/config_validation/BUILD @@ -1,10 +1,8 @@ licenses(["notice"]) # Apache 2 load("//bazel:envoy_build_system.bzl", "envoy_cc_fuzz_test", "envoy_cc_test", "envoy_package") -load( - "//source/extensions:all_extensions.bzl", - "envoy_all_extensions", -) +load("//source/extensions:all_extensions.bzl", "envoy_all_extensions") +load("//bazel:repositories.bzl", "PPC_SKIP_TARGETS", "WINDOWS_SKIP_TARGETS") envoy_package() @@ -95,5 +93,9 @@ envoy_cc_fuzz_test( "//test/integration:integration_lib", "//test/mocks/server:server_mocks", "//test/test_common:environment_lib", - ] + envoy_all_extensions(), + ] + select({ + "//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS), + "//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS), + "//conditions:default": envoy_all_extensions(), + }), ) From 9eda28a22ad60215c71c2182dc76709d5c0eacbb Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Fri, 17 Apr 2020 09:57:18 -0400 Subject: [PATCH 37/42] Kick CI Signed-off-by: Sunjay Bhatia From 1b492681978e25ce5f07f08a2244965d70da388a Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Sat, 18 Apr 2020 19:58:11 -0400 Subject: [PATCH 38/42] Restore some variables tweaked for successful builds Signed-off-by: William A Rowe Jr --- .azure-pipelines/pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.azure-pipelines/pipelines.yml b/.azure-pipelines/pipelines.yml index bc049adabd73..494cb9da1c71 100644 --- a/.azure-pipelines/pipelines.yml +++ b/.azure-pipelines/pipelines.yml @@ -149,3 +149,5 @@ jobs: BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey) + MSYS2_ARG_CONV_EXCL: "*" + TMPDIR: $(Agent.TempDirectory) From aef5e0338c903e102de5f96604b92edfa742247a Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Mon, 20 Apr 2020 09:58:24 -0400 Subject: [PATCH 39/42] Fix BAZEL_SH in Windows pipeline job Signed-off-by: Sunjay Bhatia --- .azure-pipelines/pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/pipelines.yml b/.azure-pipelines/pipelines.yml index 494cb9da1c71..3395229a721c 100644 --- a/.azure-pipelines/pipelines.yml +++ b/.azure-pipelines/pipelines.yml @@ -145,7 +145,7 @@ jobs: displayName: "Run Windows CI" env: BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC" - BAZEL_SH: "C:\\Program Files\\Git\\bin\\bash.exe" + BAZEL_SH: $(Pipeline.Workspace)/bin/usr/bin/bash.exe BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey) From 44ab8f58b7cb524aa6a4223453272cf12c53f48e Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Mon, 20 Apr 2020 12:18:57 -0400 Subject: [PATCH 40/42] Retest for macOS Signed-off-by: Sunjay Bhatia Co-authored-by: William Rowe From bdc19bbe8dc9b7c795831f9e45d13044eaf9303b Mon Sep 17 00:00:00 2001 From: William A Rowe Jr Date: Tue, 21 Apr 2020 04:38:29 -0400 Subject: [PATCH 41/42] snakeCase not hungarian as requested for PR 10822 by mattklein123 Signed-off-by: William A Rowe Jr --- source/exe/win32/platform_impl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/exe/win32/platform_impl.cc b/source/exe/win32/platform_impl.cc index b6791d703c3a..ce20aebd59e8 100644 --- a/source/exe/win32/platform_impl.cc +++ b/source/exe/win32/platform_impl.cc @@ -9,9 +9,9 @@ namespace Envoy { PlatformImpl::PlatformImpl() : thread_factory_(std::make_unique()), file_system_(std::make_unique()) { - const WORD wVersionRequested = MAKEWORD(2, 2); WSADATA wsaData; - RELEASE_ASSERT(WSAStartup(wVersionRequested, &wsaData) == 0, "WSAStartup failed with error"); + const WORD versionRequested = MAKEWORD(2, 2); + RELEASE_ASSERT(WSAStartup(versionRequested, &wsaData) == 0, "WSAStartup failed with error"); } PlatformImpl::~PlatformImpl() { ::WSACleanup(); } From cc4d1c891f1b27db3e733437362cb2edf35f3d5a Mon Sep 17 00:00:00 2001 From: Sunjay Bhatia Date: Tue, 21 Apr 2020 10:14:06 -0400 Subject: [PATCH 42/42] snake_case is with underscores Signed-off-by: Sunjay Bhatia --- source/exe/win32/platform_impl.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/exe/win32/platform_impl.cc b/source/exe/win32/platform_impl.cc index ce20aebd59e8..ffedb3f478f6 100644 --- a/source/exe/win32/platform_impl.cc +++ b/source/exe/win32/platform_impl.cc @@ -9,9 +9,9 @@ namespace Envoy { PlatformImpl::PlatformImpl() : thread_factory_(std::make_unique()), file_system_(std::make_unique()) { - WSADATA wsaData; - const WORD versionRequested = MAKEWORD(2, 2); - RELEASE_ASSERT(WSAStartup(versionRequested, &wsaData) == 0, "WSAStartup failed with error"); + WSADATA wsa_data; + const WORD version_requested = MAKEWORD(2, 2); + RELEASE_ASSERT(WSAStartup(version_requested, &wsa_data) == 0, "WSAStartup failed with error"); } PlatformImpl::~PlatformImpl() { ::WSACleanup(); }