From 3e107ec67e3be2034b200b81b9f23ccc40353b7a Mon Sep 17 00:00:00 2001 From: Nitzan Mordechai Date: Mon, 17 Nov 2025 09:02:57 +0000 Subject: [PATCH] test/lazy-omap-stats: overload get_output() to accept both lvalue and rvalue refs 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 --- src/test/lazy-omap-stats/lazy_omap_stats_test.cc | 2 +- src/test/lazy-omap-stats/lazy_omap_stats_test.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test/lazy-omap-stats/lazy_omap_stats_test.cc b/src/test/lazy-omap-stats/lazy_omap_stats_test.cc index 1f48db3102e3..4aaa10f09e10 100644 --- a/src/test/lazy-omap-stats/lazy_omap_stats_test.cc +++ b/src/test/lazy-omap-stats/lazy_omap_stats_test.cc @@ -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" diff --git a/src/test/lazy-omap-stats/lazy_omap_stats_test.h b/src/test/lazy-omap-stats/lazy_omap_stats_test.h index d5858bd7fde4..35bb2bbd606b 100644 --- a/src/test/lazy-omap-stats/lazy_omap_stats_test.h +++ b/src/test/lazy-omap-stats/lazy_omap_stats_test.h @@ -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 get_scrub_stamps(); void wait_for_active_clean(); -- 2.47.3