You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2020/05/20 23:22:56 UTC
[mesos] 02/02: Added a test for os::memory.
This is an automated email from the ASF dual-hosted git repository.
bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 5a04a1693e4f1d51007c23728f1884a307e229a1
Author: James Wright <ja...@digital-chaos.com>
AuthorDate: Wed May 20 19:21:54 2020 -0400
Added a test for os::memory.
---
3rdparty/stout/tests/os_tests.cpp | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/3rdparty/stout/tests/os_tests.cpp b/3rdparty/stout/tests/os_tests.cpp
index 4231303..6b04181 100644
--- a/3rdparty/stout/tests/os_tests.cpp
+++ b/3rdparty/stout/tests/os_tests.cpp
@@ -1289,3 +1289,20 @@ TEST_F(OsTest, Which)
which = os::which("bar");
EXPECT_NONE(which);
}
+
+
+TEST_F(OsTest, Memory)
+{
+ Try<os::Memory> memory = os::memory();
+ ASSERT_SOME(memory);
+
+ // Verify total memory is greater than zero.
+ EXPECT_GT(memory->total, 0);
+
+ // Verify free memory is greater than zero and less than total.
+ EXPECT_GT(memory->free, 0);
+ EXPECT_LT(memory->free, memory->total);
+
+ // Verify freeSwap is less than or equal to totalSwap (both can be zero)
+ EXPECT_LE(memory->freeSwap, memory->totalSwap);
+}