Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed9a0b7e authored by Ken Chen's avatar Ken Chen
Browse files

[Test] Run BlockDnsQuery only when dependency is fulfilled

Bug: 309164580
Test: atest PrivateDns/TransportParameterizedTest#BlockDnsQuery/DoH
Change-Id: I80a6e4499e71d901148cc35c0af3bf588756c4ef
parent 57997e80
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@

#include <algorithm>
#include <chrono>
#include <filesystem>
#include <functional>
#include <iterator>
#include <numeric>
+2 −0
Original line number Diff line number Diff line
@@ -552,6 +552,8 @@ TEST_P(TransportParameterizedTest, MdnsGetAddrInfo_fallback) {

TEST_P(TransportParameterizedTest, BlockDnsQuery) {
    SKIP_IF_BEFORE_T;
    SKIP_IF_DEPENDENT_LIB_DOES_NOT_EXIST(DNS_HELPER);

    constexpr char ptr_name[] = "v4v6.example.com.";
    // PTR record for IPv6 address 2001:db8::102:304
    constexpr char ptr_addr_v6[] =
+7 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <arpa/nameser.h>
#include <netdb.h>

#include <filesystem>
#include <functional>
#include <string>
#include <vector>
@@ -442,3 +443,9 @@ static const std::string DNS_HELPER =
        android::bpf::isUserspace64bit()
                ? "/apex/com.android.tethering/lib64/libcom.android.tethering.dns_helper.so"
                : "/apex/com.android.tethering/lib/libcom.android.tethering.dns_helper.so";

#define SKIP_IF_DEPENDENT_LIB_DOES_NOT_EXIST(libPath)                  \
    do {                                                               \
        if (!std::filesystem::exists(libPath))                         \
            GTEST_SKIP() << "Required " << (libPath) << " not found."; \
    } while (0)