diff options
author | chris.zn <chris.zn@alibaba-inc.com> | 2019-05-29 16:48:19 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-05-30 12:07:40 -0700 |
commit | b18df9bed6af3ff9b526c9ebdcde33dffeac161e (patch) | |
tree | e5b3b56d1edc92f3d9853245f7161393ead4428b /test/syscalls/linux | |
parent | 035a8fa38ed21da2e06db22d3dfd6122610fb856 (diff) |
Add VmData field to /proc/{pid}/status
VmData is the size of private data segments.
It has the same meaning as in Linux.
Change-Id: Iebf1ae85940a810524a6cde9c2e767d4233ddb2a
PiperOrigin-RevId: 250593739
Diffstat (limited to 'test/syscalls/linux')
-rw-r--r-- | test/syscalls/linux/proc.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/syscalls/linux/proc.cc b/test/syscalls/linux/proc.cc index e2e8a4ff1..ede6fb860 100644 --- a/test/syscalls/linux/proc.cc +++ b/test/syscalls/linux/proc.cc @@ -1180,7 +1180,7 @@ bool IsDigits(absl::string_view s) { return std::all_of(s.begin(), s.end(), absl::ascii_isdigit); } -TEST(ProcPidStatTest, VSSRSS) { +TEST(ProcPidStatTest, VmStats) { std::string status_str = ASSERT_NO_ERRNO_AND_VALUE(GetContents("/proc/self/status")); ASSERT_FALSE(status_str.empty()); @@ -1211,6 +1211,19 @@ TEST(ProcPidStatTest, VSSRSS) { EXPECT_TRUE(IsDigits(rss_str.substr(0, rss_str.length() - 3))) << rss_str; // ... which is not 0. EXPECT_NE('0', rss_str[0]); + + const auto data_it = status.find("VmData"); + ASSERT_NE(data_it, status.end()); + + absl::string_view data_str(data_it->second); + + // Room for the " kB" suffix plus at least one digit. + ASSERT_GT(data_str.length(), 3); + EXPECT_TRUE(absl::EndsWith(data_str, " kB")); + // Everything else is part of a number. + EXPECT_TRUE(IsDigits(data_str.substr(0, data_str.length() - 3))) << data_str; + // ... which is not 0. + EXPECT_NE('0', data_str[0]); } // Parse an array of NUL-terminated char* arrays, returning a vector of strings. |