[libc++] Mark <filesystem> tests as failing when the dylib doesn't support filesystem
This fixes CI for back-deployment testers on platforms that don't have
<filesystem> support in the dylib.
This is effectively half of https://reviews.llvm.org/D59224. The other
half requires fixes in Clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356558 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__config b/include/__config
index c1770c1..9a58a2f 100644
--- a/include/__config
+++ b/include/__config
@@ -1354,6 +1354,11 @@
# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
__attribute__((availability(macosx,strict,introduced=10.9))) \
__attribute__((availability(ios,strict,introduced=7.0)))
+# define _LIBCPP_AVAILABILITY_FILESYSTEM \
+ __attribute__((availability(macosx,strict,unavailable))) \
+ __attribute__((availability(ios,strict,unavailable))) \
+ __attribute__((availability(tvos,strict,unavailable))) \
+ __attribute__((availability(watchos,strict,unavailable)))
#else
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
@@ -1365,6 +1370,7 @@
# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
+# define _LIBCPP_AVAILABILITY_FILESYSTEM
#endif
// Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
diff --git a/include/fstream b/include/fstream
index 1902ce9..60a05b0 100644
--- a/include/fstream
+++ b/include/fstream
@@ -235,7 +235,7 @@
basic_filebuf* open(const string& __s, ios_base::openmode __mode);
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
basic_filebuf* open(const _VSTD_FS::path& __p, ios_base::openmode __mode) {
return open(__p.c_str(), __mode);
}
@@ -757,7 +757,7 @@
this->eback() + __ibs_, __inext);
if (__r == codecvt_base::noconv)
{
- this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
+ this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
(char_type*)const_cast<char *>(__extbufend_));
__c = traits_type::to_int_type(*this->gptr());
}
@@ -1151,7 +1151,7 @@
_LIBCPP_INLINE_VISIBILITY
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in)
: basic_ifstream(__p.c_str(), __mode) {}
#endif // _LIBCPP_STD_VER >= 17
@@ -1177,7 +1177,7 @@
#endif
void open(const string& __s, ios_base::openmode __mode = ios_base::in);
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
void open(const filesystem::path& __p,
ios_base::openmode __mode = ios_base::in) {
return open(__p.c_str(), __mode);
@@ -1365,7 +1365,7 @@
explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
explicit basic_ofstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
: basic_ofstream(__p.c_str(), __mode) {}
#endif // _LIBCPP_STD_VER >= 17
@@ -1392,7 +1392,7 @@
void open(const string& __s, ios_base::openmode __mode = ios_base::out);
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out)
{ return open(__p.c_str(), __mode); }
#endif // _LIBCPP_STD_VER >= 17
@@ -1579,7 +1579,7 @@
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
explicit basic_fstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out)
: basic_fstream(__p.c_str(), __mode) {}
#endif // _LIBCPP_STD_VER >= 17
@@ -1607,7 +1607,7 @@
void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
#if _LIBCPP_STD_VER >= 17
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY
void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in|ios_base::out)
{ return open(__p.c_str(), __mode); }
#endif // _LIBCPP_STD_VER >= 17
diff --git a/test/libcxx/input.output/filesystems/lit.local.cfg b/test/libcxx/input.output/filesystems/lit.local.cfg
new file mode 100644
index 0000000..4a285ee
--- /dev/null
+++ b/test/libcxx/input.output/filesystems/lit.local.cfg
@@ -0,0 +1,3 @@
+# Disable all of the filesystem tests if the dylib under test doesn't support them.
+if 'dylib-has-no-filesystem' in config.available_features:
+ config.unsupported = True
diff --git a/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp b/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp
index ea244e1..4f8bacb 100644
--- a/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
+// XFAIL: dylib-has-no-filesystem
// <fstream>
diff --git a/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp
index d86b4b6..19a6431 100644
--- a/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
+// XFAIL: dylib-has-no-filesystem
// <fstream>
diff --git a/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp b/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp
index 799829e..f9de1c7 100644
--- a/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
+// XFAIL: dylib-has-no-filesystem
// <fstream>
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
index 8a3a361..2e92735 100644
--- a/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
+// XFAIL: dylib-has-no-filesystem
// <fstream>
diff --git a/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp b/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
index bce5fb9..ecac489 100644
--- a/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
+// XFAIL: dylib-has-no-filesystem
// <fstream>
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp
index 254d696..b742f5f 100644
--- a/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
+// XFAIL: dylib-has-no-filesystem
// <fstream>
diff --git a/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp b/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp
index 1b783f6..2061fa5 100644
--- a/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp
+++ b/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
+// XFAIL: dylib-has-no-filesystem
// <fstream>
diff --git a/test/std/input.output/filesystems/lit.local.cfg b/test/std/input.output/filesystems/lit.local.cfg
new file mode 100644
index 0000000..4a285ee
--- /dev/null
+++ b/test/std/input.output/filesystems/lit.local.cfg
@@ -0,0 +1,3 @@
+# Disable all of the filesystem tests if the dylib under test doesn't support them.
+if 'dylib-has-no-filesystem' in config.available_features:
+ config.unsupported = True
diff --git a/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp b/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp
index ef61657..3fa3cb8 100644
--- a/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp
+++ b/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// XFAIL: dylib-has-no-filesystem
// <chrono>
diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py
index 2fead3a..c78e189 100644
--- a/utils/libcxx/test/config.py
+++ b/utils/libcxx/test/config.py
@@ -1151,6 +1151,10 @@
self.config.available_features.add('dylib-has-no-bad_any_cast')
self.lit_config.note("throwing bad_any_cast is not supported by the deployment target")
+ # Filesystem is not supported on Apple platforms yet
+ if name == 'macosx':
+ self.config.available_features.add('dylib-has-no-filesystem')
+ self.lit_config.note("the deployment target does not support the dylib parts of <filesystem>")
else:
self.cxx.flags += ['-D_LIBCPP_DISABLE_AVAILABILITY']