]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/lazy-omap-stats: overload get_output() to accept both lvalue and rvalue refs 66277/head
authorNitzan Mordechai <nmordech@redhat.com>
Mon, 17 Nov 2025 09:02:57 +0000 (09:02 +0000)
committerNitzan Mordechai <nmordech@redhat.com>
Tue, 18 Nov 2025 13:25:27 +0000 (13:25 +0000)
PR #65014 added std::move() inside the while loop, which required
recreating the command string on each iteration.

Add const std::string& overload that forwards to the existing
std::string&& version, allowing the command to be declared outside
the loop for better efficiency.

Fixes: https://tracker.ceph.com/issues/73838
Signed-off-by: Nitzan Mordechai <nmordech@ibm.com>
src/test/lazy-omap-stats/lazy_omap_stats_test.cc
src/test/lazy-omap-stats/lazy_omap_stats_test.h

index 1f48db3102e3fb89bdeb84f4b24c056005a4889f..4aaa10f09e10654fa540d2745b3a9ece44d36ea7 100644 (file)
@@ -572,7 +572,7 @@ void LazyOmapStatsTest::wait_for_active_clean()
   string command = R"({"prefix": "pg dump"})";
   int num_not_clean;
   do {
-    string dump_output = get_output(std::move(command), true);
+    string dump_output = get_output(command, true);
     if (index == -1) {
       boost::regex ireg(
           "\n"
index d5858bd7fde4d099a64f3547520176e70ce9c8be..35bb2bbd606b4d6cbbe2e0cc1329c5a9280b06f4 100644 (file)
@@ -77,6 +77,12 @@ class LazyOmapStatsTest
       std::string&& command = R"({"prefix": "pg dump"})",
       const bool silent = false,
       const CommandTarget target = CommandTarget::TARGET_MGR);
+  const std::string get_output(
+      const std::string& command,
+      const bool silent = false,
+      const CommandTarget target = CommandTarget::TARGET_MGR) {
+    return get_output(std::string(command), silent, target);  // delegate to rvalue version
+  }
   void get_pool_id(const std::string& pool);
   std::map<std::string, std::string> get_scrub_stamps();
   void wait_for_active_clean();