]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/crimson: add a test to verify that errorator does not copy 38545/head
authorKefu Chai <kchai@redhat.com>
Fri, 11 Dec 2020 13:58:14 +0000 (21:58 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 13 Dec 2020 03:32:48 +0000 (11:32 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/crimson/test_errorator.cc

index b6285c67f8568098e21723a2ffd37d7f6c723f97..57dbc78cf9993e0414c21ac72e16284111afa58e 100644 (file)
@@ -18,6 +18,23 @@ struct errorator_test_t : public seastar_test_suite_t {
       }
     });
   }
+  struct noncopyable_t {
+    constexpr noncopyable_t() = default;
+    ~noncopyable_t() = default;
+    noncopyable_t(noncopyable_t&&) = default;
+  private:
+    noncopyable_t(const noncopyable_t&) = delete;
+    noncopyable_t& operator=(const noncopyable_t&) = delete;
+  };
+  ertr::future<> test_non_copy_then() {
+    return create_noncopyable().safe_then([](auto t) {
+      return ertr::now();
+    });
+  }
+private:
+  ertr::future<noncopyable_t> create_noncopyable() {
+    return ertr::make_ready_future<noncopyable_t>();
+  }
 };
 
 TEST_F(errorator_test_t, basic)
@@ -26,3 +43,10 @@ TEST_F(errorator_test_t, basic)
     test_do_until().unsafe_get0();
   });
 }
+
+TEST_F(errorator_test_t, non_copy_then)
+{
+  run_async([this] {
+    test_non_copy_then().unsafe_get0();
+  });
+}