diff --git a/.bazelrc b/.bazelrc index 7832a4b80126..eff468555e2e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -322,6 +322,12 @@ build:clang-cl --define clang_cl=1 # Override determinism flags (DATE etc) is valid on clang-cl compiler build:clang-cl --copt="-Wno-macro-redefined" build:clang-cl --copt="-Wno-builtin-macro-redefined" +# Workaround problematic missing override declarations of mocks +# TODO: resolve this class of problematic mocks, e.g. +# ./test/mocks/http/stream.h(16,21): error: 'addCallbacks' +# overrides a member function but is not marked 'override' +# MOCK_METHOD(void, addCallbacks, (StreamCallbacks & callbacks)); +build:clang-cl --copt="-Wno-inconsistent-missing-override" build:clang-cl --action_env=USE_CLANG_CL=1 # Defaults to 'auto' - Off for windows, so override to linux behavior diff --git a/bazel/BUILD b/bazel/BUILD index 8f1b7f605278..55dca812b2ed 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -84,6 +84,14 @@ config_setting( }, ) +config_setting( + name = "clang_cl_build", + values = { + "cpu": "x64_windows", + "define": "clang_cl=1", + }, +) + config_setting( name = "clang_cl_opt_build", values = { diff --git a/bazel/envoy_binary.bzl b/bazel/envoy_binary.bzl index d966bdf5a104..2808d3d38946 100644 --- a/bazel/envoy_binary.bzl +++ b/bazel/envoy_binary.bzl @@ -60,7 +60,7 @@ def _envoy_linkopts(): "-pagezero_size 10000", "-image_base 100000000", ], - "@envoy//bazel:clang_cl_opt_build": [ + "@envoy//bazel:windows_opt_build": [ "-DEFAULTLIB:ws2_32.lib", "-DEFAULTLIB:iphlpapi.lib", "-DEBUG:FULL", diff --git a/bazel/envoy_internal.bzl b/bazel/envoy_internal.bzl index c122e36cd9c7..221ebc725ea5 100644 --- a/bazel/envoy_internal.bzl +++ b/bazel/envoy_internal.bzl @@ -34,37 +34,44 @@ def envoy_copts(repository, test = False): "-DNOIME", "-DNOCRYPT", # Ignore unguarded gcc pragmas in quiche (unrecognized by MSVC) - # TODO(wrowe,sunjayBhatia): Drop this change when fixed in bazel/external/quiche.genrule_cmd "-wd4068", # Silence incorrect MSVC compiler warnings when converting between std::optional # data types (while conversions between primitive types are producing no error) "-wd4244", # Allow inline functions to be undefined "-wd4506", - # Allow 'nodiscard' function return values to be discarded - # TODO(wrowe,sunjayBhatia): Drop this option when all causes are fixed - "-wd4834", ] return select({ repository + "//bazel:windows_x86_64": msvc_options, "//conditions:default": posix_options, }) + select({ - # Bazel adds an implicit -DNDEBUG for opt. + # Simplify the amount of symbolic debug info for test binaries, since + # debugging info detailing some 1600 test binaries would be wasteful. + # targets listed in order from generic to increasing specificity. + # Bazel adds an implicit -DNDEBUG for opt targets. repository + "//bazel:opt_build": [] if test else ["-ggdb3", "-gsplit-dwarf"], repository + "//bazel:fastbuild_build": [], repository + "//bazel:dbg_build": ["-ggdb3", "-gsplit-dwarf"], - repository + "//bazel:windows_opt_build": [], + repository + "//bazel:windows_opt_build": [] if test else ["-Z7"], repository + "//bazel:windows_fastbuild_build": [], repository + "//bazel:windows_dbg_build": [], repository + "//bazel:clang_cl_opt_build": [] if test else ["-Z7", "-fstandalone-debug"], repository + "//bazel:clang_cl_fastbuild_build": ["-fno-standalone-debug"], repository + "//bazel:clang_cl_dbg_build": ["-fstandalone-debug"], }) + select({ - repository + "//bazel:clang_build": ["-fno-limit-debug-info", "-Wgnu-conditional-omitted-operand", "-Wc++2a-extensions", "-Wrange-loop-analysis"], + # Toggle expected features and warnings by compiler + repository + "//bazel:clang_build": [ + "-fno-limit-debug-info", + "-Wgnu-conditional-omitted-operand", + "-Wc++2a-extensions", + "-Wrange-loop-analysis", + ], repository + "//bazel:gcc_build": ["-Wno-maybe-uninitialized"], - # TODO: Replace with /Zc:preprocessor for cl.exe versions >= 16.5 - repository + "//bazel:windows_x86_64": ["-experimental:preprocessor", "-Wv:19.4"], + # Allow 'nodiscard' function results values to be discarded for test code only + # TODO(envoyproxy/windows-dev): Replace with /Zc:preprocessor for cl.exe versions >= 16.5 + repository + "//bazel:windows_x86_64": ["-wd4834", "-experimental:preprocessor", "-Wv:19.4"] if test else ["-experimental:preprocessor", "-Wv:19.4"], + repository + "//bazel:clang_cl_build": ["-Wno-unused-result"] if test else [], "//conditions:default": [], }) + select({ repository + "//bazel:no_debug_info": ["-g0"], diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index a5c61cc113cc..02f98f9a8d8f 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -537,11 +537,11 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_desc = "Bazel rules for the C++ language", project_url = "https://github.com/bazelbuild/rules_cc", # TODO(lizan): pin to a point releases when there's a released version. - version = "818289e5613731ae410efb54218a4077fb9dbb03", - sha256 = "9d48151ea71b3e225adfb6867e6d2c7d0dce46cbdc8710d9a9a628574dfd40a0", + version = "b1c40e1de81913a3c40e5948f78719c28152486d", + sha256 = "71d037168733f26d2a9648ad066ee8da4a34a13f51d24843a42efa6b65c2420f", strip_prefix = "rules_cc-{version}", urls = ["https://github.com/bazelbuild/rules_cc/archive/{version}.tar.gz"], - release_date = "2020-05-13", + release_date = "2020-11-11", use_category = ["build"], ), rules_foreign_cc = dict( diff --git a/ci/windows_ci_steps.sh b/ci/windows_ci_steps.sh index 91e5cf39cfa3..076d0f557c33 100755 --- a/ci/windows_ci_steps.sh +++ b/ci/windows_ci_steps.sh @@ -79,6 +79,6 @@ bazel "${BAZEL_STARTUP_OPTIONS[@]}" test "${BAZEL_BUILD_OPTIONS[@]}" //test/... bazel "${BAZEL_STARTUP_OPTIONS[@]}" build "${BAZEL_BUILD_OPTIONS[@]}" //test/... --test_tag_filters=-skip_on_windows,fails_on_windows,flaky_on_windows --build_tests_only # Summarize tests bypasssed to monitor the progress of porting to Windows -echo "Tests bypassed as skip_on_windows: $(bazel query 'kind(".*test rule", attr("tags", "skip_on_windows", //test/...))' 2>/dev/null | sort | wc -l) known unbuildable or inapplicable tests" -echo "Tests bypassed as fails_on_windows: $(bazel query 'kind(".*test rule", attr("tags", "fails_on_windows", //test/...))' 2>/dev/null | sort | wc -l) known incompatible tests" -echo "Tests bypassed as flaky_on_windows: $(bazel query 'kind(".*test rule", attr("tags", "flaky_on_windows", //test/...))' 2>/dev/null | sort | wc -l) known unstable tests" +echo "Tests bypassed as skip_on_windows: $(bazel "${BAZEL_STARTUP_OPTIONS[@]}" query 'kind(".*test rule", attr("tags", "skip_on_windows", //test/...))' 2>/dev/null | sort | wc -l) known unbuildable or inapplicable tests" +echo "Tests bypassed as fails_on_windows: $(bazel "${BAZEL_STARTUP_OPTIONS[@]}" query 'kind(".*test rule", attr("tags", "fails_on_windows", //test/...))' 2>/dev/null | sort | wc -l) known incompatible tests" +echo "Tests bypassed as flaky_on_windows: $(bazel "${BAZEL_STARTUP_OPTIONS[@]}" query 'kind(".*test rule", attr("tags", "flaky_on_windows", //test/...))' 2>/dev/null | sort | wc -l) known unstable tests" diff --git a/source/extensions/clusters/redis/redis_cluster.cc b/source/extensions/clusters/redis/redis_cluster.cc index 3905398257a3..673bffa67705 100644 --- a/source/extensions/clusters/redis/redis_cluster.cc +++ b/source/extensions/clusters/redis/redis_cluster.cc @@ -274,8 +274,7 @@ void RedisCluster::RedisDiscoverySession::startResolveRedis() { Upstream::HostSharedPtr host; if (parent_.hosts_.empty()) { const int rand_idx = parent_.random_.random() % discovery_address_list_.size(); - auto it = discovery_address_list_.begin(); - std::next(it, rand_idx); + auto it = std::next(discovery_address_list_.begin(), rand_idx); host = Upstream::HostSharedPtr{ new RedisHost(parent_.info(), "", *it, parent_, true, parent_.timeSource())}; } else { diff --git a/test/common/network/BUILD b/test/common/network/BUILD index 29be5a7f4e52..789915d03cc1 100644 --- a/test/common/network/BUILD +++ b/test/common/network/BUILD @@ -286,10 +286,8 @@ envoy_cc_test( envoy_cc_test( name = "udp_listener_impl_batch_writer_test", srcs = ["udp_listener_impl_batch_writer_test.cc"], - tags = [ - # Skipping as quiche quic_gso_batch_writer.h does not exist on Windows - "skip_on_windows", - ], + # Skipping as quiche quic_gso_batch_writer.h does not exist on Windows + tags = ["skip_on_windows"], deps = [ ":udp_listener_impl_test_base_lib", "//source/common/event:dispatcher_lib", diff --git a/test/common/network/cidr_range_test.cc b/test/common/network/cidr_range_test.cc index 5a30bf6cd18e..a33c5426ba68 100644 --- a/test/common/network/cidr_range_test.cc +++ b/test/common/network/cidr_range_test.cc @@ -68,7 +68,6 @@ TEST(TruncateIpAddressAndLength, Various) { {{"ffff::ffff", 128}, {"ffff::ffff", 128}}, {{"ffff::ffff", 999}, {"ffff::ffff", 128}}, }; - test_cases.size(); for (const auto& kv : test_cases) { InstanceConstSharedPtr inPtr = Utility::parseInternetAddress(kv.first.first); EXPECT_NE(inPtr, nullptr) << kv.first.first; diff --git a/test/common/network/socket_option_factory_test.cc b/test/common/network/socket_option_factory_test.cc index 7ca08149bd93..b25894f27cb5 100644 --- a/test/common/network/socket_option_factory_test.cc +++ b/test/common/network/socket_option_factory_test.cc @@ -24,8 +24,8 @@ class SocketOptionFactoryTest : public testing::Test { TestThreadsafeSingletonInjector os_calls_{[this]() { // Before injecting OsSysCallsImpl, make sure validateIpv{4,6}Supported is called so the static // bool is initialized without requiring to mock ::socket and ::close. :( :( - std::make_unique("1.2.3.4", 5678); - std::make_unique("::1:2:3:4", 5678); + (void)std::make_unique("1.2.3.4", 5678); + (void)std::make_unique("::1:2:3:4", 5678); return &os_sys_calls_mock_; }()}; diff --git a/test/common/network/socket_option_test.h b/test/common/network/socket_option_test.h index af50690af6cb..ed6c4568061d 100644 --- a/test/common/network/socket_option_test.h +++ b/test/common/network/socket_option_test.h @@ -65,8 +65,8 @@ class SocketOptionTest : public testing::Test { TestThreadsafeSingletonInjector os_calls_{[this]() { // Before injecting OsSysCallsImpl, make sure validateIpv{4,6}Supported is called so the static // bool is initialized without requiring to mock ::socket and ::close. - std::make_unique("1.2.3.4", 5678); - std::make_unique("::1:2:3:4", 5678); + (void)std::make_unique("1.2.3.4", 5678); + (void)std::make_unique("::1:2:3:4", 5678); return &os_sys_calls_; }()}; diff --git a/test/extensions/filters/http/dynamic_forward_proxy/BUILD b/test/extensions/filters/http/dynamic_forward_proxy/BUILD index d2843e5dd369..95a296e8ae03 100644 --- a/test/extensions/filters/http/dynamic_forward_proxy/BUILD +++ b/test/extensions/filters/http/dynamic_forward_proxy/BUILD @@ -51,6 +51,8 @@ envoy_extension_cc_test( "//test/config/integration/certs", ], extension_name = "envoy.filters.http.dynamic_forward_proxy", + # TODO(envoyproxy/windows-dev): Diagnose flake in msvc-cl pipeline, observed timeout in + # IpVersions/ProxyFilterIntegrationTest.ReloadClusterAndAttachToCache/IPv6 tags = ["flaky_on_windows"], deps = [ "//source/extensions/clusters/dynamic_forward_proxy:cluster", diff --git a/test/extensions/filters/http/ratelimit/BUILD b/test/extensions/filters/http/ratelimit/BUILD index f5bd1b2b7201..1ebe44f4c26b 100644 --- a/test/extensions/filters/http/ratelimit/BUILD +++ b/test/extensions/filters/http/ratelimit/BUILD @@ -51,8 +51,6 @@ envoy_extension_cc_test( name = "ratelimit_integration_test", srcs = ["ratelimit_integration_test.cc"], extension_name = "envoy.filters.http.ratelimit", - # TODO(envoyproxy/windows-dev): Apparently resolved by Level Events PR #13787 - tags = ["flaky_on_windows"], deps = [ "//source/common/buffer:zero_copy_input_stream_lib", "//source/common/grpc:codec_lib", diff --git a/test/extensions/filters/http/tap/BUILD b/test/extensions/filters/http/tap/BUILD index ff491cc643da..c0092da8c2e3 100644 --- a/test/extensions/filters/http/tap/BUILD +++ b/test/extensions/filters/http/tap/BUILD @@ -52,6 +52,9 @@ envoy_extension_cc_test( name = "tap_filter_integration_test", srcs = ["tap_filter_integration_test.cc"], extension_name = "envoy.filters.http.tap", + # TODO(envoyproxy/windows-dev): Diagnose flake, observed to hang at; + # IpVersions/TapIntegrationTest.AdminLdsReload/IPv6 + tags = ["flaky_on_windows"], deps = [ "//source/extensions/filters/http/tap:config", "//test/extensions/common/tap:common", diff --git a/test/extensions/quic_listeners/quiche/BUILD b/test/extensions/quic_listeners/quiche/BUILD index 4375b705ca7d..5a3c0029deb6 100644 --- a/test/extensions/quic_listeners/quiche/BUILD +++ b/test/extensions/quic_listeners/quiche/BUILD @@ -164,10 +164,7 @@ envoy_cc_test( envoy_cc_test( name = "active_quic_listener_test", srcs = ["active_quic_listener_test.cc"], - tags = [ - "fails_on_windows", - "nofips", - ], + tags = ["nofips"], deps = [ ":quic_test_utils_for_envoy_lib", ":test_utils_lib", diff --git a/test/extensions/stats_sinks/metrics_service/BUILD b/test/extensions/stats_sinks/metrics_service/BUILD index cbc6820bf66e..20c0b58c158a 100644 --- a/test/extensions/stats_sinks/metrics_service/BUILD +++ b/test/extensions/stats_sinks/metrics_service/BUILD @@ -45,8 +45,6 @@ envoy_extension_cc_test( name = "metrics_service_integration_test", srcs = ["metrics_service_integration_test.cc"], extension_name = "envoy.stat_sinks.metrics_service", - # TODO(envoyproxy/windows-dev): Apparently resolved by Level Events PR #13787 - tags = ["flaky_on_windows"], deps = [ "//source/common/buffer:zero_copy_input_stream_lib", "//source/common/grpc:codec_lib", diff --git a/test/extensions/transport_sockets/tls/ssl_socket_test.cc b/test/extensions/transport_sockets/tls/ssl_socket_test.cc index 774b57116d58..3d4279edd82e 100644 --- a/test/extensions/transport_sockets/tls/ssl_socket_test.cc +++ b/test/extensions/transport_sockets/tls/ssl_socket_test.cc @@ -398,23 +398,17 @@ void testUtil(const TestUtilOptions& options) { server_connection->ssl()->subjectLocalCertificate()); } if (!options.expectedPeerCert().empty()) { - std::string urlencoded = - absl::StrReplaceAll(options.expectedPeerCert(), {{TestEnvironment::newLine, "%0A"}, - {" ", "%20"}, - {"+", "%2B"}, - {"/", "%2F"}, - {"=", "%3D"}}); + std::string urlencoded = absl::StrReplaceAll( + options.expectedPeerCert(), + {{"\n", "%0A"}, {" ", "%20"}, {"+", "%2B"}, {"/", "%2F"}, {"=", "%3D"}}); // Assert twice to ensure a cached value is returned and still valid. EXPECT_EQ(urlencoded, server_connection->ssl()->urlEncodedPemEncodedPeerCertificate()); EXPECT_EQ(urlencoded, server_connection->ssl()->urlEncodedPemEncodedPeerCertificate()); } if (!options.expectedPeerCertChain().empty()) { - std::string cert_chain = - absl::StrReplaceAll(options.expectedPeerCertChain(), {{TestEnvironment::newLine, "%0A"}, - {" ", "%20"}, - {"+", "%2B"}, - {"/", "%2F"}, - {"=", "%3D"}}); + std::string cert_chain = absl::StrReplaceAll( + options.expectedPeerCertChain(), + {{"\n", "%0A"}, {" ", "%20"}, {"+", "%2B"}, {"/", "%2F"}, {"=", "%3D"}}); // Assert twice to ensure a cached value is returned and still valid. EXPECT_EQ(cert_chain, server_connection->ssl()->urlEncodedPemEncodedPeerCertificateChain()); EXPECT_EQ(cert_chain, server_connection->ssl()->urlEncodedPemEncodedPeerCertificateChain()); @@ -903,22 +897,27 @@ TEST_P(SslSocketTest, GetCertDigestInline) { // From test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem. server_cert->mutable_certificate_chain()->set_inline_bytes( - TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( - "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem"))); + TestEnvironment::readFileToStringForTest( + TestEnvironment::substitute( + "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem"), + true, false)); // From test/extensions/transport_sockets/tls/test_data/san_dns_key.pem. - server_cert->mutable_private_key()->set_inline_bytes( - TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( - "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_key.pem"))); + server_cert->mutable_private_key()->set_inline_bytes(TestEnvironment::readFileToStringForTest( + TestEnvironment::substitute( + "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_key.pem"), + true, false)); // From test/extensions/transport_sockets/tls/test_data/ca_certificates.pem. filter_chain->mutable_hidden_envoy_deprecated_tls_context() ->mutable_common_tls_context() ->mutable_validation_context() ->mutable_trusted_ca() - ->set_inline_bytes(TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( - "{{ test_rundir " - "}}/test/extensions/transport_sockets/tls/test_data/ca_certificates.pem"))); + ->set_inline_bytes(TestEnvironment::readFileToStringForTest( + TestEnvironment::substitute( + "{{ test_rundir " + "}}/test/extensions/transport_sockets/tls/test_data/ca_certificates.pem"), + true, false)); envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext client_ctx; envoy::extensions::transport_sockets::tls::v3::TlsCertificate* client_cert = @@ -926,13 +925,16 @@ TEST_P(SslSocketTest, GetCertDigestInline) { // From test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem. client_cert->mutable_certificate_chain()->set_inline_bytes( - TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( - "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem"))); + TestEnvironment::readFileToStringForTest( + TestEnvironment::substitute( + "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem"), + true, false)); // From test/extensions/transport_sockets/tls/test_data/san_uri_key.pem. - client_cert->mutable_private_key()->set_inline_bytes( - TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( - "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem"))); + client_cert->mutable_private_key()->set_inline_bytes(TestEnvironment::readFileToStringForTest( + TestEnvironment::substitute( + "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem"), + true, false)); TestUtilOptionsV2 test_options(listener, client_ctx, true, GetParam()); testUtilV2(test_options.setExpectedClientCertUri("spiffe://lyft.com/test-team") @@ -1236,9 +1238,10 @@ TEST_P(SslSocketTest, GetPeerCert) { )EOF"; TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, true, GetParam()); - std::string expected_peer_cert = - TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( - "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/no_san_cert.pem")); + std::string expected_peer_cert = TestEnvironment::readFileToStringForTest( + TestEnvironment::substitute( + "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/no_san_cert.pem"), + true, false); testUtil(test_options.setExpectedSerialNumber(TEST_NO_SAN_CERT_SERIAL) .setExpectedPeerIssuer( "CN=Test CA,OU=Lyft Engineering,O=Lyft,L=San Francisco,ST=California,C=US") @@ -1274,9 +1277,10 @@ TEST_P(SslSocketTest, GetPeerCertAcceptUntrusted) { )EOF"; TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, true, GetParam()); - std::string expected_peer_cert = - TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( - "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/no_san_cert.pem")); + std::string expected_peer_cert = TestEnvironment::readFileToStringForTest( + TestEnvironment::substitute( + "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/no_san_cert.pem"), + true, false); testUtil(test_options.setExpectedSerialNumber(TEST_NO_SAN_CERT_SERIAL) .setExpectedPeerIssuer( "CN=Test CA,OU=Lyft Engineering,O=Lyft,L=San Francisco,ST=California,C=US") @@ -1359,10 +1363,11 @@ TEST_P(SslSocketTest, GetPeerCertChain) { )EOF"; TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, true, GetParam()); - std::string expected_peer_cert_chain = - TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( + std::string expected_peer_cert_chain = TestEnvironment::readFileToStringForTest( + TestEnvironment::substitute( "{{ test_rundir " - "}}/test/extensions/transport_sockets/tls/test_data/no_san_chain.pem")); + "}}/test/extensions/transport_sockets/tls/test_data/no_san_chain.pem"), + true, false); testUtil(test_options.setExpectedSerialNumber(TEST_NO_SAN_CERT_SERIAL) .setExpectedPeerCertChain(expected_peer_cert_chain)); } @@ -1901,10 +1906,11 @@ TEST_P(SslSocketTest, CertificatesWithPassword) { client_cert->mutable_private_key()->set_filename(TestEnvironment::substitute( "{{ test_rundir " "}}/test/extensions/transport_sockets/tls/test_data/password_protected_key.pem")); - client_cert->mutable_password()->set_inline_string( - TestEnvironment::readFileToStringForTest(TestEnvironment::substitute( + client_cert->mutable_password()->set_inline_string(TestEnvironment::readFileToStringForTest( + TestEnvironment::substitute( "{{ test_rundir " - "}}/test/extensions/transport_sockets/tls/test_data/password_protected_password.txt"))); + "}}/test/extensions/transport_sockets/tls/test_data/password_protected_password.txt"), + true, false)); TestUtilOptionsV2 test_options(listener, client, true, GetParam()); testUtilV2(test_options.setExpectedClientCertUri("spiffe://lyft.com/test-team") diff --git a/test/integration/BUILD b/test/integration/BUILD index 00d615eeb2b2..2496c954792e 100644 --- a/test/integration/BUILD +++ b/test/integration/BUILD @@ -343,7 +343,9 @@ envoy_cc_test( "http2_integration_test.h", ], shard_count = 4, - # TODO(envoyproxy/windows-dev): Apparently resolved by Level Events PR #13787 + # TODO(envoyproxy/windows-dev): Diagnose flake, observed to fail at; + # IpVersions/Http2MetadataIntegrationTest.UpstreamMetadataAfterEndStream/IPv6 + # (expected 200, received 503) tags = ["flaky_on_windows"], deps = [ ":http_integration_lib", @@ -373,8 +375,6 @@ envoy_cc_test( srcs = [ "http_subset_lb_integration_test.cc", ], - # TODO(envoyproxy/windows-dev): Apparently resolved by Level Events PR #13787 - tags = ["flaky_on_windows"], deps = [ ":http_integration_lib", "//test/common/upstream:utility_lib", @@ -435,10 +435,6 @@ envoy_cc_test( # As this test has many H1/H2/v4/v6 tests it takes a while to run. # Shard it enough to bring the run time in line with other integration tests. shard_count = 5, - # TODO(envoyproxy/windows-dev): Largely resolved by Level Events PR #13787 - diagose remaining rare failure; - # Protocols/DownstreamProtocolIntegrationTest.LargeRequestUrlRejected/IPv6_HttpDownstream_HttpUpstream - # test/integration/http_integration.cc(1035): error: Value of: response->complete() Actual: false Expected: true - tags = ["flaky_on_windows"], deps = [ ":http_protocol_integration_lib", "//source/common/http:header_map_lib", @@ -463,9 +459,6 @@ envoy_cc_test( "http2_upstream_integration_test.cc", "http2_upstream_integration_test.h", ], - # TODO(envoyproxy/windows-dev): Diagnose test timeout observed in msvc-cl opt build - # in Http2UpstreamIntegrationTest.RouterUpstreamDisconnectBeforeResponseComplete/IPv4 - tags = ["flaky_on_windows"], deps = [ ":http_integration_lib", "//source/common/http:header_map_lib", @@ -572,8 +565,6 @@ envoy_cc_test( # As this test has many pauses for idle timeouts, it takes a while to run. # Shard it enough to bring the run time in line with other integration tests. shard_count = 2, - # TODO(envoyproxy/windows-dev): Apparently resolved by Level Events PR #13787 - tags = ["flaky_on_windows"], deps = [ ":http_protocol_integration_lib", "//test/integration/filters:backpressure_filter_config_lib", @@ -884,8 +875,6 @@ envoy_cc_test( "integration_test.h", ], shard_count = 2, - # TODO(envoyproxy/windows-dev): Diagnose timeout observed in clang-cl opt build test - tags = ["flaky_on_windows"], deps = [ ":http_integration_lib", "//source/common/http:header_map_lib", @@ -932,8 +921,6 @@ envoy_cc_test( "websocket_integration_test.cc", "websocket_integration_test.h", ], - # TODO(envoyproxy/windows-dev): Apparently resolved by Level Events PR #13787 - tags = ["flaky_on_windows"], deps = [ ":http_protocol_integration_lib", "//source/common/http:header_map_lib", @@ -1019,8 +1006,6 @@ envoy_cc_test( "//test/config/integration/certs", ], shard_count = 2, - # TODO(envoyproxy/windows-dev): Apparently resolved by Level Events PR #13787 - tags = ["flaky_on_windows"], deps = [ ":http_integration_lib", ":integration_lib", @@ -1209,8 +1194,6 @@ envoy_cc_test( "//test/config/integration/certs", ], shard_count = 2, - # TODO(envoyproxy/windows-dev): Diagnose timeout observed in opt build test - tags = ["flaky_on_windows"], deps = [ ":integration_lib", ":tcp_proxy_integration_proto_cc_proto", @@ -1245,8 +1228,6 @@ envoy_cc_test( data = [ "//test/config/integration/certs", ], - # TODO(envoyproxy/windows-dev): Apparently resolved by Level Events PR #13787 - tags = ["flaky_on_windows"], deps = [ ":http_integration_lib", ":http_protocol_integration_lib", @@ -1326,8 +1307,6 @@ envoy_cc_test( "//test/config/integration:server_xds_files", "//test/config/integration/certs", ], - # TODO(envoyproxy/windows-dev): Diagnose test failure observed in opt build - tags = ["flaky_on_windows"], deps = [ ":http_integration_lib", ":http_protocol_integration_lib", diff --git a/test/test_common/environment.cc b/test/test_common/environment.cc index b70a9d9c8cf7..56e1bc082471 100644 --- a/test/test_common/environment.cc +++ b/test/test_common/environment.cc @@ -342,8 +342,8 @@ std::string TestEnvironment::temporaryFileSubstitute(const std::string& path, } std::string TestEnvironment::readFileToStringForTest(const std::string& filename, - bool require_existence) { - std::ifstream file(filename, std::ios::binary); + bool require_existence, bool read_binary) { + std::ifstream file(filename, read_binary ? std::ios::binary : std::ios::in); if (file.fail()) { if (!require_existence) { return ""; diff --git a/test/test_common/environment.h b/test/test_common/environment.h index 5ecaff700e0d..b2b3f32d92e8 100644 --- a/test/test_common/environment.h +++ b/test/test_common/environment.h @@ -196,10 +196,13 @@ class TestEnvironment { * @param filename: the fully qualified name of the file to use * @param require_existence if true, RELEASE_ASSERT if the file does not exist. * If false, an empty string will be returned if the file is not present. + * @param read_binary if true, read file verbatim, otherwise convert to POSIX + * carriage control * @return string the contents of the file. */ static std::string readFileToStringForTest(const std::string& filename, - bool require_existence = true); + bool require_existence = true, + bool read_binary = true); /** * Create a path on the filesystem (mkdir -p ... equivalent).