]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/admin_socket_output: switch to std::experimental::filesystem 20307/head
authorKefu Chai <kchai@redhat.com>
Mon, 5 Feb 2018 09:12:14 +0000 (17:12 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 5 Feb 2018 09:12:19 +0000 (17:12 +0800)
so we don't need to compile boost::filesystem anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
CMakeLists.txt
src/test/CMakeLists.txt
src/test/admin_socket_output.cc
src/test/admin_socket_output.h

index cce8b73271730e5a63fce8c39cfbbe9355c5aeca..f748bc6c21520d9f395e4ac9b91fbbeea4301913 100644 (file)
@@ -560,8 +560,7 @@ option(WITH_SYSTEM_BOOST "require and build with system Boost" OFF)
 
 # Boost::thread depends on Boost::atomic, so list it explicitly.
 set(BOOST_COMPONENTS
-  atomic thread system regex random program_options date_time iostreams
-  filesystem)
+  atomic thread system regex random program_options date_time iostreams)
 set(BOOST_HEADER_COMPONENTS container)
 
 if(WITH_MGR)
index 375b8a13f546d6224bddba040f92a22c3b954c9a..3cbfe04fa4dac11e0e13a7083f4af90709a3e54c 100644 (file)
@@ -525,9 +525,14 @@ add_executable(ceph_test_admin_socket_output
   admin_socket_output_tests.cc
   )
 target_link_libraries(ceph_test_admin_socket_output
-  ceph-common
-  ${Boost_FILESYSTEM_LIBRARY}
-  )
+  ceph-common)
+if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
+  target_link_libraries(ceph_test_admin_socket_output
+    -lstdc++fs)
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+  target_link_libraries(ceph_test_admin_socket_output
+    -lc++experimental)
+endif()
 install(TARGETS
   ceph_test_admin_socket_output
   DESTINATION ${CMAKE_INSTALL_BINDIR})
index a93ab410c1c889995b4f6a4b073db184c5f484ff..7b2f224f2649b58e8d77c677958d338941147eec 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <iostream>
 #include <regex>                 // For regex, regex_search
-#include <boost/filesystem/convenience.hpp> // For extension
+#include <experimental/filesystem> // For extension
 
 #include "common/admin_socket_client.h"     // For AdminSocketClient
 #include "common/ceph_json.h"               // For JSONParser, JSONObjIter
@@ -74,9 +74,9 @@ void AdminSocketOutput::postpone(const std::string &target,
 
 bool AdminSocketOutput::init_sockets() {
   std::cout << "Initialising sockets" << std::endl;
-  for (const auto &x : bfs::directory_iterator(socketdir)) {
+  for (const auto &x : fs::directory_iterator(socketdir)) {
     std::cout << x.path() << std::endl;
-    if (bfs::extension(x.path()) == ".asok") {
+    if (fs::path(x.path()).extension() == ".asok") {
       for (auto &target : targets) {
         if (std::regex_search(x.path().filename().string(),
             std::regex(prefix + target + R"(\..*\.asok)"))) {
index 28f65767f91abc7ea15c6b5faa1ec83929aff955..1eda77430c911ab1d6845639d7fc4afb6adc2af9 100644 (file)
 #include <map>
 #include <set>
 #include <vector>
+#include <experimental/filesystem>       // For path
 
-#include <boost/filesystem/path.hpp>       // For path
-#include <boost/filesystem/operations.hpp> // For exists, is_directory
-
-namespace bfs = boost::filesystem;
+namespace fs = std::experimental::filesystem;
 
 using socket_results = std::map<std::string, std::string>;
 using test_functions =
@@ -72,7 +70,7 @@ private:
   std::map<std::string, test_functions> tests;
 
   std::string prefix = "ceph-";
-  bfs::path socketdir = "/var/run/ceph";
+  fs::path socketdir = "/var/run/ceph";
 };
 
 #endif // CEPH_ADMIN_SOCKET_OUTPUT_H