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/03/06 20:16:21 UTC

[mesos] branch master updated (ebf4cc1 -> 9ec5e2b)

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

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


    from ebf4cc1  Ensured that MasterAPITest.ReservationUpdate waits for changes on agent.
     new 8dabbbd  Fixed the broken PathTest.Relative on Windows.
     new 9ec5e2b  Fixed the broken PathTest.PathIteration on windows.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 3rdparty/stout/tests/path_tests.cpp | 46 +++++++++++++++++++++++++++++++------
 1 file changed, 39 insertions(+), 7 deletions(-)


[mesos] 02/02: Fixed the broken PathTest.PathIteration on windows.

Posted by bm...@apache.org.
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 9ec5e2bd7b5740a9bc694c91e6bbfc0423ca292b
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Thu Mar 5 18:07:02 2020 -0500

    Fixed the broken PathTest.PathIteration on windows.
    
    This test uses only linux style paths and fails on windows. This
    happened because this code was introduced recently but there was
    no testing or CI running on windows to catch it.
    
    Review: https://reviews.apache.org/r/72202
---
 3rdparty/stout/tests/path_tests.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/3rdparty/stout/tests/path_tests.cpp b/3rdparty/stout/tests/path_tests.cpp
index 1ae80d0..f21b6a8 100644
--- a/3rdparty/stout/tests/path_tests.cpp
+++ b/3rdparty/stout/tests/path_tests.cpp
@@ -445,6 +445,10 @@ TEST(PathTest, FromURI)
 }
 
 
+// TODO(bmahler): This needs to be tested more comprehensively, see:
+// https://www.boost.org/doc/libs/1_72_0/libs/filesystem/doc/reference.html#path-decomposition-table
+//
+// NOLINT(whitespace/line_length)
 TEST(PathTest, PathIteration)
 {
   {
@@ -472,7 +476,12 @@ TEST(PathTest, PathIteration)
 
   {
     // Checks for behavior of absolute paths.
+#ifdef __WINDOWS__
+    const vector<string> components{"C:", "1", "2", "3", "4", "5", "file.ext"};
+#else
     const vector<string> components{"", "1", "2", "3", "4", "5", "file.ext"};
+#endif
+
     const Path absolute_path(
       strings::join(string(1, os::PATH_SEPARATOR), components));
 


[mesos] 01/02: Fixed the broken PathTest.Relative on Windows.

Posted by bm...@apache.org.
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 8dabbbdecdba75c775c2e9c02574faafbcd62b11
Author: Benjamin Mahler <bm...@apache.org>
AuthorDate: Thu Mar 5 18:06:47 2020 -0500

    Fixed the broken PathTest.Relative on Windows.
    
    This test uses only linux style paths and fails on windows. This
    happened because this code was introduced recently but there was
    no testing or CI running on windows to catch it.
    
    Review: https://reviews.apache.org/r/72201
---
 3rdparty/stout/tests/path_tests.cpp | 37 ++++++++++++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/3rdparty/stout/tests/path_tests.cpp b/3rdparty/stout/tests/path_tests.cpp
index d418d1b..1ae80d0 100644
--- a/3rdparty/stout/tests/path_tests.cpp
+++ b/3rdparty/stout/tests/path_tests.cpp
@@ -354,27 +354,50 @@ TEST(PathTest, IsAbsolute)
 }
 
 
+// TODO(bmahler): This needs to test more valid path cases on windows.
 TEST(PathTest, Relative)
 {
+#ifdef __WINDOWS__
+  // Check that relative paths can only be computed between paths
+  // which are either both absolute or both relative.
+  EXPECT_ERROR(path::relative("a", "C:\\a"));
+  EXPECT_ERROR(path::relative("C:\\a", "a"));
+
+  // Check that a path relative to itself is an empty path.
+  EXPECT_SOME_EQ(".", path::relative("C:\\a\\b\\c", "C:\\a\\b\\c"));
+  EXPECT_SOME_EQ(".", path::relative("a\\b\\c", "a\\b\\c"));
+
+  // Check for relative paths which do not require going up in the filesystem.
+  EXPECT_SOME_EQ("b", path::relative("C:\\a\\b", "C:\\a"));
+  EXPECT_SOME_EQ("b", path::relative("a\\b", "a"));
+
+  // Check for relative paths which do require going up in the filesystem.
+  EXPECT_SOME_EQ("..\\..\\d\\e", path::relative("C:\\a\\d\\e", "C:\\a\\b\\c"));
+  EXPECT_SOME_EQ("..\\..\\d\\e", path::relative("a\\d\\e", "a\\b\\c"));
+
+  // Check for behavior of not normalized paths.
+  EXPECT_SOME_EQ(".", path::relative("C:\\a\\.\\b", "C:\\a\\b"));
+#else
   // Check that relative paths can only be computed between paths
   // which are either both absolute or both relative.
   EXPECT_ERROR(path::relative("a", "/a"));
   EXPECT_ERROR(path::relative("/a", "a"));
 
   // Check that a path relative to itself is an empty path.
-  ASSERT_SOME_EQ(".", path::relative("/a/b/c", "/a/b/c"));
-  ASSERT_SOME_EQ(".", path::relative("a/b/c", "a/b/c"));
+  EXPECT_SOME_EQ(".", path::relative("/a/b/c", "/a/b/c"));
+  EXPECT_SOME_EQ(".", path::relative("a/b/c", "a/b/c"));
 
   // Check for relative paths which do not require going up in the filesystem.
-  ASSERT_SOME_EQ("b", path::relative("/a/b", "/a"));
-  ASSERT_SOME_EQ("b", path::relative("a/b", "a"));
+  EXPECT_SOME_EQ("b", path::relative("/a/b", "/a"));
+  EXPECT_SOME_EQ("b", path::relative("a/b", "a"));
 
   // Check for relative paths which do require going up in the filesystem.
-  ASSERT_SOME_EQ("../../d/e", path::relative("/a/d/e", "/a/b/c"));
-  ASSERT_SOME_EQ("../../d/e", path::relative("a/d/e", "a/b/c"));
+  EXPECT_SOME_EQ("../../d/e", path::relative("/a/d/e", "/a/b/c"));
+  EXPECT_SOME_EQ("../../d/e", path::relative("a/d/e", "a/b/c"));
 
   // Check for behavior of not normalized paths.
-  ASSERT_SOME_EQ(".", path::relative("/a/./b", "/a/b"));
+  EXPECT_SOME_EQ(".", path::relative("/a/./b", "/a/b"));
+#endif // __WINDOWS__
 }