[libcxx-commits] [libcxx] c352fa7 - [libc++] Expand the contents of LIBCXX_ENABLE_FILESYSTEM

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 27 06:18:51 PDT 2023


Author: Louis Dionne
Date: 2023-06-27T09:18:40-04:00
New Revision: c352fa7407122ee62d990d6b82551650149f98d4

URL: https://github.com/llvm/llvm-project/commit/c352fa7407122ee62d990d6b82551650149f98d4
DIFF: https://github.com/llvm/llvm-project/commit/c352fa7407122ee62d990d6b82551650149f98d4.diff

LOG: [libc++] Expand the contents of LIBCXX_ENABLE_FILESYSTEM

Since LIBCXX_ENABLE_FILESYSTEM now truly represents whether the
platform supports a filesystem (as opposed to whether the <filesystem>
library is provided), we can provide a few additional classes from
the <filesystem> library even when the platform does not have support
for a filesystem. For example, this allows performing path manipulations
using std::filesystem::path even on platforms where there is no actual
filesystem.

rdar://107061236

Differential Revision: https://reviews.llvm.org/D152382

Added: 
    libcxx/test/std/input.output/filesystems/class.directory_entry/lit.local.cfg
    libcxx/test/std/input.output/filesystems/class.path/path_helper.h

Modified: 
    libcxx/docs/ReleaseNotes.rst
    libcxx/include/__filesystem/copy_options.h
    libcxx/include/__filesystem/directory_entry.h
    libcxx/include/__filesystem/directory_iterator.h
    libcxx/include/__filesystem/directory_options.h
    libcxx/include/__filesystem/file_status.h
    libcxx/include/__filesystem/filesystem_error.h
    libcxx/include/__filesystem/operations.h
    libcxx/include/__filesystem/path_iterator.h
    libcxx/include/__filesystem/perm_options.h
    libcxx/include/__filesystem/perms.h
    libcxx/include/__filesystem/recursive_directory_iterator.h
    libcxx/include/__filesystem/space_info.h
    libcxx/include/filesystem
    libcxx/include/fstream
    libcxx/include/module.modulemap.in
    libcxx/src/CMakeLists.txt
    libcxx/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp
    libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp
    libcxx/test/libcxx/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp
    libcxx/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp
    libcxx/test/libcxx/transitive_includes.gen.py
    libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/equal.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/iterator_concept_conformance.compile.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/range_concept_conformance.compile.pass.cpp
    libcxx/test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp
    libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.itr/iterator.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/source.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.charconv.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/default.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/empty.verify.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/path.decompose.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/named_overloads.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.hash_enabled.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/clear.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_extension.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/swap.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/c_str.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/named_overloads.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/native.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/operator_string.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.fail.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.nonmember/comparison_ops.fail.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/range_concept_conformance.compile.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/synop.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/range_concept_conformance.compile.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/equal.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp
    libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_borrowed_range.compile.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_view.compile.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type_resolution.compile.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy/copy.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_other/is_other.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove/remove.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status/status.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status_known/status_known.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.req.namespace/namespace.compile.pass.cpp
    libcxx/test/std/input.output/filesystems/fs.req.namespace/namespace.verify.cpp
    libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp
    libcxx/test/std/time/time.clock/time.clock.file/to_from_sys.pass.cpp
    libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp
    libcxx/test/std/utilities/format/format.range/format.range.fmtkind/format_kind.compile.pass.cpp
    libcxx/test/support/filesystem_test_helper.h
    libcxx/utils/data/ignore_format.txt

Removed: 
    libcxx/test/libcxx/input.output/filesystems/lit.local.cfg
    libcxx/test/std/input.output/filesystems/lit.local.cfg


################################################################################
diff  --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst
index 6f6e0983df789..95126c8387b27 100644
--- a/libcxx/docs/ReleaseNotes.rst
+++ b/libcxx/docs/ReleaseNotes.rst
@@ -67,6 +67,10 @@ Improvements and New Features
   in the specialization has not been implemented in libc++. This prevents the
   feature-test macro to be set.
 
+- Platforms that don't have support for a filesystem can now still take advantage of some parts of ``<filesystem>``.
+  Anything that does not rely on having an actual filesystem available will now work, such as ``std::filesystem::path``,
+  ``std::filesystem::perms`` and similar classes.
+
 Deprecations and Removals
 -------------------------
 

diff  --git a/libcxx/include/__filesystem/copy_options.h b/libcxx/include/__filesystem/copy_options.h
index 11ac9ab67ef9e..11962e494c9de 100644
--- a/libcxx/include/__filesystem/copy_options.h
+++ b/libcxx/include/__filesystem/copy_options.h
@@ -21,8 +21,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
 enum class _LIBCPP_ENUM_VIS copy_options : unsigned short {
   none = 0,
   skip_existing = 1,
@@ -75,8 +73,6 @@ inline copy_options& operator^=(copy_options& __lhs, copy_options __rhs) {
   return __lhs = __lhs ^ __rhs;
 }
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
 #endif // _LIBCPP_CXX03_LANG

diff  --git a/libcxx/include/__filesystem/directory_entry.h b/libcxx/include/__filesystem/directory_entry.h
index 2086d8214cbb7..bb7a061db4cea 100644
--- a/libcxx/include/__filesystem/directory_entry.h
+++ b/libcxx/include/__filesystem/directory_entry.h
@@ -35,13 +35,12 @@
 _LIBCPP_PUSH_MACROS
 #include <__undef_macros>
 
-#ifndef _LIBCPP_CXX03_LANG
+#if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
 _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
 
-
 class directory_entry {
   typedef _VSTD_FS::path _Path;
 
@@ -520,7 +519,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
 
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
-#endif // _LIBCPP_CXX03_LANG
+#endif // !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
 
 _LIBCPP_POP_MACROS
 

diff  --git a/libcxx/include/__filesystem/directory_iterator.h b/libcxx/include/__filesystem/directory_iterator.h
index 5d6b616fd9d84..903fe2393d98a 100644
--- a/libcxx/include/__filesystem/directory_iterator.h
+++ b/libcxx/include/__filesystem/directory_iterator.h
@@ -29,7 +29,7 @@
 #  pragma GCC system_header
 #endif
 
-#ifndef _LIBCPP_CXX03_LANG
+#if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
@@ -164,6 +164,6 @@ inline constexpr bool _VSTD::ranges::enable_view<_VSTD_FS::directory_iterator> =
 
 #endif // _LIBCPP_STD_VER >= 20
 
-#endif // _LIBCPP_CXX03_LANG
+#endif // !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
 
 #endif // _LIBCPP___FILESYSTEM_DIRECTORY_ITERATOR_H

diff  --git a/libcxx/include/__filesystem/directory_options.h b/libcxx/include/__filesystem/directory_options.h
index 406bb107da60a..4c323ccb0cfea 100644
--- a/libcxx/include/__filesystem/directory_options.h
+++ b/libcxx/include/__filesystem/directory_options.h
@@ -21,8 +21,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
 enum class _LIBCPP_ENUM_VIS directory_options : unsigned char {
   none = 0,
   follow_directory_symlink = 1,
@@ -73,8 +71,6 @@ inline directory_options& operator^=(directory_options& __lhs,
   return __lhs = __lhs ^ __rhs;
 }
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
 #endif // _LIBCPP_CXX03_LANG

diff  --git a/libcxx/include/__filesystem/file_status.h b/libcxx/include/__filesystem/file_status.h
index 47e28b4155fc5..0cf405b9c29e9 100644
--- a/libcxx/include/__filesystem/file_status.h
+++ b/libcxx/include/__filesystem/file_status.h
@@ -23,8 +23,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
 class _LIBCPP_EXPORTED_FROM_ABI file_status {
 public:
   // constructors
@@ -71,8 +69,6 @@ class _LIBCPP_EXPORTED_FROM_ABI file_status {
   perms __prms_;
 };
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
 #endif // _LIBCPP_CXX03_LANG

diff  --git a/libcxx/include/__filesystem/filesystem_error.h b/libcxx/include/__filesystem/filesystem_error.h
index 81db9cc88e0d4..713cc357ee82f 100644
--- a/libcxx/include/__filesystem/filesystem_error.h
+++ b/libcxx/include/__filesystem/filesystem_error.h
@@ -70,22 +70,19 @@ class _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_EXPORTED_FROM_ABI filesyst
   shared_ptr<_Storage> __storage_;
 };
 
-// TODO(ldionne): We need to pop the pragma and push it again after
-//                filesystem_error to work around PR41078.
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
 #  ifndef _LIBCPP_HAS_NO_EXCEPTIONS
 template <class... _Args>
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_filesystem_error(_Args&&... __args) {
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
+__throw_filesystem_error(_Args&&... __args) {
   throw filesystem_error(_VSTD::forward<_Args>(__args)...);
 }
 #  else
 template <class... _Args>
-_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_filesystem_error(_Args&&...) {
+_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
+__throw_filesystem_error(_Args&&...) {
   _LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode");
 }
 #  endif
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
 
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 

diff  --git a/libcxx/include/__filesystem/operations.h b/libcxx/include/__filesystem/operations.h
index 85c8a8772ea6b..71b3fb859d49b 100644
--- a/libcxx/include/__filesystem/operations.h
+++ b/libcxx/include/__filesystem/operations.h
@@ -28,7 +28,7 @@
 #  pragma GCC system_header
 #endif
 
-#ifndef _LIBCPP_CXX03_LANG
+#if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
@@ -196,6 +196,6 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
 
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
-#endif // _LIBCPP_CXX03_LANG
+#endif // !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
 
 #endif // _LIBCPP___FILESYSTEM_OPERATIONS_H

diff  --git a/libcxx/include/__filesystem/path_iterator.h b/libcxx/include/__filesystem/path_iterator.h
index 3d445df5915fb..60ab31892ce54 100644
--- a/libcxx/include/__filesystem/path_iterator.h
+++ b/libcxx/include/__filesystem/path_iterator.h
@@ -27,8 +27,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
 class _LIBCPP_EXPORTED_FROM_ABI path::iterator {
 public:
   enum _ParserState : unsigned char {
@@ -114,19 +112,19 @@ class _LIBCPP_EXPORTED_FROM_ABI path::iterator {
   _ParserState __state_;
 };
 
+_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
 inline _LIBCPP_INLINE_VISIBILITY bool operator==(const path::iterator& __lhs,
                                                  const path::iterator& __rhs) {
   return __lhs.__path_ptr_ == __rhs.__path_ptr_ &&
          __lhs.__entry_.data() == __rhs.__entry_.data();
 }
 
+_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
 inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const path::iterator& __lhs,
                                                  const path::iterator& __rhs) {
   return !(__lhs == __rhs);
 }
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
 #endif // _LIBCPP_CXX03_LANG

diff  --git a/libcxx/include/__filesystem/perm_options.h b/libcxx/include/__filesystem/perm_options.h
index 5b7dbd619887e..e77af9ef97e1f 100644
--- a/libcxx/include/__filesystem/perm_options.h
+++ b/libcxx/include/__filesystem/perm_options.h
@@ -21,8 +21,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
 enum class _LIBCPP_ENUM_VIS perm_options : unsigned char {
   replace = 1,
   add = 2,
@@ -68,8 +66,6 @@ inline perm_options& operator^=(perm_options& __lhs, perm_options __rhs) {
   return __lhs = __lhs ^ __rhs;
 }
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
 #endif // _LIBCPP_CXX03_LANG

diff  --git a/libcxx/include/__filesystem/perms.h b/libcxx/include/__filesystem/perms.h
index dd22d56cc1214..77bc652103427 100644
--- a/libcxx/include/__filesystem/perms.h
+++ b/libcxx/include/__filesystem/perms.h
@@ -21,8 +21,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
 // On Windows, these permission bits map to one single readonly flag per
 // file, and the executable bit is always returned as set. When setting
 // permissions, as long as the write bit is set for either owner, group or
@@ -86,8 +84,6 @@ inline perms& operator|=(perms& __lhs, perms __rhs) { return __lhs = __lhs | __r
 _LIBCPP_INLINE_VISIBILITY
 inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; }
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
 #endif // _LIBCPP_CXX03_LANG

diff  --git a/libcxx/include/__filesystem/recursive_directory_iterator.h b/libcxx/include/__filesystem/recursive_directory_iterator.h
index b079d6ef70974..c38d58e502159 100644
--- a/libcxx/include/__filesystem/recursive_directory_iterator.h
+++ b/libcxx/include/__filesystem/recursive_directory_iterator.h
@@ -28,7 +28,7 @@
 #  pragma GCC system_header
 #endif
 
-#ifndef _LIBCPP_CXX03_LANG
+#if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
@@ -178,6 +178,6 @@ inline constexpr bool _VSTD::ranges::enable_view<_VSTD_FS::recursive_directory_i
 
 #endif // _LIBCPP_STD_VER >= 20
 
-#endif // _LIBCPP_CXX03_LANG
+#endif // !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM)
 
 #endif // _LIBCPP___FILESYSTEM_RECURSIVE_DIRECTORY_ITERATOR_H

diff  --git a/libcxx/include/__filesystem/space_info.h b/libcxx/include/__filesystem/space_info.h
index e125813593090..929f514664244 100644
--- a/libcxx/include/__filesystem/space_info.h
+++ b/libcxx/include/__filesystem/space_info.h
@@ -22,8 +22,6 @@
 
 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
-
 struct _LIBCPP_EXPORTED_FROM_ABI space_info {
   uintmax_t capacity;
   uintmax_t free;
@@ -34,8 +32,6 @@ struct _LIBCPP_EXPORTED_FROM_ABI space_info {
 #  endif
 };
 
-_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
-
 _LIBCPP_END_NAMESPACE_FILESYSTEM
 
 #endif // _LIBCPP_CXX03_LANG

diff  --git a/libcxx/include/filesystem b/libcxx/include/filesystem
index dfbf7cef3cd56..99ba713ad07ba 100644
--- a/libcxx/include/filesystem
+++ b/libcxx/include/filesystem
@@ -558,10 +558,6 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct
 // [fs.filesystem.syn]
 #include <compare>
 
-#if defined(_LIBCPP_HAS_NO_FILESYSTEM)
-# error "The <filesystem> library is not supported since libc++ has been configured without support for a filesystem."
-#endif
-
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif

diff  --git a/libcxx/include/fstream b/libcxx/include/fstream
index 7119c7905483d..837f672e5ae5b 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -189,15 +189,12 @@ typedef basic_fstream<wchar_t> wfstream;
 #include <__utility/swap.h>
 #include <__utility/unreachable.h>
 #include <cstdio>
+#include <filesystem>
 #include <istream>
 #include <ostream>
 #include <typeinfo>
 #include <version>
 
-#if !defined(_LIBCPP_HAS_NO_FILESYSTEM)
-#   include <filesystem>
-#endif
-
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif

diff  --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index d49e339f2fbb7..4dff9f2bf713d 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -911,6 +911,7 @@ module std [system] {
         private header "__filesystem/path.h"
         export functional.__functional.hash
         export functional.__functional.unary_function
+        export string
       }
       module path_iterator                { private header "__filesystem/path_iterator.h" }
       module perm_options                 { private header "__filesystem/perm_options.h" }

diff  --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 9562d99d5223e..f782d85d61a8a 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -12,6 +12,10 @@ set(LIBCXX_SOURCES
   condition_variable.cpp
   condition_variable_destructor.cpp
   exception.cpp
+  filesystem/filesystem_clock.cpp
+  filesystem/filesystem_error.cpp
+  filesystem/path_parser.h
+  filesystem/path.cpp
   functional.cpp
   future.cpp
   hash.cpp
@@ -113,11 +117,7 @@ if (LIBCXX_ENABLE_FILESYSTEM)
     filesystem/directory_entry.cpp
     filesystem/directory_iterator.cpp
     filesystem/file_descriptor.h
-    filesystem/filesystem_clock.cpp
-    filesystem/filesystem_error.cpp
     filesystem/operations.cpp
-    filesystem/path_parser.h
-    filesystem/path.cpp
     filesystem/posix_compat.h
     filesystem/time_utils.h
     )

diff  --git a/libcxx/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp b/libcxx/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp
index 02df694273748..d77d5370f2c49 100644
--- a/libcxx/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp
+++ b/libcxx/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp
@@ -5,6 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+
 // <fstream>
 
 // template <class charT, class traits = char_traits<charT> >

diff  --git a/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp b/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp
index e581963d7a33b..beef2c53e509f 100644
--- a/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp
+++ b/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
+// UNSUPPORTED: no-filesystem
 // ADDITIONAL_COMPILE_FLAGS: -I %S/../../../../../../src
 
 // This test relies on calling functions from the libcxx internal headers

diff  --git a/libcxx/test/libcxx/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp b/libcxx/test/libcxx/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp
index a9ed30c7ca5bd..d672566730a6f 100644
--- a/libcxx/test/libcxx/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp
+++ b/libcxx/test/libcxx/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // These tests require locale for non-char paths
 // UNSUPPORTED: no-localization
@@ -24,11 +25,11 @@
 #include <type_traits>
 #include <cassert>
 
-#include "test_macros.h"
-#include "test_iterators.h"
 #include "count_new.h"
+#include "make_string.h"
 #include "min_allocator.h"
-#include "filesystem_test_helper.h"
+#include "test_iterators.h"
+#include "test_macros.h"
 
 
 // the SSO is always triggered for strings of size 2.

diff  --git a/libcxx/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp b/libcxx/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp
index 2d057cbf265a6..7b81c7f71b5ec 100644
--- a/libcxx/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp
+++ b/libcxx/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/libcxx/input.output/filesystems/lit.local.cfg b/libcxx/test/libcxx/input.output/filesystems/lit.local.cfg
deleted file mode 100644
index df91de1b95fe0..0000000000000
--- a/libcxx/test/libcxx/input.output/filesystems/lit.local.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-# Load the same local configuration as the filesystem tests in libcxx/test/std
-import os
-
-std_filesystem_tests = os.path.join(
-    config.test_source_root, "std", "input.output", "filesystems"
-)
-config.load_from_path(os.path.join(std_filesystem_tests, "lit.local.cfg"), lit_config)

diff  --git a/libcxx/test/libcxx/transitive_includes.gen.py b/libcxx/test/libcxx/transitive_includes.gen.py
index 13f897b07ffb4..c446ceff7fef6 100644
--- a/libcxx/test/libcxx/transitive_includes.gen.py
+++ b/libcxx/test/libcxx/transitive_includes.gen.py
@@ -63,8 +63,8 @@
 //--- {header}.sh.cpp
 {lit_header_restrictions.get(header, '')}
 
-// TODO: Fix this test to make it work with filesystem, localization or wide characters disabled
-// UNSUPPORTED{BLOCKLIT}: no-filesystem, no-localization, no-wide-characters
+// TODO: Fix this test to make it work with localization or wide characters disabled
+// UNSUPPORTED{BLOCKLIT}: no-localization, no-wide-characters
 
 // When built with modules, this test doesn't work because --trace-includes doesn't
 // report the stack of includes correctly.

diff  --git a/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp b/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp
index 9898880bcd2af..aaaa887f72074 100644
--- a/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp
+++ b/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: no-filesystem
 // XFAIL: availability-filesystem-missing
 
 // Make sure the various containers' iterators are not broken by the use of `std::rel_ops`.
@@ -15,6 +14,7 @@
 
 #include <array>
 #include <deque>
+#include <filesystem>
 #include <forward_list>
 #include <list>
 #include <map>
@@ -26,10 +26,6 @@
 
 #include "test_macros.h"
 
-#if TEST_STD_VER >= 11
-#include "filesystem_include.h"
-#endif
-
 #if TEST_STD_VER >= 17
 #include <string_view>
 #endif
@@ -115,16 +111,18 @@ template void test_forward<std::unordered_multiset<int> >();
 template void test_forward<std::unordered_set<int> >();
 template void test_random_access<std::vector<int> >();
 
-#if TEST_STD_VER >= 11
+#if TEST_STD_VER >= 17
 void test_directory_iterators() {
-    fs::directory_iterator it;
+#ifndef TEST_HAS_NO_FILESYSTEM
+    std::filesystem::directory_iterator it;
     test_eq(it, it);
 
-    fs::recursive_directory_iterator rdit;
+    std::filesystem::recursive_directory_iterator rdit;
     test_eq(rdit, rdit);
+#endif
 }
 
-template void test_forward<fs::path>();
+template void test_forward<std::filesystem::path>();
 #endif
 
 #if TEST_STD_VER >= 17

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp
index 322787b556d3c..ece52dae2ed54 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14
-// UNSUPPORTED: no-filesystem
 
 // UNSUPPORTED: availability-filesystem-missing
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp
index 84c41972c2a90..bc75d04740da0 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14
-// UNSUPPORTED: no-filesystem
 
 // UNSUPPORTED: availability-filesystem-missing
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp
index e051099b8dd88..021efc4cbf478 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14
-// UNSUPPORTED: no-filesystem
 
 // UNSUPPORTED: availability-filesystem-missing
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
index a055c6688cdb6..dccef75c02056 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14
-// UNSUPPORTED: no-filesystem
 
 // UNSUPPORTED: availability-filesystem-missing
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
index 11f84c88c39e1..cbe8fd49c43d4 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14
-// UNSUPPORTED: no-filesystem
 
 // UNSUPPORTED: availability-filesystem-missing
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp
index 700247daca649..7e31e294f44ce 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14
-// UNSUPPORTED: no-filesystem
 
 // UNSUPPORTED: availability-filesystem-missing
 

diff  --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp
index f150cfa5045db..1bb964ac20bd5 100644
--- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14
-// UNSUPPORTED: no-filesystem
 
 // UNSUPPORTED: availability-filesystem-missing
 

diff  --git a/libcxx/test/std/input.output/filesystems/lit.local.cfg b/libcxx/test/std/input.output/filesystems/class.directory_entry/lit.local.cfg
similarity index 100%
rename from libcxx/test/std/input.output/filesystems/lit.local.cfg
rename to libcxx/test/std/input.output/filesystems/class.directory_entry/lit.local.cfg

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp
index d37053a488797..2ce496fa23490 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp
index c1f96e1311f71..390d0bf68b236 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/ctor.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
index 67a070323bff9..d25d85d18431a 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp
index c9dcc65c5d7a2..85bc515b974a2 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/default_ctor.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/equal.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/equal.pass.cpp
index 5299eb0451de0..ef2f6b8b163cd 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/equal.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/equal.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp
index ca83031afc114..56692496363e4 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move.pass.cpp
index a1f730eedf609..bbf758f8f1272 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp
index 636c54bcc3cd0..ac4a203a0da34 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp
index 44cde7e80612c..2ae9331bdb786 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/iterator_concept_conformance.compile.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/iterator_concept_conformance.compile.pass.cpp
index d76e138c9b4e5..825d800b06e06 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/iterator_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/iterator_concept_conformance.compile.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // directory_iterator, recursive_directory_iterator
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/range_concept_conformance.compile.pass.cpp
index 4529d87f95318..37823d207bb6d 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/range_concept_conformance.compile.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // directory_iterator
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp
index 403d1ae338dd9..daef7ce91975c 100644
--- a/libcxx/test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.directory_iterator/types.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp b/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp
index 8fd23b60081bc..f63bc037a2513 100644
--- a/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp
@@ -6,6 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: availability-filesystem-missing
 // UNSUPPORTED: c++03
 
 // <filesystem>

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.itr/iterator.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.itr/iterator.pass.cpp
index cff339a47971c..5e3b2e7762681 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.itr/iterator.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.itr/iterator.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -24,7 +25,36 @@
 #include <type_traits>
 
 #include "test_macros.h"
-#include "filesystem_test_helper.h"
+
+template <class Iter1, class Iter2>
+bool checkCollectionsEqual(
+    Iter1 start1, Iter1 const end1
+  , Iter2 start2, Iter2 const end2
+  )
+{
+    while (start1 != end1 && start2 != end2) {
+        if (*start1 != *start2) {
+            return false;
+        }
+        ++start1; ++start2;
+    }
+    return (start1 == end1 && start2 == end2);
+}
+
+template <class Iter1, class Iter2>
+bool checkCollectionsEqualBackwards(
+    Iter1 const start1, Iter1 end1
+  , Iter2 const start2, Iter2 end2
+  )
+{
+    while (start1 != end1 && start2 != end2) {
+        --end1; --end2;
+        if (*end1 != *end2) {
+            return false;
+        }
+    }
+    return (start1 == end1 && start2 == end2);
+}
 
 void checkIteratorConcepts() {
   using namespace fs;

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp
index afbad4c062dfb..6af9fc5dac21f 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // These tests require locale for non-char paths
 // UNSUPPORTED: no-localization
@@ -33,11 +34,11 @@
 // to an intermediate path object, causing allocations in cases where no
 // allocations are done on other platforms.
 
-#include "test_macros.h"
-#include "test_iterators.h"
+#include "../path_helper.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
-
+#include "make_string.h"
+#include "test_iterators.h"
+#include "test_macros.h"
 
 struct AppendOperatorTestcase {
   MultiStringType lhs;

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp
index 9044b2f5a45e4..ba411fcd6917d 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/copy.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp
index 95ac5026f356b..bbc3754fd6992 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/source.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/source.pass.cpp
index 68c24426b423b..93f8221ea0394 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/source.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/source.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // These tests require locale for non-char paths
 // UNSUPPORTED: no-localization
@@ -32,10 +33,11 @@
 // On Windows, charset conversions cause allocations in the path class in
 // cases where no allocations are done on other platforms.
 
-#include "test_macros.h"
-#include "test_iterators.h"
+#include "../../path_helper.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
+#include "make_string.h"
+#include "test_iterators.h"
+#include "test_macros.h"
 
 
 template <class CharT>

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.charconv.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.charconv.pass.cpp
index cf27cd28a74ae..0be30c498c8aa 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.charconv.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.charconv.pass.cpp
@@ -8,6 +8,7 @@
 
 // UNSUPPORTED: no-localization
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
 
 // <filesystem>
@@ -37,7 +38,10 @@
 #include <cassert>
 
 #include "test_macros.h"
-#include "filesystem_test_helper.h"
+
+#ifdef _WIN32
+#  include <windows.h> // SetFileApisToANSI & friends
+#endif
 
 // Test conversion with strings that fit within the latin1 charset, that fit
 // within one code point in UTF-16, and that can be expressible in certain

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
index e1d78de670475..2bea512ed0dd8 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -28,15 +29,16 @@
 // template<> struct hash<filesystem::path>;
 
 #include "filesystem_include.h"
+#include <cassert>
+#include <string>
 #include <type_traits>
 #include <vector>
-#include <cassert>
 
-#include "test_macros.h"
+#include "assert_macros.h"
+#include "count_new.h"
 #include "test_comparisons.h"
 #include "test_iterators.h"
-#include "count_new.h"
-#include "filesystem_test_helper.h"
+#include "test_macros.h"
 
 struct PathCompareTest {
   const char* LHS;

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp
index 5c0fb2070b212..dcb7fc8940ca9 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // These tests require locale for non-char paths
 // UNSUPPORTED: no-localization
@@ -39,10 +40,11 @@
 // On Windows, charset conversions cause allocations in the path class in
 // cases where no allocations are done on other platforms.
 
-#include "test_macros.h"
-#include "test_iterators.h"
+#include "../path_helper.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
+#include "make_string.h"
+#include "test_iterators.h"
+#include "test_macros.h"
 
 
 struct ConcatOperatorTestcase {

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp
index 1155b7c1b3b5f..dbd603edfcb7d 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/copy.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/default.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/default.pass.cpp
index 9ea9c2ef04dcb..40b7667f4a0de 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/default.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/default.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp
index 541f6446cd926..8a3aff85690db 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp
index f119f34338e72..39a69a3488340 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/source.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // These tests require locale for non-char paths
 // UNSUPPORTED: no-localization
@@ -25,10 +26,11 @@
 #include <type_traits>
 #include <cassert>
 
-#include "test_macros.h"
-#include "test_iterators.h"
+#include "../../path_helper.h"
+#include "make_string.h"
 #include "min_allocator.h"
-#include "filesystem_test_helper.h"
+#include "test_iterators.h"
+#include "test_macros.h"
 
 
 template <class CharT, class ...Args>

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/empty.verify.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/empty.verify.cpp
index 32bbc4c210731..39d8812bfe144 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/empty.verify.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/empty.verify.cpp
@@ -13,6 +13,7 @@
 // bool empty() const noexcept;
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: availability-filesystem-missing
 
 #include "filesystem_include.h"
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/path.decompose.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/path.decompose.pass.cpp
index 3d80cc4d44eb8..584e657e4e3dd 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/path.decompose.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/path.decompose.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -48,13 +49,13 @@
 #include <cassert>
 #include <cstddef>
 #include <iterator>
+#include <string>
 #include <type_traits>
 #include <vector>
 
 #include "test_macros.h"
 #include "test_iterators.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
 
 struct ComparePathExact {
   bool operator()(fs::path const& LHS, std::string const& RHS) const {

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
index a3454ef88913d..bb25daf56ff73 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -18,9 +19,9 @@
 #include <cstdio>
 #include <string>
 
-#include "test_macros.h"
+#include "../../path_helper.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
+#include "test_macros.h"
 
 
 int main(int, char**) {

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
index 127cc7f6dcc05..7dae87d8e9018 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -19,10 +20,9 @@
 #include <cstdio>
 #include <string>
 
-#include "test_macros.h"
+#include "../../path_helper.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
-
+#include "test_macros.h"
 
 int main(int, char**) {
   // clang-format off

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp
index d67fc85bf8498..04776dcb80082 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // These tests require locale for non-char paths
 // UNSUPPORTED: no-localization
@@ -21,17 +22,18 @@
 // generic_string(const Allocator& a = Allocator()) const;
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <string>
+#include <type_traits>
 
-#include "test_macros.h"
-#include "test_iterators.h"
 #include "count_new.h"
+#include "make_string.h"
 #include "min_allocator.h"
-#include "filesystem_test_helper.h"
+#include "test_iterators.h"
+#include "test_macros.h"
 
-MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
 
+MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
 
 // generic_string<C, T, A> forwards to string<C, T, A>. Tests for
 // string<C, T, A>() are in "path.native.obs/string_alloc.pass.cpp".

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/named_overloads.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/named_overloads.pass.cpp
index f381fb5a41369..7634c4d8907e6 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/named_overloads.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/named_overloads.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // These tests require locale for non-char paths
 // UNSUPPORTED: no-localization
@@ -23,14 +24,15 @@
 
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <string>
+#include <type_traits>
 
-#include "test_macros.h"
-#include "test_iterators.h"
 #include "count_new.h"
+#include "make_string.h"
 #include "min_allocator.h"
-#include "filesystem_test_helper.h"
+#include "test_iterators.h"
+#include "test_macros.h"
 
 MultiStringType input = MKSTR("c:\\foo\\bar");
 #ifdef _WIN32

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.hash_enabled.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.hash_enabled.pass.cpp
index bc1db879f03e3..f328c2dd4d193 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.hash_enabled.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.hash_enabled.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/clear.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/clear.pass.cpp
index 9a68e181c92c0..ca25753accc54 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/clear.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -15,13 +16,12 @@
 // void clear() noexcept
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <type_traits>
 
-#include "test_macros.h"
-#include "test_iterators.h"
+#include "assert_macros.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
+#include "test_iterators.h"
 
 
 int main(int, char**) {

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp
index da505d6a7d77c..9cd0717eb9287 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -15,13 +16,12 @@
 // path& make_preferred()
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <string>
+#include <type_traits>
 
-#include "test_macros.h"
 #include "test_iterators.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
 
 
 struct MakePreferredTestcase {

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp
index 324d0dca32564..0985a92f0a3f8 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -18,10 +19,8 @@
 #include <type_traits>
 #include <cassert>
 
-#include "test_macros.h"
 #include "test_iterators.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
 
 struct RemoveFilenameTestcase {
   const char* value;

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_extension.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_extension.pass.cpp
index f77f3d98e5abf..9408b250218ef 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_extension.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_extension.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -15,13 +16,12 @@
 // path& replace_extension(path const& p = path())
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <string>
+#include <type_traits>
 
-#include "test_macros.h"
-#include "test_iterators.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
+#include "test_iterators.h"
 
 
 struct ReplaceExtensionTestcase {

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp
index 83ca785ff01bf..425a400a8323f 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -15,13 +16,12 @@
 // path& replace_filename( const path& replacement );
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <string>
+#include <type_traits>
 
-#include "test_macros.h"
 #include "test_iterators.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
 
 struct ReplaceFilenameTestcase {
   const char* value;

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/swap.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/swap.pass.cpp
index 50395633ea8f6..967eeb9dc2414 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/swap.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/swap.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -15,13 +16,12 @@
 // void swap(path& rhs) noexcept;
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <type_traits>
 
-#include "test_macros.h"
-#include "test_iterators.h"
+#include "assert_macros.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
+#include "test_iterators.h"
 
 
 struct SwapTestcase {

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/c_str.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/c_str.pass.cpp
index c6574d0056ec9..eddad65632aae 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/c_str.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/c_str.pass.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -16,16 +17,15 @@
 // const value_type* c_str() const noexcept;
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <string>
+#include <type_traits>
 
 #include "assert_macros.h"
 #include "test_macros.h"
-#include "filesystem_test_helper.h"
 
 
-int main(int, char**)
-{
+int main(int, char**) {
   using namespace fs;
   const char* const value = "hello world";
   const std::string str_value = value;

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/named_overloads.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/named_overloads.pass.cpp
index 0811e90aed0a0..18d4d2be369ad 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/named_overloads.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/named_overloads.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // These tests require locale for non-char paths
 // UNSUPPORTED: no-localization
@@ -23,14 +24,16 @@
 
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <string>
+#include <type_traits>
 
-#include "test_macros.h"
-#include "test_iterators.h"
+#include "assert_macros.h"
 #include "count_new.h"
+#include "make_string.h"
 #include "min_allocator.h"
-#include "filesystem_test_helper.h"
+#include "test_iterators.h"
+#include "test_macros.h"
 
 
 MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/native.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/native.pass.cpp
index 2d41fc171c886..fe12ea3a638fd 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/native.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/native.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -15,15 +16,15 @@
 // const string_type& native() const noexcept;
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <string>
+#include <type_traits>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "filesystem_test_helper.h"
 
 
-int main(int, char**)
-{
+int main(int, char**) {
   using namespace fs;
   const char* const value = "hello world";
   std::string value_str(value);

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/operator_string.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/operator_string.pass.cpp
index 70a36f2cb254b..18bcfc7c4855e 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/operator_string.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/operator_string.pass.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -16,15 +17,15 @@
 // operator string_type() const;
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <string>
+#include <type_traits>
 
+#include "assert_macros.h"
 #include "test_macros.h"
-#include "filesystem_test_helper.h"
 
 
-int main(int, char**)
-{
+int main(int, char**) {
   using namespace fs;
   using string_type = path::string_type;
   const char* const value = "hello world";

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.fail.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.fail.cpp
index 6a447221515c6..f5e2ddc3e15b7 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.fail.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.fail.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp
index 57e83012cc6ac..0949c8b5c2f86 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -17,11 +18,9 @@
 #include <cassert>
 
 #include "test_macros.h"
-#include "filesystem_test_helper.h"
 
 // This is mainly tested via the member append functions.
-int main(int, char**)
-{
+int main(int, char**) {
   using namespace fs;
   path p1("abc");
   path p2("def");

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/comparison_ops.fail.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/comparison_ops.fail.cpp
index e8eb1bc87aabe..504a23860ae5f 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/comparison_ops.fail.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/comparison_ops.fail.cpp
@@ -7,10 +7,10 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
-
 #include "filesystem_include.h"
 
 using namespace fs;

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp
index be502a782a970..a77b2127493e2 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp
@@ -8,6 +8,7 @@
 
 // UNSUPPORTED: c++03
 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -17,13 +18,13 @@
 //   path u8path(InputIter, InputIter);
 
 #include "filesystem_include.h"
-#include <type_traits>
 #include <cassert>
+#include <string>
+#include <type_traits>
 
 #include "test_macros.h"
 #include "test_iterators.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
 
 
 int main(int, char**)

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp
index 2f21649df60d1..4b95b68de9423 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp
@@ -8,6 +8,7 @@
 
 // UNSUPPORTED: c++03
 // UNSUPPORTED: no-localization
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -28,10 +29,10 @@
 #include <cassert>
 #include <iostream>
 
-#include "test_macros.h"
-#include "test_iterators.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
+#include "make_string.h"
+#include "test_iterators.h"
+#include "test_macros.h"
 
 MultiStringType InStr =  MKSTR("abcdefg/\"hijklmnop\"/qrstuvwxyz/123456789");
 MultiStringType OutStr = MKSTR("\"abcdefg/\\\"hijklmnop\\\"/qrstuvwxyz/123456789\"");

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp
index e524ecd50fd5f..7b7c0351e9e75 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp
index 817742a568701..75c4dac8f6b60 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -18,7 +19,6 @@
 
 #include "test_macros.h"
 #include "count_new.h"
-#include "filesystem_test_helper.h"
 
 // NOTE: this is tested in path.members/path.modifiers via the member swap.
 int main(int, char**)

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path_helper.h b/libcxx/test/std/input.output/filesystems/class.path/path_helper.h
new file mode 100644
index 0000000000000..2205def2f968d
--- /dev/null
+++ b/libcxx/test/std/input.output/filesystems/class.path/path_helper.h
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef TEST_STD_INPUT_OUTPUT_FILESYSTEMS_CLASS_PATH_PATH_HELPER_H
+#define TEST_STD_INPUT_OUTPUT_FILESYSTEMS_CLASS_PATH_PATH_HELPER_H
+
+#include <cstddef>
+#include <iterator>
+
+#include "filesystem_include.h"
+#include "make_string.h"
+
+// Testing the allocation behavior of the code_cvt functions requires
+// *knowing* that the allocation was not done by "path::__str_".
+// This hack forces path to allocate enough memory.
+inline void PathReserve(fs::path& p, std::size_t N) {
+  auto const& native_ref = p.native();
+  const_cast<fs::path::string_type&>(native_ref).reserve(N);
+}
+
+inline bool PathEq(fs::path const& LHS, fs::path const& RHS) {
+  return LHS.native() == RHS.native();
+}
+
+inline bool PathEqIgnoreSep(fs::path LHS, fs::path RHS) {
+  LHS.make_preferred();
+  RHS.make_preferred();
+  return LHS.native() == RHS.native();
+}
+
+template <class Iter>
+Iter IterEnd(Iter B) {
+  using VT = typename std::iterator_traits<Iter>::value_type;
+  for (; *B != VT{}; ++B)
+    ;
+  return B;
+}
+
+template <class CharT>
+const CharT* StrEnd(CharT const* P) {
+    return IterEnd(P);
+}
+
+template <class CharT>
+std::size_t StrLen(CharT const* P) {
+    return StrEnd(P) - P;
+}
+
+const MultiStringType PathList[] = {
+        MKSTR(""),
+        MKSTR(" "),
+        MKSTR("//"),
+        MKSTR("."),
+        MKSTR(".."),
+        MKSTR("foo"),
+        MKSTR("/"),
+        MKSTR("/foo"),
+        MKSTR("foo/"),
+        MKSTR("/foo/"),
+        MKSTR("foo/bar"),
+        MKSTR("/foo/bar"),
+        MKSTR("//net"),
+        MKSTR("//net/foo"),
+        MKSTR("///foo///"),
+        MKSTR("///foo///bar"),
+        MKSTR("/."),
+        MKSTR("./"),
+        MKSTR("/.."),
+        MKSTR("../"),
+        MKSTR("foo/."),
+        MKSTR("foo/.."),
+        MKSTR("foo/./"),
+        MKSTR("foo/./bar"),
+        MKSTR("foo/../"),
+        MKSTR("foo/../bar"),
+        MKSTR("c:"),
+        MKSTR("c:/"),
+        MKSTR("c:foo"),
+        MKSTR("c:/foo"),
+        MKSTR("c:foo/"),
+        MKSTR("c:/foo/"),
+        MKSTR("c:/foo/bar"),
+        MKSTR("prn:"),
+        MKSTR("c:\\"),
+        MKSTR("c:\\foo"),
+        MKSTR("c:foo\\"),
+        MKSTR("c:\\foo\\"),
+        MKSTR("c:\\foo/"),
+        MKSTR("c:/foo\\bar"),
+        MKSTR("//"),
+        MKSTR("/finally/we/need/one/really/really/really/really/really/really/really/long/string")
+};
+const unsigned PathListSize = sizeof(PathList) / sizeof(MultiStringType);
+
+#endif // TEST_STD_INPUT_OUTPUT_FILESYSTEMS_CLASS_PATH_PATH_HELPER_H

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/range_concept_conformance.compile.pass.cpp
index d07b4e01a6fbe..8eef8c25f0c9e 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/range_concept_conformance.compile.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: availability-filesystem-missing
 
 // path
 
@@ -16,7 +17,6 @@
 #include <ranges>
 
 
-
 static_assert(std::same_as<std::ranges::iterator_t<fs::path>, fs::path::iterator>);
 static_assert(std::ranges::common_range<fs::path>);
 static_assert(std::ranges::bidirectional_range<fs::path>);

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/synop.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/synop.pass.cpp
index ab18399fd5d6c..b68a56053268e 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/synop.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/synop.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/range_concept_conformance.compile.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/range_concept_conformance.compile.pass.cpp
index c633d3e9c425d..52d82f0e7f790 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/range_concept_conformance.compile.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/range_concept_conformance.compile.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // recursive_directory_iterator
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp
index 3e007ddb4249f..b52e1a63fe988 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp
index 95a77621140dd..d3fcc40e39f1d 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
index ced81b97b98f2..8135e0050737c 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp
index 32bd074163df9..dfa426ec38831 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp
index 061046e482eaa..bb6ff41b5bce6 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/equal.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/equal.pass.cpp
index 1616bcf1300a3..0652501bae893 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/equal.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/equal.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
index 9a157ad2f86ed..da982918fbb35 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp
index be320426deecf..a3cb1415dc93e 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp
index 65c30422eb7ea..0770f79772013 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp
index 0a80fe111f738..d3400a0e628d9 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp
index 721ed7bed8368..815ff8a70820b 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp
index f0b680440112a..37f8c33bee43c 100644
--- a/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp
index 210d28af7bd48..dacb9d1834c02 100644
--- a/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.enum/enum.path.format.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_borrowed_range.compile.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_borrowed_range.compile.pass.cpp
index 2cbf9245dea51..c73eebf7e0a72 100644
--- a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_borrowed_range.compile.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_borrowed_range.compile.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_view.compile.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_view.compile.pass.cpp
index f5c1471a60581..df3f09848d32a 100644
--- a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_view.compile.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_view.compile.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp
index afdf0ec15b943..f416dc1f0d0c4 100644
--- a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type_resolution.compile.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type_resolution.compile.pass.cpp
index 578addaa107ee..fedd898418a72 100644
--- a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type_resolution.compile.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/file_time_type_resolution.compile.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, windows
+// UNSUPPORTED: availability-filesystem-missing
 
 // MS STL and libstdc++ use the native windows file timestamp resolution,
 // with 100 ns resolution.

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
index 2a050568efdda..a9c6d21550fda 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -18,6 +20,7 @@
 
 #include "test_macros.h"
 #include "filesystem_test_helper.h"
+#include "../../class.path/path_helper.h"
 
 using namespace fs;
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
index fb88b4a5fcc49..c842e1b2aa0af 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -20,6 +22,7 @@
 #include "assert_macros.h"
 #include "test_macros.h"
 #include "filesystem_test_helper.h"
+#include "../../class.path/path_helper.h"
 
 using namespace fs;
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy/copy.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy/copy.pass.cpp
index 2d7acf3d94699..afcd5ab01ca66 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy/copy.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy/copy.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
index 06d2c0bbd3a28..a5071b15df844 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // The string reported on errors changed, which makes those tests fail when run
 // against already-released libc++'s.

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
index 31d43eb4413b3..51c2481176f85 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
@@ -8,6 +8,8 @@
 
 // UNSUPPORTED: c++03
 // REQUIRES: long_tests
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
index c618acf0ddb08..5b2bcb2a7bafb 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
index ecc68e8540527..0f95242ca3257 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // This test requires the dylib support introduced in D92769.
 // XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
index daa160b48d014..8dc6e1d9be879 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // This test requires the dylib support introduced in http://llvm.org/D92769.
 // XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
index 8fbfdcfc61471..29c2a43bddffa 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // This test requires the dylib support introduced in http://llvm.org/D92769.
 // XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx{{10.15|11.0}}

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
index cd8d05389cdda..c3c8c2dfb2c00 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
index 5145cd4551188..171405979cfc4 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
index 28d7f4ae5ab36..0ce1cc19b2429 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp
index 981c5497fbec0..0962ce0c592dc 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp
index e9c8935773a01..7fd1bf32e1907 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp
index c16a5922cd6df..8a2776e24d06d 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp
index 8e532fdca129a..413e48fa61a1a 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // The string reported on errors changed, which makes those tests fail when run
 // against already-released libc++'s.

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
index b646b46fec5d4..65a42e9793704 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

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
index 3986b1815d34a..d461207d0fab3 100644
--- 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
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

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
index 610d97b9c8b44..0446a937abe58 100644
--- 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
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

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
index 7cb297be5dcf7..2a578653476f3 100644
--- 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
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

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
index 752e68260dc95..74040ba102a48 100644
--- 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
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

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
index b0ef430f2def7..d960454d57687 100644
--- 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
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

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
index 8b37190aab4c2..d05baedc072b5 100644
--- 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
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

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
index b32ce642eaa54..96fc6d4a8b462 100644
--- 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
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

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
index da5169f733fac..305ebd62b1226 100644
--- 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
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

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
index e8ee7f47b343c..a5ccb28dad860 100644
--- 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
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
index 7b6bf4530aab2..555b22fd83905 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // The string reported on errors changed, which makes those tests fail when run
 // against already-released libc++'s.

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
index dc5ff11885215..ff1493fa447b8 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
index 2970d9f6a579f..8be177187fe26 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -21,7 +23,7 @@
 #include "test_macros.h"
 #include "count_new.h"
 #include "filesystem_test_helper.h"
-
+#include "../../class.path/path_helper.h"
 
 static int count_path_elems(const fs::path& p) {
   int count = 0;

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
index fa0bf953d936e..f1579ad55904d 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
index 820162f8497fa..5af707b60944d 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove/remove.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove/remove.pass.cpp
index f82a58328f86d..7abe973eb3bdb 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove/remove.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove/remove.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
index a6842b28836eb..6e9678bd4634c 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
@@ -9,6 +9,8 @@
 // XFAIL: LIBCXX-FREEBSD-FIXME
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp
index e327e7298ebd9..0dfe1777fbde8 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp
@@ -9,6 +9,8 @@
 // UNSUPPORTED: c++03
 // UNSUPPORTED: no-localization
 // UNSUPPORTED: no-threads
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp
index b1ac2603feda5..8dbf19e9262df 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
index 0b03bb8f8a1f1..c5f5438a3297b 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp
index 7659cdee2d88c..227837f754e88 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status/status.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status/status.pass.cpp
index 17abaf76b9c96..6d3119114424d 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status/status.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status/status.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status_known/status_known.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status_known/status_known.pass.cpp
index 1394c082f751a..f6331daf34020 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status_known/status_known.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status_known/status_known.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp
index 3ab50c37254f9..a58d35756a8ae 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
index 49a7f363210ce..1e46a9f228d59 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
index b0909da011710..d63da5cd5ed12 100644
--- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
@@ -7,6 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// UNSUPPORTED: no-filesystem
+// UNSUPPORTED: availability-filesystem-missing
 
 // <filesystem>
 
@@ -21,7 +23,7 @@
 #include "test_iterators.h"
 #include "count_new.h"
 #include "filesystem_test_helper.h"
-
+#include "../../class.path/path_helper.h"
 
 int main(int, char**) {
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.req.namespace/namespace.compile.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.req.namespace/namespace.compile.pass.cpp
index a8479a359986d..3279d906a427f 100644
--- a/libcxx/test/std/input.output/filesystems/fs.req.namespace/namespace.compile.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.req.namespace/namespace.compile.pass.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14
+// UNSUPPORTED: no-filesystem
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/input.output/filesystems/fs.req.namespace/namespace.verify.cpp b/libcxx/test/std/input.output/filesystems/fs.req.namespace/namespace.verify.cpp
index fd07ccaec971a..dafb5c1bb1da6 100644
--- a/libcxx/test/std/input.output/filesystems/fs.req.namespace/namespace.verify.cpp
+++ b/libcxx/test/std/input.output/filesystems/fs.req.namespace/namespace.verify.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 // REQUIRES: c++03 || c++11 || c++14
+// UNSUPPORTED: no-filesystem
 
 // <filesystem>
 

diff  --git a/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp b/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp
index cf4e39b107e6b..0852483a8b39f 100644
--- a/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp
+++ b/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-// UNSUPPORTED: no-filesystem
 
 // UNSUPPORTED: availability-filesystem-missing
 

diff  --git a/libcxx/test/std/time/time.clock/time.clock.file/to_from_sys.pass.cpp b/libcxx/test/std/time/time.clock/time.clock.file/to_from_sys.pass.cpp
index 261b08be173e6..5b1f465991111 100644
--- a/libcxx/test/std/time/time.clock/time.clock.file/to_from_sys.pass.cpp
+++ b/libcxx/test/std/time/time.clock/time.clock.file/to_from_sys.pass.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
-// UNSUPPORTED: no-filesystem
 
 // UNSUPPORTED: availability-filesystem-missing
 

diff  --git a/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp b/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp
index aafff368527ba..c17caa7baf83d 100644
--- a/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp
@@ -22,16 +22,17 @@
 #include <complex>
 #include <concepts>
 #include <deque>
+#include <filesystem>
 #include <format>
 #include <forward_list>
 #include <list>
-#include <memory>
 #include <map>
+#include <memory>
 #include <optional>
 #include <queue>
 #include <set>
-#include <stack>
 #include <span>
+#include <stack>
 #include <tuple>
 #include <type_traits>
 #include <unordered_map>
@@ -42,9 +43,6 @@
 #include "test_macros.h"
 #include "min_allocator.h"
 
-#ifndef TEST_HAS_NO_FILESYSTEM
-#  include <filesystem>
-#endif
 #ifndef TEST_HAS_NO_LOCALIZATION
 #  include <regex>
 #endif
@@ -196,9 +194,7 @@ void test_P1636() {
   assert_is_not_formattable<std::bitset<42>, CharT>();
   assert_is_not_formattable<std::complex<double>, CharT>();
   assert_is_not_formattable<std::error_code, CharT>();
-#ifndef TEST_HAS_NO_FILESYSTEM
   assert_is_not_formattable<std::filesystem::path, CharT>();
-#endif
   assert_is_not_formattable<std::shared_ptr<int>, CharT>();
 #ifndef TEST_HAS_NO_LOCALIZATION
   if constexpr (!std::same_as<CharT, int>) // sub_match only works with proper character types

diff  --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtkind/format_kind.compile.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtkind/format_kind.compile.pass.cpp
index acb1046acf472..8756cb9156dca 100644
--- a/libcxx/test/std/utilities/format/format.range/format.range.fmtkind/format_kind.compile.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtkind/format_kind.compile.pass.cpp
@@ -20,6 +20,7 @@
 
 #include <array>
 #include <deque>
+#include <filesystem>
 #include <format>
 #include <forward_list>
 #include <iterator>
@@ -28,17 +29,13 @@
 #include <ranges>
 #include <set>
 #include <span>
-#include <vector>
 #include <unordered_map>
 #include <unordered_set>
 #include <valarray>
+#include <vector>
 
 #include "test_macros.h"
 
-#ifndef TEST_HAS_NO_FILESYSTEM
-#  include <filesystem>
-#endif
-
 // [format.range.fmtkind]
 // If same_as<remove_cvref_t<ranges::range_reference_t<R>>, R> is true,
 // format_kind<R> is range_format::disabled.
@@ -67,9 +64,7 @@ struct recursive_range {
 static_assert(std::ranges::input_range<recursive_range>, "format_kind requires an input range");
 static_assert(std::format_kind<recursive_range> == std::range_format::disabled);
 
-#ifndef TEST_HAS_NO_FILESYSTEM
 static_assert(std::format_kind<std::filesystem::path> == std::range_format::disabled);
-#endif
 
 static_assert(std::format_kind<std::map<int, int>> == std::range_format::map);
 static_assert(std::format_kind<std::multimap<int, int>> == std::range_format::map);

diff  --git a/libcxx/test/support/filesystem_test_helper.h b/libcxx/test/support/filesystem_test_helper.h
index c7a5470a789c7..d63b1e61b5f9b 100644
--- a/libcxx/test/support/filesystem_test_helper.h
+++ b/libcxx/test/support/filesystem_test_helper.h
@@ -466,111 +466,6 @@ struct CWDGuard {
   CWDGuard& operator=(CWDGuard const&) = delete;
 };
 
-// Misc test types
-
-const MultiStringType PathList[] = {
-        MKSTR(""),
-        MKSTR(" "),
-        MKSTR("//"),
-        MKSTR("."),
-        MKSTR(".."),
-        MKSTR("foo"),
-        MKSTR("/"),
-        MKSTR("/foo"),
-        MKSTR("foo/"),
-        MKSTR("/foo/"),
-        MKSTR("foo/bar"),
-        MKSTR("/foo/bar"),
-        MKSTR("//net"),
-        MKSTR("//net/foo"),
-        MKSTR("///foo///"),
-        MKSTR("///foo///bar"),
-        MKSTR("/."),
-        MKSTR("./"),
-        MKSTR("/.."),
-        MKSTR("../"),
-        MKSTR("foo/."),
-        MKSTR("foo/.."),
-        MKSTR("foo/./"),
-        MKSTR("foo/./bar"),
-        MKSTR("foo/../"),
-        MKSTR("foo/../bar"),
-        MKSTR("c:"),
-        MKSTR("c:/"),
-        MKSTR("c:foo"),
-        MKSTR("c:/foo"),
-        MKSTR("c:foo/"),
-        MKSTR("c:/foo/"),
-        MKSTR("c:/foo/bar"),
-        MKSTR("prn:"),
-        MKSTR("c:\\"),
-        MKSTR("c:\\foo"),
-        MKSTR("c:foo\\"),
-        MKSTR("c:\\foo\\"),
-        MKSTR("c:\\foo/"),
-        MKSTR("c:/foo\\bar"),
-        MKSTR("//"),
-        MKSTR("/finally/we/need/one/really/really/really/really/really/really/really/long/string")
-};
-const unsigned PathListSize = sizeof(PathList) / sizeof(MultiStringType);
-
-template <class Iter>
-Iter IterEnd(Iter B) {
-  using VT = typename std::iterator_traits<Iter>::value_type;
-  for (; *B != VT{}; ++B)
-    ;
-  return B;
-}
-
-template <class CharT>
-const CharT* StrEnd(CharT const* P) {
-    return IterEnd(P);
-}
-
-template <class CharT>
-std::size_t StrLen(CharT const* P) {
-    return StrEnd(P) - P;
-}
-
-// Testing the allocation behavior of the code_cvt functions requires
-// *knowing* that the allocation was not done by "path::__str_".
-// This hack forces path to allocate enough memory.
-inline void PathReserve(fs::path& p, std::size_t N) {
-  auto const& native_ref = p.native();
-  const_cast<fs::path::string_type&>(native_ref).reserve(N);
-}
-
-template <class Iter1, class Iter2>
-bool checkCollectionsEqual(
-    Iter1 start1, Iter1 const end1
-  , Iter2 start2, Iter2 const end2
-  )
-{
-    while (start1 != end1 && start2 != end2) {
-        if (*start1 != *start2) {
-            return false;
-        }
-        ++start1; ++start2;
-    }
-    return (start1 == end1 && start2 == end2);
-}
-
-
-template <class Iter1, class Iter2>
-bool checkCollectionsEqualBackwards(
-    Iter1 const start1, Iter1 end1
-  , Iter2 const start2, Iter2 end2
-  )
-{
-    while (start1 != end1 && start2 != end2) {
-        --end1; --end2;
-        if (*end1 != *end2) {
-            return false;
-        }
-    }
-    return (start1 == end1 && start2 == end2);
-}
-
 // We often need to test that the error_code was cleared if no error occurs
 // this function returns an error_code which is set to an error that will
 // never be returned by the filesystem functions.
@@ -624,16 +519,6 @@ template <class Dur> void SleepFor(Dur dur) {
         ;
 }
 
-inline bool PathEq(fs::path const& LHS, fs::path const& RHS) {
-  return LHS.native() == RHS.native();
-}
-
-inline bool PathEqIgnoreSep(fs::path LHS, fs::path RHS) {
-  LHS.make_preferred();
-  RHS.make_preferred();
-  return LHS.native() == RHS.native();
-}
-
 inline fs::perms NormalizeExpectedPerms(fs::perms P) {
 #ifdef _WIN32
   // On Windows, fs::perms only maps down to one bit stored in the filesystem,

diff  --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt
index c9951198b0987..0d903196cfc8d 100644
--- a/libcxx/utils/data/ignore_format.txt
+++ b/libcxx/utils/data/ignore_format.txt
@@ -180,7 +180,6 @@ libcxx/include/ext/__hash
 libcxx/include/ext/hash_map
 libcxx/include/ext/hash_set
 libcxx/include/fenv.h
-libcxx/include/filesystem
 libcxx/include/__filesystem/copy_options.h
 libcxx/include/__filesystem/directory_entry.h
 libcxx/include/__filesystem/directory_iterator.h


        


More information about the libcxx-commits mailing list