This is an automated email from the ASF dual-hosted git repository. andschwa pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 1a2dc1522eba6aca8074d28272d151742dd3a532 Author: Andrew Schwartzmeyer <and...@schwartzmeyer.com> AuthorDate: Mon Aug 27 11:47:34 2018 -0700 Windows: Added notes for permanently disabled tests. Review: https://reviews.apache.org/r/68529 --- 3rdparty/stout/tests/os/filesystem_tests.cpp | 2 ++ 3rdparty/stout/tests/os/rmdir_tests.cpp | 9 +++----- 3rdparty/stout/tests/os/strerror_tests.cpp | 5 +++- 3rdparty/stout/tests/os_tests.cpp | 34 +++++++++++++++++++++++++--- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/3rdparty/stout/tests/os/filesystem_tests.cpp b/3rdparty/stout/tests/os/filesystem_tests.cpp index 09d0a40..880b551 100644 --- a/3rdparty/stout/tests/os/filesystem_tests.cpp +++ b/3rdparty/stout/tests/os/filesystem_tests.cpp @@ -620,6 +620,8 @@ TEST_F(FsTest, Close) #if defined(__linux__) || defined(__APPLE__) +// NOTE: This test is otherwise disabled since it uses `os::setxattr` +// and `os::getxattr` which are not available elsewhere. TEST_F(FsTest, Xattr) { const string file = path::join(os::getcwd(), id::UUID::random().toString()); diff --git a/3rdparty/stout/tests/os/rmdir_tests.cpp b/3rdparty/stout/tests/os/rmdir_tests.cpp index 3ca4099..719c3f3 100644 --- a/3rdparty/stout/tests/os/rmdir_tests.cpp +++ b/3rdparty/stout/tests/os/rmdir_tests.cpp @@ -230,12 +230,9 @@ TEST_F(RmdirTest, FailToRemoveNestedInvalidPath) #ifndef __WINDOWS__ // This test verifies that `rmdir` can remove a directory with a // device file. -// TODO(hausdorff): Port this test to Windows. It is not clear that `rdev` and -// `mknod` will implement the functionality expressed in this test, and as the -// need for these capabilities arise elsewhere in the codebase, we should -// rethink abstractions we need here, and subsequently, what this test should -// look like. This is `#ifdef`'d rather than `DISABLED_` because `rdev` doesn't -// exist on Windows. +// +// NOTE: Enable this test if `os::rdev` and `os::mknod` are +// implemented on Windows. 'os::rdev` calls `::lstat` and `::stat`. TEST_F(RmdirTest, RemoveDirectoryWithDeviceFile) { #ifdef __FreeBSD__ diff --git a/3rdparty/stout/tests/os/strerror_tests.cpp b/3rdparty/stout/tests/os/strerror_tests.cpp index 6a69d52..70d880e 100644 --- a/3rdparty/stout/tests/os/strerror_tests.cpp +++ b/3rdparty/stout/tests/os/strerror_tests.cpp @@ -42,11 +42,14 @@ TEST(StrerrorTest, InvalidErrno) } +#ifndef __WINDOWS__ // The Linux documentation[1] on `herrno` indicates there are only 4 possible // values that `h_errno` can have. // // [1] http://linux.die.net/man/3/hstrerror -#ifndef __WINDOWS__ +// +// NOTE: This test is permanently disabled on Windows since it tests +// against POSIX values of POSIX function `::hstrerror`. TEST(StrerrorTest, ValidHerrno) { EXPECT_EQ(::hstrerror(ENODEV), os::hstrerror(ENODEV)); diff --git a/3rdparty/stout/tests/os_tests.cpp b/3rdparty/stout/tests/os_tests.cpp index b80c34e..26fe938 100644 --- a/3rdparty/stout/tests/os_tests.cpp +++ b/3rdparty/stout/tests/os_tests.cpp @@ -64,8 +64,8 @@ #ifndef __WINDOWS__ using os::Exec; -#endif // __WINDOWS__ using os::Fork; +#endif // __WINDOWS__ using os::Process; using os::ProcessTree; @@ -429,16 +429,22 @@ TEST_F(OsTest, Children) // We have to reap the child for running the tests in repetition. ASSERT_EQ(child, waitpid(child, nullptr, 0)); } +#endif // __WINDOWS__ +#ifndef __WINDOWS__ void dosetsid() { if (::setsid() == -1) { ABORT(string("Failed to setsid: ") + os::strerror(errno)); } } +#endif // __WINDOWS__ +#ifndef __WINDOWS__ +// NOTE: This test is disabled for Windows since there is +// no implementation of `fork` and `exec` on Windows. TEST_F(OsTest, Killtree) { Try<ProcessTree> tree = @@ -560,8 +566,12 @@ TEST_F(OsTest, Killtree) // We have to reap the child for running the tests in repetition. ASSERT_EQ(child, waitpid(child, nullptr, 0)); } +#endif // __WINDOWS__ +#ifndef __WINDOWS__ +// NOTE: This test is disabled for Windows since there is +// no implementation of `fork` and `exec` on Windows. TEST_F(OsTest, KilltreeNoRoot) { Try<ProcessTree> tree = @@ -677,6 +687,7 @@ TEST_F(OsTest, KilltreeNoRoot) EXPECT_NONE(os::process(grandchild)); EXPECT_NONE(os::process(greatGrandchild)); } +#endif // __WINDOWS__ TEST_F(OsTest, ProcessExists) @@ -684,6 +695,10 @@ TEST_F(OsTest, ProcessExists) // Check we exist. EXPECT_TRUE(os::exists(::getpid())); + // NOTE: Some of this test is disabled for Windows since there is no + // implementation of `fork` and `exec` on Windows. +#if !defined(__WINDOWS__) + // In a FreeBSD jail, pid 1 may not exist. #if !defined(__FreeBSD__) // Check init/launchd/systemd exists. @@ -735,9 +750,13 @@ TEST_F(OsTest, ProcessExists) EXPECT_WTERMSIG_EQ(SIGKILL, status); EXPECT_FALSE(os::exists(pid)); +#endif // __WINDOWS__ } +#ifndef __WINDOWS__ +// NOTE: Enable this test when there is an implementation of +// `os::getuid` and `os::chown` for Windows. TEST_F(OsTest, User) { Try<string> user_ = os::shell("id -un"); @@ -801,8 +820,13 @@ TEST_F(OsTest, User) EXPECT_SOME(os::setgroups(gids.get(), uid.get())); EXPECT_SOME(os::setuid(uid.get())); } +#endif // __WINDOWS__ +#ifndef __WINDOWS__ +// NOTE: Enable this test if there are ever implementations of +// `os::getuid`, `os::getgid`, `os::chmod` and `os::chown` for +// Windows. TEST_F(OsTest, SYMLINK_Chown) { Result<uid_t> uid = os::getuid(); @@ -871,8 +895,12 @@ TEST_F(OsTest, SYMLINK_Chown) os::stat::uid("chown/one/file", FollowSymlink::DO_NOT_FOLLOW_SYMLINK)); } +#endif // __WINDOWS__ +#ifndef __WINDOWS__ +// NOTE: Enable this test when there is an implementation of +// `os::getuid`, `os::getgid`, `os::chmod` and `os::chown` for Windows. TEST_F(OsTest, ChownNoAccess) { Result<uid_t> uid = os::getuid(); @@ -924,11 +952,11 @@ TEST_F(OsTest, TrivialUser) } +#ifndef __WINDOWS__ // Test setting/resetting/appending to LD_LIBRARY_PATH environment // variable (DYLD_LIBRARY_PATH on OS X). // // NOTE: This will never be enabled on Windows as there is no equivalent. -#ifndef __WINDOWS__ TEST_F(OsTest, Libraries) { const string path1 = "/tmp/path1"; @@ -1040,8 +1068,8 @@ TEST_F(OsTest, Shell) } -// NOTE: Disabled on Windows because `mknod` does not exist. #ifndef __WINDOWS__ +// NOTE: Disabled on Windows because `mknod` does not exist. TEST_F(OsTest, Mknod) { #ifdef __FreeBSD__