diff options
author | Paul Hu <paulhu@google.com> | 2022-06-24 13:56:01 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-06-24 13:56:01 +0000 |
commit | 7c6f55ae0e1160f973bffa6b121ed25b34db82bc (patch) | |
tree | 5f09deca8805ef9c48a543ced906ca32bf8cb09f | |
parent | d73f19f70133eabc240a907a506f8a35ba8739cc (diff) | |
parent | 1c64f0849fc2f63dc33d11baa70a062581797175 (diff) | |
download | netd-7c6f55ae0e1160f973bffa6b121ed25b34db82bc.tar.gz |
Merge "Logging life cycle of each test"
-rw-r--r-- | server/InterfaceControllerTest.cpp | 5 | ||||
-rw-r--r-- | server/IptablesBaseTest.h | 4 | ||||
-rw-r--r-- | server/IptablesRestoreControllerTest.cpp | 3 | ||||
-rw-r--r-- | server/NFLogListenerTest.cpp | 3 | ||||
-rw-r--r-- | server/SockDiagTest.cpp | 3 | ||||
-rw-r--r-- | server/XfrmControllerTest.cpp | 3 | ||||
-rw-r--r-- | tests/binder_test.cpp | 5 | ||||
-rw-r--r-- | tests/bpf_base_test.cpp | 3 | ||||
-rw-r--r-- | tests/sock_diag_test.cpp | 3 |
9 files changed, 21 insertions, 11 deletions
diff --git a/server/InterfaceControllerTest.cpp b/server/InterfaceControllerTest.cpp index 006018d7..8075431f 100644 --- a/server/InterfaceControllerTest.cpp +++ b/server/InterfaceControllerTest.cpp @@ -22,6 +22,7 @@ #include <gtest/gtest.h> #include <netdutils/MockSyscalls.h> +#include <netdutils/NetNativeTestBase.h> #include <netdutils/Utils.h> #include "InterfaceController.h" @@ -66,7 +67,7 @@ class MockProperties { } // namespace -class StablePrivacyTest : public testing::Test { +class StablePrivacyTest : public NetNativeTestBase { protected: void expectOpenFile(const std::string& path, const Fd fd, int err) { if (err == 0) { @@ -179,7 +180,7 @@ TEST_F(StablePrivacyTest, ExistingPropertyWriteFail) { EXPECT_NE(ok, enableStablePrivacyAddresses(kTestIface)); } -class GetIfaceListTest : public testing::Test {}; +class GetIfaceListTest : public NetNativeTestBase {}; TEST_F(GetIfaceListTest, IfaceNames) { StatusOr<std::vector<std::string>> ifaceNames = getIfaceNames(); diff --git a/server/IptablesBaseTest.h b/server/IptablesBaseTest.h index abe3f84a..bfcc71a1 100644 --- a/server/IptablesBaseTest.h +++ b/server/IptablesBaseTest.h @@ -18,9 +18,11 @@ #include <deque> +#include <netdutils/NetNativeTestBase.h> + #include "NetdConstants.h" -class IptablesBaseTest : public ::testing::Test { +class IptablesBaseTest : public NetNativeTestBase { public: IptablesBaseTest(); diff --git a/server/IptablesRestoreControllerTest.cpp b/server/IptablesRestoreControllerTest.cpp index a05c76d1..cecdf4d9 100644 --- a/server/IptablesRestoreControllerTest.cpp +++ b/server/IptablesRestoreControllerTest.cpp @@ -32,6 +32,7 @@ #include <android-base/strings.h> #include <log/log.h> #include <netdutils/MockSyscalls.h> +#include <netdutils/NetNativeTestBase.h> #include <netdutils/Stopwatch.h> #include "NetdConstants.h" @@ -55,7 +56,7 @@ using android::netdutils::Stopwatch; using testing::Return; using testing::StrictMock; -class IptablesRestoreControllerTest : public ::testing::Test { +class IptablesRestoreControllerTest : public NetNativeTestBase { public: IptablesRestoreController con; int mDefaultMaxRetries = con.MAX_RETRIES; diff --git a/server/NFLogListenerTest.cpp b/server/NFLogListenerTest.cpp index 88ab2c61..878c9884 100644 --- a/server/NFLogListenerTest.cpp +++ b/server/NFLogListenerTest.cpp @@ -25,6 +25,7 @@ #include <linux/netfilter/nfnetlink_log.h> #include <netdutils/MockSyscalls.h> +#include <netdutils/NetNativeTestBase.h> #include "NFLogListener.h" using ::testing::_; @@ -58,7 +59,7 @@ class MockNetlinkListener : public NetlinkListenerInterface { MOCK_METHOD1(registerSkErrorHandler, void(const SkErrorHandler& handler)); }; -class NFLogListenerTest : public testing::Test { +class NFLogListenerTest : public NetNativeTestBase { protected: NFLogListenerTest() { EXPECT_CALL(*mNLListener, subscribe(kNFLogPacketMsgType, _)) diff --git a/server/SockDiagTest.cpp b/server/SockDiagTest.cpp index 49601aa4..864d08d5 100644 --- a/server/SockDiagTest.cpp +++ b/server/SockDiagTest.cpp @@ -24,6 +24,7 @@ #include <linux/inet_diag.h> #include <gtest/gtest.h> +#include <netdutils/NetNativeTestBase.h> #include "Fwmark.h" #include "NetdConstants.h" @@ -33,7 +34,7 @@ namespace android { namespace net { -class SockDiagTest : public ::testing::Test { +class SockDiagTest : public NetNativeTestBase { protected: static bool isLoopbackSocket(const inet_diag_msg *msg) { return SockDiag::isLoopbackSocket(msg); diff --git a/server/XfrmControllerTest.cpp b/server/XfrmControllerTest.cpp index e7f5cfc0..f1c38073 100644 --- a/server/XfrmControllerTest.cpp +++ b/server/XfrmControllerTest.cpp @@ -41,6 +41,7 @@ #include <android-base/strings.h> #include <android-base/unique_fd.h> #include <gtest/gtest.h> +#include <netdutils/NetNativeTestBase.h> #include "Fwmark.h" #include "NetdConstants.h" @@ -127,7 +128,7 @@ void expectAddressEquals(int family, const std::string& expected, const xfrm_add EXPECT_EQ(expected, actualStr); } -class XfrmControllerTest : public ::testing::Test { +class XfrmControllerTest : public NetNativeTestBase { public: testing::StrictMock<netdutils::ScopedMockSyscalls> mockSyscalls; }; diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp index fe9dd90f..fd35f185 100644 --- a/tests/binder_test.cpp +++ b/tests/binder_test.cpp @@ -58,6 +58,7 @@ #include <com/android/internal/net/IOemNetd.h> #include <cutils/multiuser.h> #include <gtest/gtest.h> +#include <netdutils/NetNativeTestBase.h> #include <netutils/ifc.h> #include <utils/Errors.h> #include "Fwmark.h" @@ -175,7 +176,7 @@ static const in6_addr V6_ADDR = { {// 2001:db8:cafe::8888 .u6_addr8 = {0x20, 0x01, 0x0d, 0xb8, 0xca, 0xfe, 0, 0, 0, 0, 0, 0, 0, 0, 0x88, 0x88}}}; -class NetdBinderTest : public ::testing::Test { +class NetdBinderTest : public NetNativeTestBase { public: NetdBinderTest() { sp<IServiceManager> sm = android::defaultServiceManager(); @@ -4792,7 +4793,7 @@ TEST_F(PerAppNetworkPermissionsTest, PermissionOnlyAffectsUid) { } } -class MDnsBinderTest : public ::testing::Test { +class MDnsBinderTest : public NetNativeTestBase { public: class TestMDnsListener : public android::net::mdns::aidl::BnMDnsEventListener { public: diff --git a/tests/bpf_base_test.cpp b/tests/bpf_base_test.cpp index 802823db..8a215066 100644 --- a/tests/bpf_base_test.cpp +++ b/tests/bpf_base_test.cpp @@ -33,6 +33,7 @@ #include <android-base/stringprintf.h> #include <android-base/strings.h> +#include <netdutils/NetNativeTestBase.h> #include "bpf/BpfMap.h" #include "bpf/BpfUtils.h" @@ -48,7 +49,7 @@ namespace bpf { constexpr uid_t TEST_UID = UID_MAX - 1; constexpr uint32_t TEST_TAG = 42; -class BpfBasicTest : public testing::Test { +class BpfBasicTest : public NetNativeTestBase { protected: BpfBasicTest() {} }; diff --git a/tests/sock_diag_test.cpp b/tests/sock_diag_test.cpp index 8ee99083..5d142dc4 100644 --- a/tests/sock_diag_test.cpp +++ b/tests/sock_diag_test.cpp @@ -21,6 +21,7 @@ #include <linux/inet_diag.h> #include <gtest/gtest.h> +#include <netdutils/NetNativeTestBase.h> #include "NetdConstants.h" #include "SockDiag.h" @@ -29,7 +30,7 @@ #define NUM_SOCKETS 500 -class SockDiagTest : public ::testing::Test { +class SockDiagTest : public NetNativeTestBase { }; uint16_t bindAndListen(int s) { |