]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: s/boost::regex/std::regex/
authorKefu Chai <kchai@redhat.com>
Fri, 8 Dec 2017 05:51:53 +0000 (13:51 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 9 Jan 2018 09:29:08 +0000 (17:29 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/admin_socket_output.cc
src/test/common/test_back_trace.cc
src/test/librados/misc.cc

index 50fa96681e5c5402b97cbbdd3b9066cfc612198b..a93ab410c1c889995b4f6a4b073db184c5f484ff 100644 (file)
@@ -13,8 +13,8 @@
  */
 
 #include <iostream>
+#include <regex>                 // For regex, regex_search
 #include <boost/filesystem/convenience.hpp> // For extension
-#include <boost/regex.hpp>                 // For regex, regex_search
 
 #include "common/admin_socket_client.h"     // For AdminSocketClient
 #include "common/ceph_json.h"               // For JSONParser, JSONObjIter
@@ -78,8 +78,8 @@ bool AdminSocketOutput::init_sockets() {
     std::cout << x.path() << std::endl;
     if (bfs::extension(x.path()) == ".asok") {
       for (auto &target : targets) {
-        if (boost::regex_search(x.path().filename().string(),
-            boost::regex(prefix + target + R"(\..*\.asok)"))) {
+        if (std::regex_search(x.path().filename().string(),
+            std::regex(prefix + target + R"(\..*\.asok)"))) {
           std::cout << "Found " << target << " socket " << x.path()
                     << std::endl;
           sockets.insert(std::make_pair(target, x.path().string()));
index ff626f5a4c4fd9d218d848b04713b43075edd501..43f9bc559aad41dd2155a71e65a553aadef5a558 100644 (file)
@@ -2,10 +2,8 @@
 // vim: ts=8 sw=2 smarttab
 
 #include <boost/algorithm/string.hpp>
-// std::regex support in libstdc++ 4.8 is incomplete, so let's stick to
-// boost::regex now.
-#include <boost/regex.hpp>
 #include <gtest/gtest.h>
+#include <regex>
 #include <sstream>
 #include <string>
 
@@ -34,7 +32,7 @@ TEST(BackTrace, Basic) {
   const unsigned lineno = 1;
   ASSERT_GT(lines.size(), lineno);
   ASSERT_EQ(lines[0].find(pretty_version_to_str()), 1U);
-  boost::regex e{"^ 1: "
+  std::regex e{"^ 1: "
 #ifdef __FreeBSD__
                 "<foo.*>\\s"
                 "at\\s.*$"};
@@ -42,5 +40,5 @@ TEST(BackTrace, Basic) {
                 "\\(foo.*\\)\\s"
                 "\\[0x[[:xdigit:]]+\\]$"};
 #endif
-  EXPECT_TRUE(boost::regex_match(lines[lineno], e));
+  EXPECT_TRUE(std::regex_match(lines[lineno], e));
 }
index f7ce348b0a0f863e77d95147709e053ac6aec4df..2c957fe1b32056bb76916bb4d9e78c4b75393838 100644 (file)
@@ -19,7 +19,7 @@
 #include <map>
 #include <sstream>
 #include <string>
-#include <boost/regex.hpp>
+#include <regex>
 
 using namespace librados;
 using std::map;
@@ -1249,7 +1249,7 @@ TEST_F(LibRadosMisc, Applications) {
   string result(buf);
   rados_buffer_free(buf);
   rados_buffer_free(st);
-  if (!boost::regex_search(result, boost::regex("require_osd_release [l-z]"))) {
+  if (!std::regex_search(result, std::regex("require_osd_release [l-z]"))) {
     std::cout << "SKIPPING";
     return;
   }
@@ -1318,8 +1318,8 @@ TEST_F(LibRadosMiscPP, Applications) {
                                   inbl, &outbl, &outs));
   ASSERT_LT(0u, outbl.length());
   ASSERT_LE(0u, outs.length());
-  if (!boost::regex_search(outbl.to_str(),
-                           boost::regex("require_osd_release [l-z]"))) {
+  if (!std::regex_search(outbl.to_str(),
+                        std::regex("require_osd_release [l-z]"))) {
     std::cout << "SKIPPING";
     return;
   }