From d632fe55a68040e6abf481fac59ef4408a7c59cd Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 1 Jun 2021 20:03:35 -0700 Subject: [PATCH] test/crimson/test_interruptible_future: using namespace crimson Signed-off-by: Samuel Just --- src/test/crimson/test_interruptible_future.cc | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/src/test/crimson/test_interruptible_future.cc b/src/test/crimson/test_interruptible_future.cc index 0dbf2a5368a15..2d927fc35d433 100644 --- a/src/test/crimson/test_interruptible_future.cc +++ b/src/test/crimson/test_interruptible_future.cc @@ -8,6 +8,8 @@ #include "crimson/common/interruptible_future.h" #include "crimson/common/log.h" +using namespace crimson; + class test_interruption : public std::exception {}; @@ -40,35 +42,35 @@ private: TEST_F(seastar_test_suite_t, basic) { using interruptor = - ::crimson::interruptible::interruptor; - run_async([this] { + interruptible::interruptor; + run_async([] { interruptor::with_interruption( [] { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return interruptor::make_interruptible(seastar::now()) .then_interruptible([] { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); }).then_interruptible([] { - ceph_assert(::crimson::interruptible::interrupt_cond); - return ::crimson::errorator<::crimson::ct_error::enoent>::make_ready_future<>(); + ceph_assert(interruptible::interrupt_cond); + return errorator::make_ready_future<>(); }).safe_then_interruptible([] { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return seastar::now(); - }, ::crimson::errorator<::crimson::ct_error::enoent>::all_same_way([] { - ceph_assert(::crimson::interruptible::interrupt_cond); + }, errorator::all_same_way([] { + ceph_assert(interruptible::interrupt_cond); }) ); }, [](std::exception_ptr) {}, false).get0(); interruptor::with_interruption( [] { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return interruptor::make_interruptible(seastar::now()) .then_interruptible([] { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); }); }, [](std::exception_ptr) { - ceph_assert(!::crimson::interruptible::interrupt_cond); + ceph_assert(!interruptible::interrupt_cond); return seastar::now(); }, true).get0(); @@ -79,21 +81,21 @@ TEST_F(seastar_test_suite_t, basic) TEST_F(seastar_test_suite_t, loops) { using interruptor = - ::crimson::interruptible::interruptor; + interruptible::interruptor; std::cout << "testing interruptible loops" << std::endl; - run_async([this] { + run_async([] { std::cout << "beginning" << std::endl; interruptor::with_interruption( [] { std::cout << "interruptiion enabled" << std::endl; - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return interruptor::make_interruptible(seastar::now()) .then_interruptible([] { std::cout << "test seastar future do_for_each" << std::endl; std::vector vec = {1, 2}; return seastar::do_with(std::move(vec), [](auto& vec) { return interruptor::do_for_each(std::begin(vec), std::end(vec), [](int) { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return seastar::now(); }); }); @@ -102,14 +104,14 @@ TEST_F(seastar_test_suite_t, loops) std::vector vec = {1, 2}; return seastar::do_with(std::move(vec), [](auto& vec) { return interruptor::do_for_each(std::begin(vec), std::end(vec), [](int) { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return interruptor::make_interruptible(seastar::now()); }); }); }).then_interruptible([] { std::cout << "test seastar future repeat" << std::endl; return interruptor::repeat([] { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return interruptor::make_interruptible( seastar::make_ready_future< seastar::stop_iteration>( @@ -118,7 +120,7 @@ TEST_F(seastar_test_suite_t, loops) }).then_interruptible([] { std::cout << "test interruptible seastar future repeat" << std::endl; return interruptor::repeat([] { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return seastar::make_ready_future< seastar::stop_iteration>( seastar::stop_iteration::yes); @@ -130,14 +132,14 @@ TEST_F(seastar_test_suite_t, loops) using namespace std::chrono_literals; return interruptor::make_interruptible(seastar::now()).then_interruptible([&vec] { return interruptor::do_for_each(std::begin(vec), std::end(vec), [](int) { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return interruptor::make_interruptible( - ::crimson::errorator<::crimson::ct_error::enoent>::make_ready_future<>()); + errorator::make_ready_future<>()); }).safe_then_interruptible([] { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return seastar::now(); - }, ::crimson::errorator<::crimson::ct_error::enoent>::all_same_way([] { - ceph_assert(::crimson::interruptible::interrupt_cond); + }, errorator::all_same_way([] { + ceph_assert(interruptible::interrupt_cond); })); }); }); @@ -148,18 +150,18 @@ TEST_F(seastar_test_suite_t, loops) using namespace std::chrono_literals; return interruptor::make_interruptible(seastar::now()).then_interruptible([&vec] { return interruptor::do_for_each(std::begin(vec), std::end(vec), [](int) { - ceph_assert(::crimson::interruptible::interrupt_cond); - return ::crimson::errorator<::crimson::ct_error::enoent>::make_ready_future<>(); + ceph_assert(interruptible::interrupt_cond); + return errorator::make_ready_future<>(); }).safe_then_interruptible([] { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return seastar::now(); - }, ::crimson::errorator<::crimson::ct_error::enoent>::all_same_way([] { - ceph_assert(::crimson::interruptible::interrupt_cond); + }, errorator::all_same_way([] { + ceph_assert(interruptible::interrupt_cond); })); }); }); }).then_interruptible([] { - ceph_assert(::crimson::interruptible::interrupt_cond); + ceph_assert(interruptible::interrupt_cond); return seastar::now(); }); }, [](std::exception_ptr) {}, false).get0(); -- 2.39.5