1 /* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <dlfcn.h> 17 #include <hwext/gtest-ext.h> 18 #include <hwext/gtest-tag.h> 19 20 #include "memory_data_plugin.h" 21 #include "plugin_module_api.h" 22 #include "smaps_stats.h" 23 24 using namespace testing::ext; 25 26 namespace { 27 const std::string DEFAULT_TEST_PATH("/data/local/tmp/utresources/"); 28 29 class SmapsStatsTest : public ::testing::Test { 30 public: SetUpTestCase()31 static void SetUpTestCase() {} TearDownTestCase()32 static void TearDownTestCase() 33 { 34 if (access(DEFAULT_TEST_PATH.c_str(), F_OK) == 0) { 35 std::string str = "rm -rf " + DEFAULT_TEST_PATH; 36 system(str.c_str()); 37 } 38 } 39 SetUp()40 void SetUp() {} TearDown()41 void TearDown() {} 42 }; 43 44 /** 45 * @tc.name: smaps stats 46 * @tc.desc: test ParseMapHead 47 * @tc.type: FUNC 48 */ 49 HWTEST_F(SmapsStatsTest, TestParseMapHead1, TestSize.Level1) 50 { 51 std::string line = "00400000-00409000 \n"; 52 SmapsStats plugin; 53 MapPiecesInfo expectMappic = {0x00400000, 0x00409000, ""}; 54 MapPiecesInfo targetMappic = {0}; 55 SmapsHeadInfo expectSmapsHeadInfo = {"00400000", "00409000", "", "", -1}; 56 SmapsHeadInfo smapsHeadInfo = {}; 57 ASSERT_FALSE(plugin.ParseMapHead(line, targetMappic, smapsHeadInfo)); 58 // test result 59 EXPECT_EQ(expectMappic.startAddr, targetMappic.startAddr); 60 EXPECT_EQ(expectMappic.endAddr, targetMappic.endAddr); 61 EXPECT_STREQ(expectMappic.name.c_str(), targetMappic.name.c_str()); 62 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 63 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 64 EXPECT_STREQ(expectSmapsHeadInfo.permission.c_str(), smapsHeadInfo.permission.c_str()); 65 EXPECT_STREQ(expectSmapsHeadInfo.path.c_str(), smapsHeadInfo.path.c_str()); 66 EXPECT_EQ(expectSmapsHeadInfo.iNode, smapsHeadInfo.iNode); 67 } 68 69 /** 70 * @tc.name: smaps stats 71 * @tc.desc: test ParseMapHead 72 * @tc.type: FUNC 73 */ 74 HWTEST_F(SmapsStatsTest, TestParseMapHead2, TestSize.Level1) 75 { 76 std::string line = "00400000-00409000 r-xp\n"; 77 SmapsStats plugin; 78 MapPiecesInfo expectMappic = {0x00400000, 0x00409000, ""}; 79 MapPiecesInfo targetMappic = {0}; 80 SmapsHeadInfo expectSmapsHeadInfo = {"00400000", "00409000", "", "", -1}; 81 SmapsHeadInfo smapsHeadInfo = {}; 82 ASSERT_FALSE(plugin.ParseMapHead(line, targetMappic, smapsHeadInfo)); 83 // test result 84 EXPECT_EQ(expectMappic.startAddr, targetMappic.startAddr); 85 EXPECT_EQ(expectMappic.endAddr, targetMappic.endAddr); 86 EXPECT_STREQ(expectMappic.name.c_str(), targetMappic.name.c_str()); 87 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 88 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 89 EXPECT_STREQ(expectSmapsHeadInfo.permission.c_str(), smapsHeadInfo.permission.c_str()); 90 EXPECT_STREQ(expectSmapsHeadInfo.path.c_str(), smapsHeadInfo.path.c_str()); 91 EXPECT_EQ(expectSmapsHeadInfo.iNode, smapsHeadInfo.iNode); 92 } 93 94 /** 95 * @tc.name: smaps stats 96 * @tc.desc: test ParseMapHead 97 * @tc.type: FUNC 98 */ 99 HWTEST_F(SmapsStatsTest, TestParseMapHead3, TestSize.Level1) 100 { 101 std::string line = "00400000-00409000 r-xp 00000000\n"; 102 SmapsStats plugin; 103 MapPiecesInfo expectMappic = {0x00400000, 0x00409000, ""}; 104 MapPiecesInfo targetMappic = {0}; 105 SmapsHeadInfo expectSmapsHeadInfo = {"00400000", "00409000", "r-x", "", -1}; 106 SmapsHeadInfo smapsHeadInfo = {}; 107 ASSERT_FALSE(plugin.ParseMapHead(line, targetMappic, smapsHeadInfo)); 108 // test result 109 EXPECT_EQ(expectMappic.startAddr, targetMappic.startAddr); 110 EXPECT_EQ(expectMappic.endAddr, targetMappic.endAddr); 111 EXPECT_STREQ(expectMappic.name.c_str(), targetMappic.name.c_str()); 112 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 113 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 114 EXPECT_STREQ(expectSmapsHeadInfo.permission.c_str(), smapsHeadInfo.permission.c_str()); 115 EXPECT_STREQ(expectSmapsHeadInfo.path.c_str(), smapsHeadInfo.path.c_str()); 116 EXPECT_EQ(expectSmapsHeadInfo.iNode, smapsHeadInfo.iNode); 117 } 118 119 /** 120 * @tc.name: smaps stats 121 * @tc.desc: test ParseMapHead 122 * @tc.type: FUNC 123 */ 124 HWTEST_F(SmapsStatsTest, TestParseMapHead4, TestSize.Level1) 125 { 126 std::string line = "00400000-00409000 r-xp 00000000 fc:00\n"; 127 SmapsStats plugin; 128 MapPiecesInfo expectMappic = {0x00400000, 0x00409000, ""}; 129 MapPiecesInfo targetMappic = {0}; 130 SmapsHeadInfo expectSmapsHeadInfo = {"00400000", "00409000", "r-x", "", -1}; 131 SmapsHeadInfo smapsHeadInfo = {}; 132 ASSERT_FALSE(plugin.ParseMapHead(line, targetMappic, smapsHeadInfo)); 133 // test result 134 EXPECT_EQ(expectMappic.startAddr, targetMappic.startAddr); 135 EXPECT_EQ(expectMappic.endAddr, targetMappic.endAddr); 136 EXPECT_STREQ(expectMappic.name.c_str(), targetMappic.name.c_str()); 137 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 138 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 139 EXPECT_STREQ(expectSmapsHeadInfo.permission.c_str(), smapsHeadInfo.permission.c_str()); 140 EXPECT_STREQ(expectSmapsHeadInfo.path.c_str(), smapsHeadInfo.path.c_str()); 141 EXPECT_EQ(expectSmapsHeadInfo.iNode, smapsHeadInfo.iNode); 142 } 143 144 /** 145 * @tc.name: smaps stats 146 * @tc.desc: test ParseMapHead 147 * @tc.type: FUNC 148 */ 149 HWTEST_F(SmapsStatsTest, TestParseMapHead5, TestSize.Level1) 150 { 151 std::string line = "00400000-00409000 r-xp 00000000 fc:00 426998\n"; 152 SmapsStats plugin; 153 MapPiecesInfo expectMappic = {0x00400000, 0x00409000, ""}; 154 MapPiecesInfo targetMappic = {0}; 155 SmapsHeadInfo expectSmapsHeadInfo = {"00400000", "00409000", "r-x", "", -1}; 156 SmapsHeadInfo smapsHeadInfo = {}; 157 ASSERT_FALSE(plugin.ParseMapHead(line, targetMappic, smapsHeadInfo)); 158 // test result 159 EXPECT_EQ(expectMappic.startAddr, targetMappic.startAddr); 160 EXPECT_EQ(expectMappic.endAddr, targetMappic.endAddr); 161 EXPECT_STREQ(expectMappic.name.c_str(), targetMappic.name.c_str()); 162 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 163 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 164 EXPECT_STREQ(expectSmapsHeadInfo.permission.c_str(), smapsHeadInfo.permission.c_str()); 165 EXPECT_STREQ(expectSmapsHeadInfo.path.c_str(), smapsHeadInfo.path.c_str()); 166 EXPECT_EQ(expectSmapsHeadInfo.iNode, smapsHeadInfo.iNode); 167 } 168 169 /** 170 * @tc.name: smaps stats 171 * @tc.desc: test ParseMapHead 172 * @tc.type: FUNC 173 */ 174 HWTEST_F(SmapsStatsTest, TestParseMapHead6, TestSize.Level1) 175 { 176 std::string line = "00400000-00409000 r-xp 00000000 fc:00 426998 /usr/lib/gvfs/gvfsd-http\n"; 177 SmapsStats plugin; 178 MapPiecesInfo expectMappic = {0x00400000, 0x00409000, "/usr/lib/gvfs/gvfsd-http"}; 179 MapPiecesInfo targetMappic = {0}; 180 SmapsHeadInfo expectSmapsHeadInfo = {"00400000", "00409000", "r-x", "/usr/lib/gvfs/gvfsd-http", 426998}; 181 SmapsHeadInfo smapsHeadInfo = {}; 182 ASSERT_TRUE(plugin.ParseMapHead(line, targetMappic, smapsHeadInfo)); 183 // test result 184 EXPECT_EQ(expectMappic.startAddr, targetMappic.startAddr); 185 EXPECT_EQ(expectMappic.endAddr, targetMappic.endAddr); 186 EXPECT_STREQ(expectMappic.name.c_str(), targetMappic.name.c_str()); 187 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 188 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 189 EXPECT_STREQ(expectSmapsHeadInfo.permission.c_str(), smapsHeadInfo.permission.c_str()); 190 EXPECT_STREQ(expectSmapsHeadInfo.path.c_str(), smapsHeadInfo.path.c_str()); 191 EXPECT_EQ(expectSmapsHeadInfo.iNode, smapsHeadInfo.iNode); 192 } 193 194 /** 195 * @tc.name: smaps stats 196 * @tc.desc: test ParseMapHead 197 * @tc.type: FUNC 198 */ 199 HWTEST_F(SmapsStatsTest, TestParseMapHead7, TestSize.Level1) 200 { 201 std::string line = "00400000-00409000 r-xp 00000000 fc:00 426998 /usr/lib/gvfs/gvfsd-http"; 202 SmapsStats plugin; 203 MapPiecesInfo expectMappic = {0x00400000, 0x00409000, "/usr/lib/gvfs/gvfsd-htt"}; 204 MapPiecesInfo targetMappic = {0}; 205 SmapsHeadInfo expectSmapsHeadInfo = {"00400000", "00409000", "r-x", "/usr/lib/gvfs/gvfsd-htt", 426998}; 206 SmapsHeadInfo smapsHeadInfo = {}; 207 ASSERT_TRUE(plugin.ParseMapHead(line, targetMappic, smapsHeadInfo)); 208 // test result 209 EXPECT_EQ(expectMappic.startAddr, targetMappic.startAddr); 210 EXPECT_EQ(expectMappic.endAddr, targetMappic.endAddr); 211 EXPECT_STREQ(expectMappic.name.c_str(), targetMappic.name.c_str()); 212 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 213 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 214 EXPECT_STREQ(expectSmapsHeadInfo.permission.c_str(), smapsHeadInfo.permission.c_str()); 215 EXPECT_STREQ(expectSmapsHeadInfo.path.c_str(), smapsHeadInfo.path.c_str()); 216 EXPECT_EQ(expectSmapsHeadInfo.iNode, smapsHeadInfo.iNode); 217 } 218 219 /** 220 * @tc.name: smaps stats 221 * @tc.desc: test ParseMapHead 222 * @tc.type: FUNC 223 */ 224 HWTEST_F(SmapsStatsTest, TestParseMapHead8, TestSize.Level1) 225 { 226 std::string line = "564045dbe000-564045ddf000 rw-p 00000000 00:00 0 [heap]"; 227 SmapsStats plugin; 228 MapPiecesInfo expectMappic = {0x564045dbe000, 0x564045ddf000, "[heap"}; 229 MapPiecesInfo targetMappic = {0}; 230 SmapsHeadInfo expectSmapsHeadInfo = {"564045dbe000", "564045ddf000", "rw-", "[heap", 0}; 231 SmapsHeadInfo smapsHeadInfo = {}; 232 ASSERT_TRUE(plugin.ParseMapHead(line, targetMappic, smapsHeadInfo)); 233 // test result 234 EXPECT_EQ(expectMappic.startAddr, targetMappic.startAddr); 235 EXPECT_EQ(expectMappic.endAddr, targetMappic.endAddr); 236 EXPECT_STREQ(expectMappic.name.c_str(), targetMappic.name.c_str()); 237 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 238 EXPECT_STREQ(expectSmapsHeadInfo.startAddrStr.c_str(), smapsHeadInfo.startAddrStr.c_str()); 239 EXPECT_STREQ(expectSmapsHeadInfo.permission.c_str(), smapsHeadInfo.permission.c_str()); 240 EXPECT_STREQ(expectSmapsHeadInfo.path.c_str(), smapsHeadInfo.path.c_str()); 241 EXPECT_EQ(expectSmapsHeadInfo.iNode, smapsHeadInfo.iNode); 242 } 243 244 /** 245 * @tc.name: smaps stats 246 * @tc.desc: test GetMemUsageField 247 * @tc.type: FUNC 248 */ 249 HWTEST_F(SmapsStatsTest, TestGetMemUsageField1, TestSize.Level1) 250 { 251 std::string line = "Pss: 4 kB"; 252 SmapsStats plugin; 253 MemUsageInfo expect = {0, 0, 4}; 254 MemUsageInfo target = {0}; 255 256 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 257 // test result 258 EXPECT_EQ(expect.vss, target.vss); 259 EXPECT_EQ(expect.rss, target.rss); 260 EXPECT_EQ(expect.pss, target.pss); 261 EXPECT_EQ(expect.uss, target.uss); 262 EXPECT_EQ(expect.swap, target.swap); 263 EXPECT_EQ(expect.swapPss, target.swapPss); 264 EXPECT_EQ(expect.privateClean, target.privateClean); 265 EXPECT_EQ(expect.privateDirty, target.privateDirty); 266 EXPECT_EQ(expect.sharedClean, target.sharedClean); 267 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 268 } 269 270 /** 271 * @tc.name: smaps stats 272 * @tc.desc: test GetMemUsageField 273 * @tc.type: FUNC 274 */ 275 HWTEST_F(SmapsStatsTest, TestGetMemUsageField2, TestSize.Level1) 276 { 277 std::string line = "Private_Clean: 0 kB"; 278 SmapsStats plugin; 279 MemUsageInfo expect = {0}; 280 MemUsageInfo target = {0}; 281 282 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 283 // test result 284 EXPECT_EQ(expect.vss, target.vss); 285 EXPECT_EQ(expect.rss, target.rss); 286 EXPECT_EQ(expect.pss, target.pss); 287 EXPECT_EQ(expect.uss, target.uss); 288 EXPECT_EQ(expect.swap, target.swap); 289 EXPECT_EQ(expect.swapPss, target.swapPss); 290 EXPECT_EQ(expect.privateClean, target.privateClean); 291 EXPECT_EQ(expect.privateDirty, target.privateDirty); 292 EXPECT_EQ(expect.sharedClean, target.sharedClean); 293 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 294 } 295 296 /** 297 * @tc.name: smaps stats 298 * @tc.desc: test GetMemUsageField 299 * @tc.type: FUNC 300 */ 301 HWTEST_F(SmapsStatsTest, TestGetMemUsageField3, TestSize.Level1) 302 { 303 std::string line = "Private_Dirty: 4 kB"; 304 SmapsStats plugin; 305 uint64_t num = 4; 306 MemUsageInfo expect = {0}; 307 MemUsageInfo target = {0}; 308 309 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 310 // test result 311 expect.privateDirty = num; 312 expect.uss += num; 313 EXPECT_EQ(expect.vss, target.vss); 314 EXPECT_EQ(expect.rss, target.rss); 315 EXPECT_EQ(expect.pss, target.pss); 316 EXPECT_EQ(expect.uss, target.uss); 317 EXPECT_EQ(expect.swap, target.swap); 318 EXPECT_EQ(expect.swapPss, target.swapPss); 319 EXPECT_EQ(expect.privateClean, target.privateClean); 320 EXPECT_EQ(expect.privateDirty, target.privateDirty); 321 EXPECT_EQ(expect.sharedClean, target.sharedClean); 322 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 323 } 324 325 /** 326 * @tc.name: smaps stats 327 * @tc.desc: test GetMemUsageField 328 * @tc.type: FUNC 329 */ 330 HWTEST_F(SmapsStatsTest, TestGetMemUsageField4, TestSize.Level1) 331 { 332 std::string line = "Size: 4 kB"; 333 SmapsStats plugin; 334 uint64_t num = 4; 335 MemUsageInfo expect = {0}; 336 MemUsageInfo target = {0}; 337 338 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 339 // test result 340 expect.vss = num; 341 EXPECT_EQ(expect.vss, target.vss); 342 EXPECT_EQ(expect.rss, target.rss); 343 EXPECT_EQ(expect.pss, target.pss); 344 EXPECT_EQ(expect.uss, target.uss); 345 EXPECT_EQ(expect.swap, target.swap); 346 EXPECT_EQ(expect.swapPss, target.swapPss); 347 EXPECT_EQ(expect.privateClean, target.privateClean); 348 EXPECT_EQ(expect.privateDirty, target.privateDirty); 349 EXPECT_EQ(expect.sharedClean, target.sharedClean); 350 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 351 } 352 353 /** 354 * @tc.name: smaps stats 355 * @tc.desc: test GetMemUsageField 356 * @tc.type: FUNC 357 */ 358 HWTEST_F(SmapsStatsTest, TestGetMemUsageField5, TestSize.Level1) 359 { 360 std::string line = "Shared_Clean: 0 kB"; 361 SmapsStats plugin; 362 MemUsageInfo expect = {0}; 363 MemUsageInfo target = {0}; 364 365 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 366 // test result 367 EXPECT_EQ(expect.vss, target.vss); 368 EXPECT_EQ(expect.rss, target.rss); 369 EXPECT_EQ(expect.pss, target.pss); 370 EXPECT_EQ(expect.uss, target.uss); 371 EXPECT_EQ(expect.swap, target.swap); 372 EXPECT_EQ(expect.swapPss, target.swapPss); 373 EXPECT_EQ(expect.privateClean, target.privateClean); 374 EXPECT_EQ(expect.privateDirty, target.privateDirty); 375 EXPECT_EQ(expect.sharedClean, target.sharedClean); 376 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 377 } 378 379 /** 380 * @tc.name: smaps stats 381 * @tc.desc: test GetMemUsageField 382 * @tc.type: FUNC 383 */ 384 HWTEST_F(SmapsStatsTest, TestGetMemUsageField6, TestSize.Level1) 385 { 386 std::string line = "Shared_Dirty: 0 kB"; 387 SmapsStats plugin; 388 MemUsageInfo expect = {0}; 389 MemUsageInfo target = {0}; 390 391 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 392 // test result 393 EXPECT_EQ(expect.vss, target.vss); 394 EXPECT_EQ(expect.rss, target.rss); 395 EXPECT_EQ(expect.pss, target.pss); 396 EXPECT_EQ(expect.uss, target.uss); 397 EXPECT_EQ(expect.swap, target.swap); 398 EXPECT_EQ(expect.swapPss, target.swapPss); 399 EXPECT_EQ(expect.privateClean, target.privateClean); 400 EXPECT_EQ(expect.privateDirty, target.privateDirty); 401 EXPECT_EQ(expect.sharedClean, target.sharedClean); 402 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 403 } 404 405 /** 406 * @tc.name: smaps stats 407 * @tc.desc: test GetMemUsageField 408 * @tc.type: FUNC 409 */ 410 HWTEST_F(SmapsStatsTest, TestGetMemUsageField7, TestSize.Level1) 411 { 412 std::string line = "Swap: 0 kB"; 413 SmapsStats plugin; 414 MemUsageInfo expect = {0}; 415 MemUsageInfo target = {0}; 416 417 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 418 // test result 419 EXPECT_EQ(expect.vss, target.vss); 420 EXPECT_EQ(expect.rss, target.rss); 421 EXPECT_EQ(expect.pss, target.pss); 422 EXPECT_EQ(expect.uss, target.uss); 423 EXPECT_EQ(expect.swap, target.swap); 424 EXPECT_EQ(expect.swapPss, target.swapPss); 425 EXPECT_EQ(expect.privateClean, target.privateClean); 426 EXPECT_EQ(expect.privateDirty, target.privateDirty); 427 EXPECT_EQ(expect.sharedClean, target.sharedClean); 428 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 429 } 430 431 /** 432 * @tc.name: smaps stats 433 * @tc.desc: test GetMemUsageField 434 * @tc.type: FUNC 435 */ 436 HWTEST_F(SmapsStatsTest, TestGetMemUsageField8, TestSize.Level1) 437 { 438 std::string line = "SwapPss: 0 kB"; 439 SmapsStats plugin; 440 MemUsageInfo expect = {0}; 441 MemUsageInfo target = {0}; 442 443 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 444 // test result 445 EXPECT_EQ(expect.vss, target.vss); 446 EXPECT_EQ(expect.rss, target.rss); 447 EXPECT_EQ(expect.pss, target.pss); 448 EXPECT_EQ(expect.uss, target.uss); 449 EXPECT_EQ(expect.swap, target.swap); 450 EXPECT_EQ(expect.swapPss, target.swapPss); 451 EXPECT_EQ(expect.privateClean, target.privateClean); 452 EXPECT_EQ(expect.privateDirty, target.privateDirty); 453 EXPECT_EQ(expect.sharedClean, target.sharedClean); 454 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 455 } 456 457 /** 458 * @tc.name: smaps stats 459 * @tc.desc: test GetMemUsageField 460 * @tc.type: FUNC 461 */ 462 HWTEST_F(SmapsStatsTest, TestGetMemUsageField9, TestSize.Level1) 463 { 464 std::string line = "Rss: 4 kB"; 465 SmapsStats plugin; 466 uint64_t num = 4; 467 MemUsageInfo expect = {0}; 468 MemUsageInfo target = {0}; 469 470 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 471 // test result 472 expect.rss = num; 473 EXPECT_EQ(expect.vss, target.vss); 474 EXPECT_EQ(expect.rss, target.rss); 475 EXPECT_EQ(expect.pss, target.pss); 476 EXPECT_EQ(expect.uss, target.uss); 477 EXPECT_EQ(expect.swap, target.swap); 478 EXPECT_EQ(expect.swapPss, target.swapPss); 479 EXPECT_EQ(expect.privateClean, target.privateClean); 480 EXPECT_EQ(expect.privateDirty, target.privateDirty); 481 EXPECT_EQ(expect.sharedClean, target.sharedClean); 482 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 483 } 484 485 /** 486 * @tc.name: smaps stats 487 * @tc.desc: test GetMemUsageField 488 * @tc.type: FUNC 489 */ 490 HWTEST_F(SmapsStatsTest, TestGetMemUsageField10, TestSize.Level1) 491 { 492 std::string line = "VmFlags: rd ex mr mw me dw sd"; 493 SmapsStats plugin; 494 MemUsageInfo expect = {0}; 495 MemUsageInfo target = {0}; 496 497 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 498 // test result 499 EXPECT_EQ(expect.vss, target.vss); 500 EXPECT_EQ(expect.rss, target.rss); 501 EXPECT_EQ(expect.pss, target.pss); 502 EXPECT_EQ(expect.uss, target.uss); 503 EXPECT_EQ(expect.swap, target.swap); 504 EXPECT_EQ(expect.swapPss, target.swapPss); 505 EXPECT_EQ(expect.privateClean, target.privateClean); 506 EXPECT_EQ(expect.privateDirty, target.privateDirty); 507 EXPECT_EQ(expect.sharedClean, target.sharedClean); 508 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 509 } 510 511 /** 512 * @tc.name: smaps stats 513 * @tc.desc: test GetMemUsageField 514 * @tc.type: FUNC 515 */ 516 HWTEST_F(SmapsStatsTest, TestGetMemUsageField11, TestSize.Level1) 517 { 518 std::string line = "Anonymous: 0 kB"; 519 SmapsStats plugin; 520 MemUsageInfo expect = {0}; 521 MemUsageInfo target = {0}; 522 523 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 524 // test result 525 EXPECT_EQ(expect.vss, target.vss); 526 EXPECT_EQ(expect.rss, target.rss); 527 EXPECT_EQ(expect.pss, target.pss); 528 EXPECT_EQ(expect.uss, target.uss); 529 EXPECT_EQ(expect.swap, target.swap); 530 EXPECT_EQ(expect.swapPss, target.swapPss); 531 EXPECT_EQ(expect.privateClean, target.privateClean); 532 EXPECT_EQ(expect.privateDirty, target.privateDirty); 533 EXPECT_EQ(expect.sharedClean, target.sharedClean); 534 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 535 } 536 537 /** 538 * @tc.name: smaps stats 539 * @tc.desc: test GetMemUsageField 540 * @tc.type: FUNC 541 */ 542 HWTEST_F(SmapsStatsTest, TestAbnormalGetMemUsageField1, TestSize.Level1) 543 { 544 std::string line = "Pss:"; 545 SmapsStats plugin; 546 MemUsageInfo expect = {0}; 547 MemUsageInfo target = {0}; 548 549 ASSERT_TRUE(plugin.GetMemUsageField(line, target)); 550 // test result 551 EXPECT_EQ(expect.vss, target.vss); 552 EXPECT_EQ(expect.rss, target.rss); 553 EXPECT_EQ(expect.pss, target.pss); 554 EXPECT_EQ(expect.uss, target.uss); 555 EXPECT_EQ(expect.swap, target.swap); 556 EXPECT_EQ(expect.swapPss, target.swapPss); 557 EXPECT_EQ(expect.privateClean, target.privateClean); 558 EXPECT_EQ(expect.privateDirty, target.privateDirty); 559 EXPECT_EQ(expect.sharedClean, target.sharedClean); 560 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 561 } 562 563 /** 564 * @tc.name: smaps stats 565 * @tc.desc: test GetMemUsageField 566 * @tc.type: FUNC 567 */ 568 HWTEST_F(SmapsStatsTest, TestAbnormalGetMemUsageField2, TestSize.Level1) 569 { 570 std::string line = "Pss"; 571 SmapsStats plugin; 572 MemUsageInfo expect = {0}; 573 MemUsageInfo target = {0}; 574 575 ASSERT_FALSE(plugin.GetMemUsageField(line, target)); 576 // test result 577 EXPECT_EQ(expect.vss, target.vss); 578 EXPECT_EQ(expect.rss, target.rss); 579 EXPECT_EQ(expect.pss, target.pss); 580 EXPECT_EQ(expect.uss, target.uss); 581 EXPECT_EQ(expect.swap, target.swap); 582 EXPECT_EQ(expect.swapPss, target.swapPss); 583 EXPECT_EQ(expect.privateClean, target.privateClean); 584 EXPECT_EQ(expect.privateDirty, target.privateDirty); 585 EXPECT_EQ(expect.sharedClean, target.sharedClean); 586 EXPECT_EQ(expect.sharedDirty, target.sharedDirty); 587 } 588 589 namespace { 590 const char* SMAPS_FORMAT = R"(5637ebe15000-5637ebe16000 r-xp 00000000 08:01 4587541 test/run 591 Size: 4 kB 592 Rss: 4 kB 593 Pss: 4 kB 594 Shared_Clean: 0 kB 595 Shared_Dirty: 0 kB 596 Private_Clean: 4 kB 597 Private_Dirty: 0 kB 598 Anonymous: 0 kB 599 Swap: 0 kB 600 SwapPss: 0 kB 601 LazyFree: 1 kB 602 AnonHugePages: 1 kB 603 ShmemPmdMapped: 1 kB 604 FilePmdMapped: 1 kB 605 Shared_Hugetlb: 1 kB 606 Private_Hugetlb: 1 kB 607 Locked: 1 kB 608 THPeligible: 1 609 VmFlags: rd ex mr mw me dw sd 610 5637ec015000-5637ec016000 r--p 00000000 08:01 4587541 test/run 611 Size: 4 kB 612 Rss: 4 kB 613 Pss: 4 kB 614 Shared_Clean: 0 kB 615 Shared_Dirty: 0 kB 616 Private_Clean: 0 kB 617 Private_Dirty: 4 kB 618 Anonymous: 4 kB 619 Swap: 0 kB 620 SwapPss: 0 kB 621 VmFlags: rd mr mw me dw ac sd 622 5637ec016000-5637ec017000 rw-p 00001000 08:01 4587541 test/run 623 Size: 4 kB 624 Rss: 4 kB 625 Pss: 4 kB 626 Shared_Clean: 0 kB 627 Shared_Dirty: 0 kB 628 Private_Clean: 0 kB 629 Private_Dirty: 4 kB 630 Anonymous: 4 kB 631 Swap: 0 kB 632 SwapPss: 0 kB 633 VmFlags: rd wr mr mw me dw ac sd 634 5637ec60f000-5637ec630000 rw-p 00000000 00:00 0 [heap] 635 Size: 132 kB 636 Rss: 4 kB 637 Pss: 4 kB 638 Shared_Clean: 0 kB 639 Shared_Dirty: 0 kB 640 Private_Clean: 0 kB 641 Private_Dirty: 4 kB 642 Anonymous: 4 kB 643 Swap: 0 kB 644 SwapPss: 0 kB 645 VmFlags: rd wr mr mw me ac sd 646 7fa384a9e000-7fa384c85000 r-xp 00000000 08:01 929310 /lib/x86_64-linux-gnu/libc-2.27.so 647 Size: 1948 kB 648 Rss: 1200 kB 649 Pss: 20 kB 650 Shared_Clean: 1200 kB 651 Shared_Dirty: 0 kB 652 Private_Clean: 0 kB 653 Private_Dirty: 0 kB 654 Anonymous: 0 kB 655 Swap: 0 kB 656 SwapPss: 0 kB 657 VmFlags: rd ex mr mw me sd 658 7fa384c85000-7fa384e85000 ---p 001e7000 08:01 929310 /lib/x86_64-linux-gnu/libc-2.27.so 659 Size: 2048 kB 660 Rss: 0 kB 661 Pss: 0 kB 662 Shared_Clean: 0 kB 663 Shared_Dirty: 0 kB 664 Private_Clean: 0 kB 665 Private_Dirty: 0 kB 666 Anonymous: 0 kB 667 Swap: 0 kB 668 SwapPss: 0 kB 669 VmFlags: mr mw me sd 670 7fa384e85000-7fa384e89000 r--p 001e7000 08:01 929310 /lib/x86_64-linux-gnu/libc-2.27.so 671 Size: 16 kB 672 Rss: 16 kB 673 Pss: 16 kB 674 Shared_Clean: 0 kB 675 Shared_Dirty: 0 kB 676 Private_Clean: 0 kB 677 Private_Dirty: 16 kB 678 Anonymous: 16 kB 679 Swap: 0 kB 680 SwapPss: 0 kB 681 VmFlags: rd mr mw me ac sd 682 7fa384e89000-7fa384e8b000 rw-p 001eb000 08:01 929310 /lib/x86_64-linux-gnu/libc-2.27.so 683 Size: 8 kB 684 Rss: 8 kB 685 Pss: 8 kB 686 Shared_Clean: 0 kB 687 Shared_Dirty: 0 kB 688 Private_Clean: 0 kB 689 Private_Dirty: 8 kB 690 Anonymous: 8 kB 691 Swap: 0 kB 692 SwapPss: 0 kB 693 VmFlags: rd wr mr mw me ac sd 694 7fa384e8b000-7fa384e8f000 rw-p 00000000 00:00 0 695 Size: 16 kB 696 Rss: 12 kB 697 Pss: 12 kB 698 Shared_Clean: 0 kB 699 Shared_Dirty: 0 kB 700 Private_Clean: 0 kB 701 Private_Dirty: 12 kB 702 Anonymous: 12 kB 703 Swap: 0 kB 704 SwapPss: 0 kB 705 VmFlags: rd wr mr mw me ac sd 706 7fa384e8f000-7fa384eb8000 r-xp 00000000 08:01 927476 /lib/x86_64-linux-gnu/ld-2.27.so 707 Size: 164 kB 708 Rss: 164 kB 709 Pss: 3 kB 710 Shared_Clean: 164 kB 711 Shared_Dirty: 0 kB 712 Private_Clean: 0 kB 713 Private_Dirty: 0 kB 714 Anonymous: 0 kB 715 Swap: 0 kB 716 SwapPss: 0 kB 717 VmFlags: rd ex mr mw me dw sd 718 7fa3850a1000-7fa3850a3000 rw-p 00000000 00:00 0 719 Size: 8 kB 720 Rss: 8 kB 721 Pss: 8 kB 722 Shared_Clean: 0 kB 723 Shared_Dirty: 0 kB 724 Private_Clean: 0 kB 725 Private_Dirty: 8 kB 726 Anonymous: 8 kB 727 Swap: 0 kB 728 SwapPss: 0 kB 729 VmFlags: rd wr mr mw me ac sd 730 7fa3850b8000-7fa3850b9000 r--p 00029000 08:01 927476 /lib/x86_64-linux-gnu/ld-2.27.so 731 Size: 4 kB 732 Rss: 4 kB 733 Pss: 4 kB 734 Shared_Clean: 0 kB 735 Shared_Dirty: 0 kB 736 Private_Clean: 0 kB 737 Private_Dirty: 4 kB 738 Anonymous: 4 kB 739 Swap: 0 kB 740 SwapPss: 0 kB 741 VmFlags: rd mr mw me dw ac sd 742 7fa3850b9000-7fa3850ba000 rw-p 0002a000 08:01 927476 /lib/x86_64-linux-gnu/ld-2.27.so 743 Size: 4 kB 744 Rss: 4 kB 745 Pss: 4 kB 746 Shared_Clean: 0 kB 747 Shared_Dirty: 0 kB 748 Private_Clean: 0 kB 749 Private_Dirty: 4 kB 750 Anonymous: 4 kB 751 Swap: 0 kB 752 SwapPss: 0 kB 753 VmFlags: rd wr mr mw me dw ac sd 754 7fa3850ba000-7fa3850bb000 rw-p 00000000 00:00 0 755 Size: 4 kB 756 Rss: 4 kB 757 Pss: 4 kB 758 Shared_Clean: 0 kB 759 Shared_Dirty: 0 kB 760 Private_Clean: 0 kB 761 Private_Dirty: 4 kB 762 Anonymous: 4 kB 763 Swap: 0 kB 764 SwapPss: 0 kB 765 VmFlags: rd wr mr mw me ac sd 766 7ffc54ec0000-7ffc54ee1000 rw-p 00000000 00:00 0 [stack] 767 Size: 132 kB 768 Rss: 12 kB 769 Pss: 12 kB 770 Shared_Clean: 0 kB 771 Shared_Dirty: 0 kB 772 Private_Clean: 0 kB 773 Private_Dirty: 12 kB 774 Anonymous: 12 kB 775 Swap: 0 kB 776 SwapPss: 0 kB 777 VmFlags: rd wr mr mw me gd ac 778 7ffc54f1c000-7ffc54f1f000 r--p 00000000 00:00 0 [vvar] 779 Size: 12 kB 780 Rss: 0 kB 781 Pss: 0 kB 782 Shared_Clean: 0 kB 783 Shared_Dirty: 0 kB 784 Private_Clean: 0 kB 785 Private_Dirty: 0 kB 786 Anonymous: 0 kB 787 Swap: 0 kB 788 SwapPss: 0 kB 789 VmFlags: rd mr pf io de dd sd 790 7ffc54f1f000-7ffc54f20000 r-xp 00000000 00:00 0 [vdso] 791 Size: 4 kB 792 Rss: 4 kB 793 Pss: 0 kB 794 Shared_Clean: 4 kB 795 Shared_Dirty: 0 kB 796 Private_Clean: 0 kB 797 Private_Dirty: 0 kB 798 Anonymous: 0 kB 799 Swap: 0 kB 800 SwapPss: 0 kB 801 VmFlags: rd ex mr mw me de sd 802 ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall] 803 Size: 4 kB 804 MMUPageSize: 4 kB 805 Rss: 0 kB 806 Pss: 0 kB 807 Shared_Clean: 0 kB 808 Shared_Dirty: 0 kB 809 Private_Clean: 0 kB 810 Private_Dirty: 0 kB 811 Anonymous: 0 kB 812 Swap: 0 kB 813 SwapPss: 0 kB 814 VmFlags: ex)"; 815 } 816 817 /** 818 * @tc.name: smaps stats 819 * @tc.desc: test ReadVmemareasFile 820 * @tc.type: FUNC 821 */ 822 HWTEST_F(SmapsStatsTest, TestFramework, TestSize.Level1) 823 { 824 bool findMapHead = false; 825 MapPiecesInfo mappic = {0}; 826 MemUsageInfo memusage = {0}; 827 SmapsHeadInfo smapsHeadInfo = {}; 828 // 3036, 4256, 288, 748, 0, 1388 829 uint64_t prevEnd = 0; 830 int prevHeap = 0; 831 uint64_t java_heap = 0; 832 uint64_t native_heap = 4; 833 uint64_t code = 48; 834 uint64_t stack = 12; 835 uint64_t graphics = 0; 836 uint64_t private_other = 20; 837 SmapsStats plugin; 838 std::istringstream ss(SMAPS_FORMAT); 839 std::string line; 840 841 while (std::getline(ss, line)) { 842 line += '\n'; 843 if (!findMapHead) { 844 ASSERT_TRUE(plugin.ParseMapHead(line, mappic, smapsHeadInfo)); 845 findMapHead = true; 846 continue; 847 } 848 if (findMapHead) { 849 if (line.substr(0, strlen("VmFlags:")) != std::string("VmFlags:")) { 850 ASSERT_TRUE(plugin.GetMemUsageField(line, memusage)); 851 continue; 852 } 853 } 854 plugin.CollectVmemAreasData(mappic, memusage, prevEnd, prevHeap); 855 findMapHead = false; 856 } 857 plugin.ReviseStatsData(); 858 859 // test result 860 EXPECT_EQ(java_heap, (uint64_t)(plugin.GetProcessJavaHeap())); 861 EXPECT_EQ(native_heap, (uint64_t)(plugin.GetProcessNativeHeap())); 862 EXPECT_EQ(code, (uint64_t)(plugin.GetProcessCode())); 863 EXPECT_EQ(stack, (uint64_t)(plugin.GetProcessStack())); 864 EXPECT_EQ(graphics, (uint64_t)(plugin.GetProcessGraphics())); 865 EXPECT_EQ(private_other, (uint64_t)(plugin.GetProcessPrivateOther())); 866 } 867 868 /** 869 * @tc.name: smaps stats 870 * @tc.desc: test ParseMaps 871 * @tc.type: FUNC 872 */ 873 HWTEST_F(SmapsStatsTest, TestFrameworkForPath, TestSize.Level1) 874 { 875 // 3036, 4256, 288, 748, 0, 1388 876 int pid = 2; 877 uint64_t java_heap = 0; 878 uint64_t native_heap = 4; 879 uint64_t code = 48; 880 uint64_t stack = 12; 881 uint64_t graphics = 0; 882 uint64_t private_other = 20; 883 884 uint64_t size = 4; 885 uint64_t rss = 4; 886 uint64_t pss = 4; 887 uint64_t dirty = 0; 888 uint64_t swap1 = 1; 889 uint64_t swapPss1 = 2; 890 uint64_t swapper1 = swap1 + swapPss1; 891 uint64_t swap2 = 11152; 892 uint64_t swapPss2 = 10800; 893 uint64_t swapper2 = swap2 + swapPss2; 894 double reside = static_cast<double>(rss) / size * PERCENT; 895 uint64_t dirty2 = 4; 896 uint64_t sharedClean1 = 0; 897 uint64_t sharedDirty1 = 0; 898 uint64_t privateClean1 = 4; 899 uint64_t privateDirty1 = 0; 900 uint64_t sharedClean2 = 0; 901 uint64_t sharedDirty2 = 0; 902 uint64_t privateClean2 = 0; 903 uint64_t privateDirty2 = 4; 904 905 ASSERT_EQ(access(DEFAULT_TEST_PATH.c_str(), F_OK), 0); 906 SmapsStats plugin(DEFAULT_TEST_PATH + std::string("proc/")); 907 908 // test result 909 ProcessMemoryInfo processMemoryInfo; 910 SmapsInfo* smapsInfo = nullptr; 911 ASSERT_TRUE(plugin.ParseMaps(pid, processMemoryInfo, smapsInfo, true, true)); 912 EXPECT_EQ(java_heap, (uint64_t)(plugin.GetProcessJavaHeap())); 913 EXPECT_EQ(native_heap, (uint64_t)(plugin.GetProcessNativeHeap())); 914 EXPECT_EQ(code, (uint64_t)(plugin.GetProcessCode())); 915 EXPECT_EQ(stack, (uint64_t)(plugin.GetProcessStack())); 916 EXPECT_EQ(graphics, (uint64_t)(plugin.GetProcessGraphics())); 917 EXPECT_EQ(private_other, (uint64_t)(plugin.GetProcessPrivateOther())); 918 919 EXPECT_EQ(size, processMemoryInfo.smapinfo(0).size()); 920 EXPECT_EQ(rss, processMemoryInfo.smapinfo(0).rss()); 921 EXPECT_EQ(pss, processMemoryInfo.smapinfo(0).pss()); 922 EXPECT_EQ(dirty, processMemoryInfo.smapinfo(0).dirty()); 923 EXPECT_EQ(swapper1, processMemoryInfo.smapinfo(0).swapper()); 924 EXPECT_EQ(reside, processMemoryInfo.smapinfo(0).reside()); 925 EXPECT_EQ(swap1, processMemoryInfo.smapinfo(0).swap()); 926 EXPECT_EQ(swapPss1, processMemoryInfo.smapinfo(0).swap_pss()); 927 EXPECT_EQ(sharedClean1, processMemoryInfo.smapinfo(0).shared_clean()); 928 EXPECT_EQ(sharedDirty1, processMemoryInfo.smapinfo(0).shared_dirty()); 929 EXPECT_EQ(privateClean1, processMemoryInfo.smapinfo(0).private_clean()); 930 EXPECT_EQ(privateDirty1, processMemoryInfo.smapinfo(0).private_dirty()); 931 EXPECT_EQ(size, processMemoryInfo.smapinfo(1).size()); 932 EXPECT_EQ(rss, processMemoryInfo.smapinfo(1).rss()); 933 EXPECT_EQ(pss, processMemoryInfo.smapinfo(1).pss()); 934 EXPECT_EQ(dirty2, processMemoryInfo.smapinfo(1).dirty()); 935 EXPECT_EQ(swapper2, processMemoryInfo.smapinfo(1).swapper()); 936 EXPECT_EQ(reside, processMemoryInfo.smapinfo(1).reside()); 937 EXPECT_EQ(swap2, processMemoryInfo.smapinfo(1).swap()); 938 EXPECT_EQ(swapPss2, processMemoryInfo.smapinfo(1).swap_pss()); 939 EXPECT_EQ(sharedClean2, processMemoryInfo.smapinfo(1).shared_clean()); 940 EXPECT_EQ(sharedDirty2, processMemoryInfo.smapinfo(1).shared_dirty()); 941 EXPECT_EQ(privateClean2, processMemoryInfo.smapinfo(1).private_clean()); 942 EXPECT_EQ(privateDirty2, processMemoryInfo.smapinfo(1).private_dirty()); 943 } 944 945 /** 946 * @tc.name: smaps stats 947 * @tc.desc: test check framework 948 * @tc.type: FUNC 949 */ 950 HWTEST_F(SmapsStatsTest, TestCheckFramework, TestSize.Level1) 951 { 952 bool findMapHead = false; 953 MapPiecesInfo mappic = {0}; 954 MemUsageInfo memusage = {0}; 955 SmapsHeadInfo smapsHeadInfo = {}; 956 uint64_t prevEnd = 0; 957 int prevHeap = 0; 958 SmapsStats testPlugin; 959 int pid = 2; 960 std::istringstream ss(SMAPS_FORMAT); 961 std::string line; 962 963 while (std::getline(ss, line)) { 964 line += '\n'; 965 if (!findMapHead) { 966 ASSERT_TRUE(testPlugin.ParseMapHead(line, mappic, smapsHeadInfo)); 967 findMapHead = true; 968 continue; 969 } 970 if (findMapHead) { 971 if (line.substr(0, strlen("VmFlags:")) != std::string("VmFlags:")) { 972 ASSERT_TRUE(testPlugin.GetMemUsageField(line, memusage)); 973 continue; 974 } 975 } 976 testPlugin.CollectVmemAreasData(mappic, memusage, prevEnd, prevHeap); 977 findMapHead = false; 978 } 979 testPlugin.ReviseStatsData(); 980 981 ASSERT_EQ(access(DEFAULT_TEST_PATH.c_str(), F_OK), 0); 982 SmapsStats targetPlugin(DEFAULT_TEST_PATH + std::string("proc/")); 983 ProcessMemoryInfo processMemoryInfo; 984 SmapsInfo* smapsInfo = nullptr; 985 ASSERT_TRUE(targetPlugin.ParseMaps(pid, processMemoryInfo, smapsInfo, true, false)); 986 987 // test result 988 EXPECT_EQ(testPlugin.GetProcessJavaHeap(), targetPlugin.GetProcessJavaHeap()); 989 EXPECT_EQ(testPlugin.GetProcessNativeHeap(), targetPlugin.GetProcessNativeHeap()); 990 EXPECT_EQ(testPlugin.GetProcessCode(), targetPlugin.GetProcessCode()); 991 EXPECT_EQ(testPlugin.GetProcessStack(), targetPlugin.GetProcessStack()); 992 EXPECT_EQ(testPlugin.GetProcessGraphics(), targetPlugin.GetProcessGraphics()); 993 EXPECT_EQ(testPlugin.GetProcessPrivateOther(), targetPlugin.GetProcessPrivateOther()); 994 } 995 } // namespace