You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2018/09/21 12:13:02 UTC

[mesos] branch master updated: Fixed stout `FsTest.Used` test.

This is an automated email from the ASF dual-hosted git repository.

tillt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new ee051d7  Fixed stout `FsTest.Used` test.
ee051d7 is described below

commit ee051d77c0229a59c178ed5972681223937c7609
Author: James Peach <jp...@apache.org>
AuthorDate: Fri Sep 21 14:12:42 2018 +0200

    Fixed stout `FsTest.Used` test.
    
    The `f_bsize` elemement denotes the preferred filesystem block
    size, not the unit that `f_blocks` is counting in. We need to
    use `f_frsize` for that.
    
    Remove the check for used space on `/dev` since that is not even
    portable across different Linux distributions.
    
    Review: https://reviews.apache.org/r/68679/
---
 3rdparty/stout/tests/os/filesystem_tests.cpp | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/3rdparty/stout/tests/os/filesystem_tests.cpp b/3rdparty/stout/tests/os/filesystem_tests.cpp
index be15395..29f06f3 100644
--- a/3rdparty/stout/tests/os/filesystem_tests.cpp
+++ b/3rdparty/stout/tests/os/filesystem_tests.cpp
@@ -807,19 +807,13 @@ TEST_F(FsTest, ReadWriteAsyncLargeBuffer)
 #ifndef __WINDOWS__
 TEST_F(FsTest, Used)
 {
-    Try<Bytes> used = fs::used(".");
-    ASSERT_SOME(used);
+  Try<Bytes> used = fs::used(".");
+  ASSERT_SOME(used);
 
-    struct statvfs b;
-    ASSERT_EQ(0, ::statvfs(".", &b));
+  struct statvfs b;
+  ASSERT_EQ(0, ::statvfs(".", &b));
 
-    // Check that the block counts match.
-    EXPECT_EQ(used.get() / b.f_bsize, b.f_blocks - b.f_bfree);
-
-#ifdef __linux__
-    // On Linux, devtmpfs always reports a used size of 0.
-    used = fs::used("/dev");
-    EXPECT_SOME_EQ(Bytes(0), used);
-#endif
+  // Check that the block counts match.
+  EXPECT_EQ(used.get() / b.f_frsize, b.f_blocks - b.f_bfree);
 }
 #endif // __WINDOWS__