Merge "TrafficControllerTest: improve error declaration in dumpsysInvalidMaps" am: 84d6ad0601
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2120214
Change-Id: I36326b747b02acc937c708b274d881250a0a7af0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/service/native/TrafficControllerTest.cpp b/service/native/TrafficControllerTest.cpp
index fff99ba..2eabc26 100644
--- a/service/native/TrafficControllerTest.cpp
+++ b/service/native/TrafficControllerTest.cpp
@@ -842,20 +842,25 @@
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";
+ const std::string kErrReadStatsMapConfig = "read stats map configure failed with error: "
+ "Read value of map -1 failed: Bad file descriptor";
+
std::vector<std::string> expectedLines = {
- "mCookieTagMap print end with error: Get firstKey map -1 failed: Bad file descriptor",
- "mUidCounterSetMap print end with error: Get firstKey map -1 failed: Bad file descriptor",
- "mAppUidStatsMap print end with error: Get firstKey map -1 failed: Bad file descriptor",
- "mStatsMapA print end with error: Get firstKey map -1 failed: Bad file descriptor",
- "mStatsMapB print end with error: Get firstKey map -1 failed: Bad file descriptor",
- "mIfaceIndexNameMap print end with error: Get firstKey map -1 failed: Bad file descriptor",
- "mIfaceStatsMap print end with error: Get firstKey map -1 failed: Bad file descriptor",
- "mConfigurationMap read ownerMatch configure failed with error: "
- "Read value of map -1 failed: Bad file descriptor",
- "mConfigurationMap read stats map configure failed with error: "
- "Read value of map -1 failed: Bad file descriptor",
- "mUidOwnerMap print end with error: Get firstKey map -1 failed: Bad file descriptor",
- "mUidPermissionMap print end with error: Get firstKey map -1 failed: Bad file descriptor"};
+ fmt::format("mCookieTagMap {}", kErrIterate),
+ fmt::format("mUidCounterSetMap {}", kErrIterate),
+ fmt::format("mAppUidStatsMap {}", kErrIterate),
+ fmt::format("mStatsMapA {}", kErrIterate),
+ fmt::format("mStatsMapB {}", kErrIterate),
+ fmt::format("mIfaceIndexNameMap {}", kErrIterate),
+ fmt::format("mIfaceStatsMap {}", kErrIterate),
+ fmt::format("mConfigurationMap {}", kErrReadRulesConfig),
+ fmt::format("mConfigurationMap {}", kErrReadStatsMapConfig),
+ fmt::format("mUidOwnerMap {}", kErrIterate),
+ fmt::format("mUidPermissionMap {}", kErrIterate)};
EXPECT_TRUE(expectDumpsysContains(expectedLines));
}