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

Commit e0168482 authored by Chiachang Wang's avatar Chiachang Wang
Browse files

Logging life cycle of each test

It's helpful for debugging each test to observe the behavior
between each test.

Sample log:
I resolv_private_dns_test: started: PrivateDnsDohTest#QueryFailover
    :
I resolv_private_dns_test: finished: PrivateDnsDohTest#QueryFailover

Test: atest resolv_integration_test
Bug: 223731710
Change-Id: I0335baa1762d35355d20bdf7a707b590f8a95c0c
parent 166df377
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <gtest/gtest.h>

#include "DnsQueryLog.h"
#include "tests/resolv_test_base.h"

using namespace std::chrono_literals;

@@ -58,7 +59,7 @@ void verifyDumpOutput(const std::string& dumpLog, const std::vector<int>& expect

}  // namespace

class DnsQueryLogTest : public ::testing::Test {
class DnsQueryLogTest : public ResolvTestBase {
  protected:
    const std::vector<std::string> serversV4 = {"127.0.0.1", "1.2.3.4"};
    const std::vector<std::string> serversV4V6 = {"127.0.0.1", "1.2.3.4", "2001:db8::1",
+3 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <gtest/gtest.h>

#include "DnsStats.h"
#include "tests/resolv_test_base.h"

namespace android::net {

@@ -66,7 +67,7 @@ StatsData makeStatsData(const IPSockAddr& server, const int total, const microse

// TODO: add StatsDataTest to ensure its methods return correct outputs.

class StatsRecordsTest : public ::testing::Test {};
class StatsRecordsTest : public ResolvTestBase {};

TEST_F(StatsRecordsTest, PushRecord) {
    const IPSockAddr server = IPSockAddr::toIPSockAddr("127.0.0.2", 53);
@@ -104,7 +105,7 @@ TEST_F(StatsRecordsTest, PushRecord) {
              makeStatsData(server, 3, 750ms, {{NS_R_NO_ERROR, 0}, {NS_R_TIMEOUT, 3}}));
}

class DnsStatsTest : public ::testing::Test {
class DnsStatsTest : public ResolvTestBase {
  protected:
    std::string captureDumpOutput() {
        netdutils::DumpWriter dw(STDOUT_FILENO);
+2 −1
Original line number Diff line number Diff line
@@ -25,10 +25,11 @@
#include <gtest/gtest.h>

#include "Experiments.h"
#include "tests/resolv_test_base.h"

namespace android::net {

class ExperimentsTest : public ::testing::Test {
class ExperimentsTest : public ResolvTestBase {
  public:
    ExperimentsTest() : mExperiments(fakeGetExperimentFlagInt) {}

+2 −1
Original line number Diff line number Diff line
@@ -20,13 +20,14 @@
#include "PrivateDnsConfiguration.h"
#include "tests/dns_responder/dns_responder.h"
#include "tests/dns_responder/dns_tls_frontend.h"
#include "tests/resolv_test_base.h"
#include "tests/resolv_test_utils.h"

namespace android::net {

using namespace std::chrono_literals;

class PrivateDnsConfigurationTest : public ::testing::Test {
class PrivateDnsConfigurationTest : public ResolvTestBase {
  public:
    using ServerIdentity = PrivateDnsConfiguration::ServerIdentity;

+2 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include "ResolverStats.h"
#include "dns_responder.h"
#include "dns_responder_client_ndk.h"
#include "tests/resolv_test_base.h"

using aidl::android::net::IDnsResolver;
using aidl::android::net::ResolverHostsParcel;
@@ -92,7 +93,7 @@ std::vector<std::string> dumpService(ndk::SpAIBinder binder) {

}  // namespace

class DnsResolverBinderTest : public ::testing::Test {
class DnsResolverBinderTest : public ResolvTestBase {
  public:
    DnsResolverBinderTest() {
        ndk::SpAIBinder resolvBinder = ndk::SpAIBinder(AServiceManager_getService("dnsresolver"));
Loading