diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp @@ -69,16 +69,24 @@ TEST_CASE(test_is_block_file_fails) { +#ifdef _WIN32 + // Windows doesn't support setting perms::none to trigger failures + // reading directories; test using a special inaccessible directory + // instead. + const path p = GetWindowsInaccessibleDir(); + TEST_REQUIRE(!p.empty()); +#else scoped_test_env env; const path dir = env.create_dir("dir"); - const path file = env.create_file("dir/file", 42); + const path p = env.create_file("dir/file", 42); permissions(dir, perms::none); +#endif std::error_code ec; - TEST_CHECK(is_block_file(file, ec) == false); + TEST_CHECK(is_block_file(p, ec) == false); TEST_CHECK(ec); - TEST_CHECK_THROW(filesystem_error, is_block_file(file)); + TEST_CHECK_THROW(filesystem_error, is_block_file(p)); } TEST_SUITE_END() diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp @@ -69,16 +69,24 @@ TEST_CASE(test_is_character_file_fails) { +#ifdef _WIN32 + // Windows doesn't support setting perms::none to trigger failures + // reading directories; test using a special inaccessible directory + // instead. + const path p = GetWindowsInaccessibleDir(); + TEST_REQUIRE(!p.empty()); +#else scoped_test_env env; const path dir = env.create_dir("dir"); - const path file = env.create_file("dir/file", 42); + const path p = env.create_file("dir/file", 42); permissions(dir, perms::none); +#endif std::error_code ec; - TEST_CHECK(is_character_file(file, ec) == false); + TEST_CHECK(is_character_file(p, ec) == false); TEST_CHECK(ec); - TEST_CHECK_THROW(filesystem_error, is_character_file(file)); + TEST_CHECK_THROW(filesystem_error, is_character_file(p)); } TEST_SUITE_END() diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp @@ -77,16 +77,24 @@ TEST_CASE(test_is_directory_fails) { +#ifdef _WIN32 + // Windows doesn't support setting perms::none to trigger failures + // reading directories; test using a special inaccessible directory + // instead. + const path p = GetWindowsInaccessibleDir(); + TEST_REQUIRE(!p.empty()); +#else scoped_test_env env; const path dir = env.create_dir("dir"); - const path dir2 = env.create_dir("dir/dir2"); + const path p = env.create_dir("dir/dir2"); permissions(dir, perms::none); +#endif std::error_code ec; - TEST_CHECK(is_directory(dir2, ec) == false); + TEST_CHECK(is_directory(p, ec) == false); TEST_CHECK(ec); - TEST_CHECK_THROW(filesystem_error, is_directory(dir2)); + TEST_CHECK_THROW(filesystem_error, is_directory(p)); } TEST_SUITE_END() diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp @@ -67,24 +67,40 @@ TEST_CASE(test_is_empty_fails) { +#ifdef _WIN32 + // Windows doesn't support setting perms::none to trigger failures + // reading directories; test using a special inaccessible directory + // instead. + const path p = GetWindowsInaccessibleDir(); + TEST_REQUIRE(!p.empty()); +#else scoped_test_env env; const path dir = env.create_dir("dir"); - const path dir2 = env.create_dir("dir/dir2"); + const path p = env.create_dir("dir/dir2"); permissions(dir, perms::none); +#endif std::error_code ec; - TEST_CHECK(is_empty(dir2, ec) == false); + TEST_CHECK(is_empty(p, ec) == false); TEST_CHECK(ec); - TEST_CHECK_THROW(filesystem_error, is_empty(dir2)); + TEST_CHECK_THROW(filesystem_error, is_empty(p)); } TEST_CASE(test_directory_access_denied) { +#ifdef _WIN32 + // Windows doesn't support setting perms::none to trigger failures + // reading directories; test using a special inaccessible directory + // instead. + const path dir = GetWindowsInaccessibleDir(); + TEST_REQUIRE(!dir.empty()); +#else scoped_test_env env; const path dir = env.create_dir("dir"); const path file1 = env.create_file("dir/file", 42); permissions(dir, perms::none); +#endif std::error_code ec = GetTestEC(); TEST_CHECK(is_empty(dir, ec) == false); diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp @@ -69,16 +69,24 @@ TEST_CASE(test_is_fifo_fails) { +#ifdef _WIN32 + // Windows doesn't support setting perms::none to trigger failures + // reading directories; test using a special inaccessible directory + // instead. + const path p = GetWindowsInaccessibleDir(); + TEST_REQUIRE(!p.empty()); +#else scoped_test_env env; const path dir = env.create_dir("dir"); - const path file = env.create_file("dir/file", 42); + const path p = env.create_file("dir/file", 42); permissions(dir, perms::none); +#endif std::error_code ec; - TEST_CHECK(is_fifo(file, ec) == false); + TEST_CHECK(is_fifo(p, ec) == false); TEST_CHECK(ec); - TEST_CHECK_THROW(filesystem_error, is_fifo(file)); + TEST_CHECK_THROW(filesystem_error, is_fifo(p)); } TEST_SUITE_END() diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_other/is_other.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_other/is_other.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_other/is_other.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_other/is_other.pass.cpp @@ -69,16 +69,24 @@ TEST_CASE(test_is_other_fails) { +#ifdef _WIN32 + // Windows doesn't support setting perms::none to trigger failures + // reading directories; test using a special inaccessible directory + // instead. + const path p = GetWindowsInaccessibleDir(); + TEST_REQUIRE(!p.empty()); +#else scoped_test_env env; const path dir = env.create_dir("dir"); - const path file = env.create_file("dir/file", 42); + const path p = env.create_file("dir/file", 42); permissions(dir, perms::none); +#endif std::error_code ec; - TEST_CHECK(is_other(file, ec) == false); + TEST_CHECK(is_other(p, ec) == false); TEST_CHECK(ec); - TEST_CHECK_THROW(filesystem_error, is_other(file)); + TEST_CHECK_THROW(filesystem_error, is_other(p)); } TEST_SUITE_END() diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp @@ -72,16 +72,24 @@ TEST_CASE(test_is_regular_file_fails) { +#ifdef _WIN32 + // Windows doesn't support setting perms::none to trigger failures + // reading directories; test using a special inaccessible directory + // instead. + const path p = GetWindowsInaccessibleDir(); + TEST_REQUIRE(!p.empty()); +#else scoped_test_env env; const path dir = env.create_dir("dir"); - const path file = env.create_file("dir/file", 42); + const path p = env.create_file("dir/file", 42); permissions(dir, perms::none); +#endif std::error_code ec; - TEST_CHECK(is_regular_file(file, ec) == false); + TEST_CHECK(is_regular_file(p, ec) == false); TEST_CHECK(ec); - TEST_CHECK_THROW(filesystem_error, is_regular_file(file)); + TEST_CHECK_THROW(filesystem_error, is_regular_file(p)); } TEST_SUITE_END() diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp @@ -69,16 +69,24 @@ TEST_CASE(test_is_socket_fails) { +#ifdef _WIN32 + // Windows doesn't support setting perms::none to trigger failures + // reading directories; test using a special inaccessible directory + // instead. + const path p = GetWindowsInaccessibleDir(); + TEST_REQUIRE(!p.empty()); +#else scoped_test_env env; const path dir = env.create_dir("dir"); - const path file = env.create_file("dir/file", 42); + const path p = env.create_file("dir/file", 42); permissions(dir, perms::none); +#endif std::error_code ec; - TEST_CHECK(is_socket(file, ec) == false); + TEST_CHECK(is_socket(p, ec) == false); TEST_CHECK(ec); - TEST_CHECK_THROW(filesystem_error, is_socket(file)); + TEST_CHECK_THROW(filesystem_error, is_socket(p)); } TEST_SUITE_END() diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp @@ -91,16 +91,24 @@ TEST_CASE(test_is_symlink_fails) { +#ifdef _WIN32 + // Windows doesn't support setting perms::none to trigger failures + // reading directories; test using a special inaccessible directory + // instead. + const path p = GetWindowsInaccessibleDir(); + TEST_REQUIRE(!p.empty()); +#else scoped_test_env env; const path dir = env.create_dir("dir"); - const path file = env.create_file("dir/file", 42); + const path p = env.create_file("dir/file", 42); permissions(dir, perms::none); +#endif std::error_code ec; - TEST_CHECK(is_symlink(file, ec) == false); + TEST_CHECK(is_symlink(p, ec) == false); TEST_CHECK(ec); - TEST_CHECK_THROW(filesystem_error, is_symlink(file)); + TEST_CHECK_THROW(filesystem_error, is_symlink(p)); } TEST_SUITE_END()