]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/test_rbd_replay: move operator<<(..rbd_loc& name) to rbd_replay
authorKefu Chai <kchai@redhat.com>
Fri, 8 Jan 2021 05:42:18 +0000 (13:42 +0800)
committerCasey Bodley <cbodley@redhat.com>
Wed, 11 May 2022 17:11:56 +0000 (13:11 -0400)
so gtest can print out rbd_loc when printing out diagnostic information
when test fails. after moving operator<<(ostream&, const rbd_loc&) to
the `rbd_replay` namespace, ADL is able to find it. for more details on
the lookup rules, see https://en.cppreference.com/w/cpp/language/adl

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit fe696638515dc7a51214930049ebd1a6f951047f)

src/test/test_rbd_replay.cc

index 24146875a271ad58ed3e9a23c6fd65f7ece8ee7c..c4a0b3a9ed6c65cd8fe203bcbf7f3dfa998c666d 100644 (file)
 #include "rbd_replay/rbd_loc.hpp"
 
 
-using namespace rbd_replay;
-
+namespace rbd_replay {
 std::ostream& operator<<(std::ostream& o, const rbd_loc& name) {
   return o << "('" << name.pool << "', '" << name.image << "', '" << name.snap << "')";
 }
+}
+
+using namespace rbd_replay;
 
 static void add_mapping(ImageNameMap *map, std::string mapping_string) {
   ImageNameMap::Mapping mapping;