From a51339545bf80527330a21003b75a7c4f198abaa Mon Sep 17 00:00:00 2001 From: troshko111 <931973+troshko111@users.noreply.github.com> Date: Tue, 10 Sep 2019 13:28:43 -0700 Subject: [PATCH] test: add curl features check (#8194) Add a test ensuring curl was built with the expected features. Description: Add a test ensuring curl was built with the expected features. Risk Level: Low. Testing: n/a. Docs Changes: n/a. Release Notes: n/a. Signed-off-by: Taras Roshko --- test/dependencies/BUILD | 17 +++++++++++++++++ test/dependencies/curl_test.cc | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 test/dependencies/BUILD create mode 100644 test/dependencies/curl_test.cc diff --git a/test/dependencies/BUILD b/test/dependencies/BUILD new file mode 100644 index 000000000000..2e6ae296b760 --- /dev/null +++ b/test/dependencies/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/dependencies/curl_test.cc b/test/dependencies/curl_test.cc new file mode 100644 index 000000000000..82fdeceeec29 --- /dev/null +++ b/test/dependencies/curl_test.cc @@ -0,0 +1,32 @@ +#include "curl/curl.h" +#include "gtest/gtest.h" + +namespace Envoy { +namespace Dependencies { + +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 Dependencies +} // namespace Envoy