From 6918e8293a3484cd109f09ccf92afa1b64948ff5 Mon Sep 17 00:00:00 2001 From: Taras Roshko Date: Mon, 9 Sep 2019 23:10:17 -0700 Subject: [PATCH 1/2] test: add curl features check Add a test ensuring curl was built with the expected features. Signed-off-by: Taras Roshko --- test/deps/BUILD | 17 +++++++++++++++++ test/deps/curl_test.cc | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 test/deps/BUILD create mode 100644 test/deps/curl_test.cc diff --git a/test/deps/BUILD b/test/deps/BUILD new file mode 100644 index 000000000000..2e6ae296b760 --- /dev/null +++ b/test/deps/BUILD @@ -0,0 +1,17 @@ +licenses(["notice"]) # Apache 2 + +load( + "//bazel:envoy_build_system.bzl", + "envoy_cc_test", + "envoy_package", +) + +envoy_package() + +envoy_cc_test( + name = "curl_test", + srcs = ["curl_test.cc"], + external_deps = [ + "curl", + ], +) diff --git a/test/deps/curl_test.cc b/test/deps/curl_test.cc new file mode 100644 index 000000000000..f0fea6e595b6 --- /dev/null +++ b/test/deps/curl_test.cc @@ -0,0 +1,32 @@ +#include "curl/curl.h" +#include "gtest/gtest.h" + +namespace Envoy { +namespace Deps { + +TEST(CurlTest, BuiltWithExpectedFeatures) { + // Ensure built with the expected features, flags from + // https://curl.haxx.se/libcurl/c/curl_version_info.html. + curl_version_info_data* info = curl_version_info(CURLVERSION_NOW); + + EXPECT_NE(0, info->features & CURL_VERSION_ASYNCHDNS); + EXPECT_NE(0, info->ares_num); + EXPECT_NE(0, info->features & CURL_VERSION_HTTP2); + EXPECT_NE(0, info->features & CURL_VERSION_LIBZ); + EXPECT_NE(0, info->features & CURL_VERSION_IPV6); + EXPECT_NE(0, info->features & CURL_VERSION_UNIX_SOCKETS); + + EXPECT_EQ(0, info->features & CURL_VERSION_BROTLI); + EXPECT_EQ(0, info->features & CURL_VERSION_GSSAPI); + EXPECT_EQ(0, info->features & CURL_VERSION_GSSNEGOTIATE); + EXPECT_EQ(0, info->features & CURL_VERSION_KERBEROS4); + EXPECT_EQ(0, info->features & CURL_VERSION_KERBEROS5); + EXPECT_EQ(0, info->features & CURL_VERSION_NTLM); + EXPECT_EQ(0, info->features & CURL_VERSION_NTLM_WB); + EXPECT_EQ(0, info->features & CURL_VERSION_SPNEGO); + EXPECT_EQ(0, info->features & CURL_VERSION_SSL); + EXPECT_EQ(0, info->features & CURL_VERSION_SSPI); +} + +} // namespace Deps +} // namespace Envoy From 0e60d5ea52070401cce0196161c5ea646bf1af10 Mon Sep 17 00:00:00 2001 From: Taras Roshko Date: Tue, 10 Sep 2019 11:18:46 -0700 Subject: [PATCH 2/2] Fix spelling (deps -> dependencies) Signed-off-by: Taras Roshko --- test/{deps => dependencies}/BUILD | 0 test/{deps => dependencies}/curl_test.cc | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename test/{deps => dependencies}/BUILD (100%) rename test/{deps => dependencies}/curl_test.cc (95%) diff --git a/test/deps/BUILD b/test/dependencies/BUILD similarity index 100% rename from test/deps/BUILD rename to test/dependencies/BUILD diff --git a/test/deps/curl_test.cc b/test/dependencies/curl_test.cc similarity index 95% rename from test/deps/curl_test.cc rename to test/dependencies/curl_test.cc index f0fea6e595b6..82fdeceeec29 100644 --- a/test/deps/curl_test.cc +++ b/test/dependencies/curl_test.cc @@ -2,7 +2,7 @@ #include "gtest/gtest.h" namespace Envoy { -namespace Deps { +namespace Dependencies { TEST(CurlTest, BuiltWithExpectedFeatures) { // Ensure built with the expected features, flags from @@ -28,5 +28,5 @@ TEST(CurlTest, BuiltWithExpectedFeatures) { EXPECT_EQ(0, info->features & CURL_VERSION_SSPI); } -} // namespace Deps +} // namespace Dependencies } // namespace Envoy