diff --git a/.github/workflows/centos7.yml b/.github/workflows/centos7.yml new file mode 100644 index 00000000..f140d6ac --- /dev/null +++ b/.github/workflows/centos7.yml @@ -0,0 +1,61 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT +name: CentOS 7 +on: + push: + pull_request: + +concurrency: + group: ${{ github.ref }}-centos7 + cancel-in-progress: true + +env: + TEST_FILTER: "--gtest_filter=-*LiveSearchTXT*:*LiveSearchANY*" + CMAKE_FLAGS: "-DCMAKE_BUILD_TYPE=DEBUG -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -G Ninja" + CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=ON -DCMAKE_PREFIX_PATH=/usr/local/" + MAKE: make + +jobs: + build: + runs-on: ubuntu-latest + container: + image: centos:7 + options: --privileged + name: "CentOS 7" + steps: + - name: Switch Repo to Vault + run: | + sed -i -e 's/^mirrorlist/#mirrorlist/' -e 's/^#baseurl/baseurl/' -e 's/mirror.centos.org/vault.centos.org/' /etc/yum.repos.d/*.repo + yum clean all + - name: Install EPEL + run: | + yum install -y epel-release + sed -i -e 's|https://dl.fedoraproject.org/pub/epel|archives.fedoraproject.org/pub/archive/epel|' /etc/yum.repos.d/*.repo + yum repolist + - name: Install packages + run: | + yum install -y gcc gcc-c++ make autoconf automake libtool cmake3 git ninja-build gdb + ln -sf /usr/bin/cmake3 /usr/bin/cmake + - name: Checkout c-ares + uses: actions/checkout@v1 + - name: Build GoogleTest + # GoogleTest v1.10 doesn't require c++14 + run: | + git clone --depth=1 -b v1.10.x https://github.com/google/googletest googletest + cd googletest + cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_GMOCK=ON -DINSTALL_GTEST=ON -G Ninja . + ninja install + cd .. + - name: "CMake: build and test c-ares" + env: + BUILD_TYPE: CMAKE + TEST_DEBUGGER: gdb + run: | + ./ci/build.sh + ./ci/test.sh + - name: "Autotools: build and test c-ares" + env: + BUILD_TYPE: autotools + # Can't run tests due to C++14 check and compiler not supporting C++14 + run: | + ./ci/build.sh diff --git a/test/ares-test-internal.cc b/test/ares-test-internal.cc index 8125653d..ab8dfd63 100644 --- a/test/ares-test-internal.cc +++ b/test/ares-test-internal.cc @@ -291,7 +291,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsPositive) { "1.3.5.7 \n" "::1 ipv6.com"); EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; AddrInfoResult result = {}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; @@ -311,7 +311,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsSpaces) { "1.3.5.7 \n" "::1 ipv6.com"); EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; AddrInfoResult result = {}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; @@ -331,7 +331,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsByALias) { "1.3.5.7 \n" "::1 ipv6.com"); EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; AddrInfoResult result = {}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; @@ -351,7 +351,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsIPV6) { "1.3.5.7 \n" "::1 ipv6.com"); EnvValue with_env("CARES_HOSTS", hostsfile.filename()); - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; AddrInfoResult result = {}; hints.ai_family = AF_INET6; hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT; diff --git a/test/ares-test-live.cc b/test/ares-test-live.cc index 256d48ff..e23dadfe 100644 --- a/test/ares-test-live.cc +++ b/test/ares-test-live.cc @@ -74,7 +74,7 @@ MATCHER_P(IncludesAddrType, addrtype, "") { } //VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveGetAddrInfoV4) { - //struct ares_addrinfo_hints hints = {}; + //struct ares_addrinfo_hints hints = {0, 0, 0, 0}; //hints.ai_family = AF_INET; //AddrInfoResult result; //ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -86,7 +86,7 @@ MATCHER_P(IncludesAddrType, addrtype, "") { //} //VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveGetAddrInfoV6) { - //struct ares_addrinfo_hints hints = {}; + //struct ares_addrinfo_hints hints = {0, 0, 0, 0}; //hints.ai_family = AF_INET6; //AddrInfoResult result; //ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -98,7 +98,7 @@ MATCHER_P(IncludesAddrType, addrtype, "") { //} //VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveGetAddrInfoUnspec) { - //struct ares_addrinfo_hints hints = {}; + //struct ares_addrinfo_hints hints = {0, 0, 0, 0}; //hints.ai_family = AF_UNSPEC; //AddrInfoResult result; //ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); diff --git a/test/ares-test-misc.cc b/test/ares-test-misc.cc index 5e912aa7..783f2c3e 100644 --- a/test/ares-test-misc.cc +++ b/test/ares-test-misc.cc @@ -336,7 +336,7 @@ TEST_F(DefaultChannelTest, HostByNameFileOnionDomain) { TEST_F(DefaultChannelTest, GetAddrinfoOnionDomain) { AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_UNSPEC; ares_getaddrinfo(channel_, "dontleak.onion", NULL, &hints, AddrInfoCallback, &result); EXPECT_TRUE(result.done_); diff --git a/test/ares-test-mock-ai.cc b/test/ares-test-mock-ai.cc index 6bd6933e..0b61a166 100644 --- a/test/ares-test-mock-ai.cc +++ b/test/ares-test-mock-ai.cc @@ -104,7 +104,7 @@ TEST_P(MockUDPChannelTestAI, GetAddrInfoParallelLookups) { ON_CALL(server_, OnRequest("www.example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp2)); - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; AddrInfoResult result1; @@ -145,7 +145,7 @@ TEST_P(MockUDPChannelTestAI, TruncationRetry) { .WillOnce(SetReply(&server_, &rspok)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -162,7 +162,7 @@ TEST_P(MockTCPChannelTestAI, MalformedResponse) { .WillByDefault(SetReplyData(&server_, one)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -180,7 +180,7 @@ TEST_P(MockTCPChannelTestAI, FormErrResponse) { .WillOnce(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -198,7 +198,7 @@ TEST_P(MockTCPChannelTestAI, ServFailResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -216,7 +216,7 @@ TEST_P(MockTCPChannelTestAI, NotImplResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -234,7 +234,7 @@ TEST_P(MockTCPChannelTestAI, RefusedResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -252,7 +252,7 @@ TEST_P(MockTCPChannelTestAI, YXDomainResponse) { .WillOnce(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -295,7 +295,7 @@ TEST_P(MockExtraOptsTestAI, SimpleQuery) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -346,7 +346,7 @@ TEST_P(MockExtraOptsNDots5TestAI, SimpleQuery) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "dynamodb.us-east-1.amazonaws.com.", NULL, &hints, AddrInfoCallback, &result); @@ -392,7 +392,7 @@ TEST_P(MockExtraOptsNDots0TestAI, SimpleQuery) { .WillByDefault(SetReply(&server_, &rsp_ndots0_third)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "ndots0", NULL, &hints, AddrInfoCallback, &result); @@ -434,7 +434,7 @@ TEST_P(MockNoCheckRespChannelTestAI, ServFailResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -452,7 +452,7 @@ TEST_P(MockNoCheckRespChannelTestAI, NotImplResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -470,7 +470,7 @@ TEST_P(MockNoCheckRespChannelTestAI, RefusedResponse) { .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -489,7 +489,7 @@ TEST_P(MockChannelTestAI, FamilyV6) { ON_CALL(server_, OnRequest("example.com", T_AAAA)) .WillByDefault(SetReply(&server_, &rsp6)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET6; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "example.com.", NULL, &hints, @@ -516,7 +516,7 @@ TEST_P(MockChannelTestAI, PartialQueryCancel) { AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_UNSPEC; ares_getaddrinfo(channel_, "example.com.", NULL, &hints, AddrInfoCallback, &result); @@ -536,7 +536,7 @@ TEST_P(MockChannelTestAI, FamilyV4) { ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result = {}; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "example.com.", NULL, &hints, @@ -556,7 +556,7 @@ TEST_P(MockChannelTestAI, FamilyV4_MultipleAddresses) { ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result = {}; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "example.com.", NULL, &hints, @@ -584,7 +584,7 @@ TEST_P(MockChannelTestAI, FamilyUnspecified) { ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_UNSPEC; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "example.com.", NULL, &hints, @@ -614,7 +614,7 @@ TEST_P(MockEDNSChannelTestAI, RetryWithoutEDNS) { .WillOnce(SetReply(&server_, &rspok)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); @@ -643,7 +643,7 @@ TEST_P(MockChannelTestAI, SearchDomains) { .WillByDefault(SetReply(&server_, &yesthird)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www", NULL, &hints, AddrInfoCallback, &result); @@ -689,7 +689,7 @@ TEST_P(MockChannelTestAI, SearchDomainsServFailOnAAAA) { .WillByDefault(SetReply(&server_, &failthird4)); AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_UNSPEC; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www", NULL, &hints, AddrInfoCallback, &result); @@ -707,7 +707,7 @@ class MockMultiServerChannelTestAI : MockChannelOptsTest(3, GetParam().first, GetParam().second, opts, optmask) {} void CheckExample() { AddrInfoResult result; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "www.example.com.", NULL, &hints, AddrInfoCallback, &result); @@ -785,7 +785,7 @@ TEST_P(MockChannelTestAI, FamilyV4ServiceName) { ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result = {}; - struct ares_addrinfo_hints hints = {}; + struct ares_addrinfo_hints hints = {0, 0, 0, 0}; hints.ai_family = AF_INET; hints.ai_flags = ARES_AI_NOSORT; ares_getaddrinfo(channel_, "example.com", "http", &hints, AddrInfoCallback, &result);