summaryrefslogtreecommitdiffstats
path: root/libcxx/test/support
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/support')
-rw-r--r--libcxx/test/support/filesystem_include.hpp18
-rw-r--r--libcxx/test/support/filesystem_test_helper.hpp3
2 files changed, 19 insertions, 2 deletions
diff --git a/libcxx/test/support/filesystem_include.hpp b/libcxx/test/support/filesystem_include.hpp
new file mode 100644
index 00000000000..228e710f3a1
--- /dev/null
+++ b/libcxx/test/support/filesystem_include.hpp
@@ -0,0 +1,18 @@
+#ifndef TEST_SUPPORT_FILESYSTEM_INCLUDE_HPP
+#define TEST_SUPPORT_FILESYSTEM_INCLUDE_HPP
+
+#include <ciso646>
+// Test against std::filesystem for STL's other than libc++
+#ifndef _LIBCPP_VERSION
+#define TEST_INCLUDE_STD_FILESYSTEM
+#endif
+
+#ifdef TEST_INCLUDE_STD_FILESYSTEM
+#include <filesystem>
+namespace fs = std::filesystem;
+#else
+#include <experimental/filesystem>
+namespace fs = std::experimental::filesystem;
+#endif
+
+#endif
diff --git a/libcxx/test/support/filesystem_test_helper.hpp b/libcxx/test/support/filesystem_test_helper.hpp
index 755be90351f..622a60d1c96 100644
--- a/libcxx/test/support/filesystem_test_helper.hpp
+++ b/libcxx/test/support/filesystem_test_helper.hpp
@@ -1,7 +1,7 @@
#ifndef FILESYSTEM_TEST_HELPER_HPP
#define FILESYSTEM_TEST_HELPER_HPP
-#include <experimental/filesystem>
+#include "filesystem_include.hpp"
#include <cassert>
#include <cstdio> // for printf
#include <string>
@@ -9,7 +9,6 @@
#include <random>
#include <chrono>
-namespace fs = std::experimental::filesystem;
// static test helpers
OpenPOWER on IntegriCloud