Move CookieTag map dump to BpfNetMaps
Also removes dump tests in TrafficController Bug: 217624062 Test: atest BpfNetMaps TagSocketTest Change-Id: I92adad60c55443435d7c7a0bfc84b38162fd51b0
This commit is contained in:
@@ -59,7 +59,6 @@ constexpr uid_t TEST_UID2 = 54321;
|
||||
constexpr uid_t TEST_UID3 = 98765;
|
||||
constexpr uint32_t TEST_TAG = 42;
|
||||
constexpr uint32_t TEST_COUNTERSET = 1;
|
||||
constexpr int TEST_COOKIE = 1;
|
||||
constexpr int TEST_IFINDEX = 999;
|
||||
constexpr int RXPACKETS = 1;
|
||||
constexpr int RXBYTES = 100;
|
||||
@@ -769,46 +768,6 @@ TEST_F(TrafficControllerTest, TestGrantDuplicatePermissionSlientlyFail) {
|
||||
expectPrivilegedUserSetEmpty();
|
||||
}
|
||||
|
||||
TEST_F(TrafficControllerTest, TestDumpsys) {
|
||||
StatsKey tagStatsMapKey;
|
||||
populateFakeStats(TEST_COOKIE, TEST_UID, TEST_TAG, &tagStatsMapKey);
|
||||
populateFakeCounterSet(TEST_UID3, TEST_COUNTERSET);
|
||||
|
||||
// Expect: (part of this depends on hard-code values in populateFakeStats())
|
||||
//
|
||||
// mCookieTagMap:
|
||||
// cookie=1 tag=0x2a uid=10086
|
||||
//
|
||||
// mUidCounterSetMap:
|
||||
// 98765 1
|
||||
//
|
||||
// mAppUidStatsMap::
|
||||
// uid rxBytes rxPackets txBytes txPackets
|
||||
// 10086 100 1 0 0
|
||||
//
|
||||
// mStatsMapA:
|
||||
// ifaceIndex ifaceName tag_hex uid_int cnt_set rxBytes rxPackets txBytes txPackets
|
||||
// 999 test0 0x2a 10086 1 100 1 0 0
|
||||
std::vector<std::string> expectedLines = {
|
||||
"mCookieTagMap:",
|
||||
fmt::format("cookie={} tag={:#x} uid={}", TEST_COOKIE, TEST_TAG, TEST_UID)};
|
||||
|
||||
EXPECT_TRUE(expectDumpsysContains(expectedLines));
|
||||
}
|
||||
|
||||
TEST_F(TrafficControllerTest, dumpsysInvalidMaps) {
|
||||
makeTrafficControllerMapsInvalid();
|
||||
|
||||
const std::string kErrIterate = "print end with error: Get firstKey map -1 failed: "
|
||||
"Bad file descriptor";
|
||||
const std::string kErrReadRulesConfig = "read ownerMatch configure failed with error: "
|
||||
"Read value of map -1 failed: Bad file descriptor";
|
||||
|
||||
std::vector<std::string> expectedLines = {
|
||||
fmt::format("mCookieTagMap {}", kErrIterate)};
|
||||
EXPECT_TRUE(expectDumpsysContains(expectedLines));
|
||||
}
|
||||
|
||||
TEST_F(TrafficControllerTest, getFirewallType) {
|
||||
static const struct TestConfig {
|
||||
ChildChain childChain;
|
||||
|
||||
Reference in New Issue
Block a user