Repository: mesos Updated Branches: refs/heads/master ae9d1033b -> 605b238d6
Stout: Used a namespace for UUID. To avoid conflicts when introducing a UUID type in Mesos' namespace, Stout's UUID type is put in the 'id' namespace. Review: https://reviews.apache.org/r/64380/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/23d76def Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/23d76def Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/23d76def Branch: refs/heads/master Commit: 23d76defdf88a2d8d954dbe69559a005b72c4795 Parents: 7467c81 Author: Jan Schlicht <[email protected]> Authored: Thu Dec 14 17:29:33 2017 +0100 Committer: Benjamin Bannier <[email protected]> Committed: Thu Dec 14 17:32:48 2017 +0100 ---------------------------------------------------------------------- 3rdparty/stout/include/stout/uuid.hpp | 12 ++---------- 3rdparty/stout/tests/os/filesystem_tests.cpp | 24 ++++++++++++++--------- 3rdparty/stout/tests/os_tests.cpp | 12 ++++++------ 3rdparty/stout/tests/protobuf_tests.cpp | 2 +- 3rdparty/stout/tests/uuid_tests.cpp | 2 ++ 5 files changed, 26 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/23d76def/3rdparty/stout/include/stout/uuid.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/uuid.hpp b/3rdparty/stout/include/stout/uuid.hpp index 1683084..0d0fd3a 100644 --- a/3rdparty/stout/include/stout/uuid.hpp +++ b/3rdparty/stout/include/stout/uuid.hpp @@ -30,11 +30,6 @@ #include <stout/windows.hpp> #endif // __WINDOWS__ -// NOTE: This namespace is necessary because the standard Windows headers -// define a UUID struct in the global namespace for the DCE RPC API. We put -// this in the `id::` namespace to avoid collisions. Note also that we include -// a line below, `using id::UUID`, which allows us to avoid being forced to -// change most of the callsites that use `UUID` to use `id::UUID` instead. namespace id { struct UUID : boost::uuids::uuid @@ -101,17 +96,14 @@ private: } // namespace id { -// NOTE: see comment for the line `namespace id {`, near the top of the file. -using id::UUID; - namespace std { template <> -struct hash<UUID> +struct hash<id::UUID> { typedef size_t result_type; - typedef UUID argument_type; + typedef id::UUID argument_type; result_type operator()(const argument_type& uuid) const { http://git-wip-us.apache.org/repos/asf/mesos/blob/23d76def/3rdparty/stout/tests/os/filesystem_tests.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/tests/os/filesystem_tests.cpp b/3rdparty/stout/tests/os/filesystem_tests.cpp index 57e1dc1..2204d10 100644 --- a/3rdparty/stout/tests/os/filesystem_tests.cpp +++ b/3rdparty/stout/tests/os/filesystem_tests.cpp @@ -61,7 +61,8 @@ class FsTest : public TemporaryDirectoryTest {}; TEST_F(FsTest, Find) { - const string testdir = path::join(os::getcwd(), UUID::random().toString()); + const string testdir = + path::join(os::getcwd(), id::UUID::random().toString()); const string subdir = path::join(testdir, "test1"); ASSERT_SOME(os::mkdir(subdir)); // Create the directories. @@ -91,7 +92,8 @@ TEST_F(FsTest, Find) TEST_F(FsTest, ReadWriteString) { - const string testfile = path::join(os::getcwd(), UUID::random().toString()); + const string testfile = + path::join(os::getcwd(), id::UUID::random().toString()); const string teststr = "line1\nline2"; ASSERT_SOME(os::write(testfile, teststr)); @@ -174,7 +176,8 @@ TEST_F(FsTest, Exists) TEST_F(FsTest, Touch) { - const string testfile = path::join(os::getcwd(), UUID::random().toString()); + const string testfile = + path::join(os::getcwd(), id::UUID::random().toString()); ASSERT_SOME(os::touch(testfile)); ASSERT_TRUE(os::exists(testfile)); @@ -243,7 +246,7 @@ TEST_F(FsTest, CreateDirectoryLongerThanMaxPath) { string testdir = sandbox.get(); while (testdir.length() <= MAX_PATH) { - testdir = path::join(testdir, UUID::random().toString()); + testdir = path::join(testdir, id::UUID::random().toString()); } EXPECT_TRUE(testdir.length() > MAX_PATH); @@ -263,7 +266,7 @@ TEST_F(FsTest, SYMLINK_Symlink) { const string temp_path = os::getcwd(); const string link = path::join(temp_path, "sym.link"); - const string file = path::join(temp_path, UUID::random().toString()); + const string file = path::join(temp_path, id::UUID::random().toString()); // Create file ASSERT_SOME(os::touch(file)) @@ -340,7 +343,8 @@ TEST_F(FsTest, SYMLINK_Rm) TEST_F(FsTest, List) { - const string testdir = path::join(os::getcwd(), UUID::random().toString()); + const string testdir = + path::join(os::getcwd(), id::UUID::random().toString()); ASSERT_SOME(os::mkdir(testdir)); // Create the directories. // Now write some files. @@ -376,7 +380,8 @@ TEST_F(FsTest, List) TEST_F(FsTest, Rename) { - const string testdir = path::join(os::getcwd(), UUID::random().toString()); + const string testdir = + path::join(os::getcwd(), id::UUID::random().toString()); ASSERT_SOME(os::mkdir(testdir)); // Create the directories. // Now write some files. @@ -442,7 +447,8 @@ TEST_F(FsTest, Close) const int previous_report_mode = _CrtSetReportMode(_CRT_ASSERT, 0); #endif // __WINDOWS__ - const string testfile = path::join(os::getcwd(), UUID::random().toString()); + const string testfile = + path::join(os::getcwd(), id::UUID::random().toString()); ASSERT_SOME(os::touch(testfile)); ASSERT_TRUE(os::exists(testfile)); @@ -523,7 +529,7 @@ TEST_F(FsTest, Close) #if defined(__linux__) || defined(__APPLE__) TEST_F(FsTest, Xattr) { - const string file = path::join(os::getcwd(), UUID::random().toString()); + const string file = path::join(os::getcwd(), id::UUID::random().toString()); // Create file. ASSERT_SOME(os::touch(file)); http://git-wip-us.apache.org/repos/asf/mesos/blob/23d76def/3rdparty/stout/tests/os_tests.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/tests/os_tests.cpp b/3rdparty/stout/tests/os_tests.cpp index 02f2a18..de41077 100644 --- a/3rdparty/stout/tests/os_tests.cpp +++ b/3rdparty/stout/tests/os_tests.cpp @@ -216,7 +216,7 @@ TEST_F(OsTest, Nonblock) // non-existing file. TEST_F(OsTest, SYMLINK_Size) { - const string file = path::join(os::getcwd(), UUID::random().toString()); + const string file = path::join(os::getcwd(), id::UUID::random().toString()); const Bytes size = 1053; @@ -231,7 +231,7 @@ TEST_F(OsTest, SYMLINK_Size) EXPECT_ERROR(os::stat::size("aFileThatDoesNotExist")); - const string link = path::join(os::getcwd(), UUID::random().toString()); + const string link = path::join(os::getcwd(), id::UUID::random().toString()); ASSERT_SOME(fs::symlink(file, link)); @@ -724,15 +724,15 @@ TEST_F(OsTest, User) // A random UUID is an invalid username on some platforms. Some // versions of Linux (e.g., RHEL7) treat invalid usernames // differently from valid-but-not-found usernames. - EXPECT_NONE(os::getuid(UUID::random().toString())); - EXPECT_NONE(os::getgid(UUID::random().toString())); + EXPECT_NONE(os::getuid(id::UUID::random().toString())); + EXPECT_NONE(os::getgid(id::UUID::random().toString())); // A username that is valid but that is unlikely to exist. EXPECT_NONE(os::getuid("zzzvaliduserzzz")); EXPECT_NONE(os::getgid("zzzvaliduserzzz")); EXPECT_SOME(os::su(user.get())); - EXPECT_ERROR(os::su(UUID::random().toString())); + EXPECT_ERROR(os::su(id::UUID::random().toString())); Try<string> gids_ = os::shell("id -G " + user.get()); EXPECT_SOME(gids_); @@ -1009,7 +1009,7 @@ TEST_F(OsTest, SYMLINK_Realpath) const string& testFile = _testFile.get(); // Create a symlink pointing to a file. - const string testLink = UUID::random().toString(); + const string testLink = id::UUID::random().toString(); ASSERT_SOME(fs::symlink(testFile, testLink)); // Validate the symlink. http://git-wip-us.apache.org/repos/asf/mesos/blob/23d76def/3rdparty/stout/tests/protobuf_tests.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/tests/protobuf_tests.cpp b/3rdparty/stout/tests/protobuf_tests.cpp index 543f96c..be35ad0 100644 --- a/3rdparty/stout/tests/protobuf_tests.cpp +++ b/3rdparty/stout/tests/protobuf_tests.cpp @@ -148,7 +148,7 @@ TEST(ProtobufTest, JSON) // Modify the message to test (de-)serialization of random bytes generated // by UUID. - message.set_bytes(UUID::random().toBytes()); + message.set_bytes(id::UUID::random().toBytes()); object = JSON::protobuf(message); http://git-wip-us.apache.org/repos/asf/mesos/blob/23d76def/3rdparty/stout/tests/uuid_tests.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/tests/uuid_tests.cpp b/3rdparty/stout/tests/uuid_tests.cpp index 1fbd623..31cc016 100644 --- a/3rdparty/stout/tests/uuid_tests.cpp +++ b/3rdparty/stout/tests/uuid_tests.cpp @@ -20,6 +20,8 @@ #include <stout/gtest.hpp> #include <stout/uuid.hpp> +using id::UUID; + using std::string;
