From f518f94b20100f92a56640fc1211c7abd039b488 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 25 Oct 2021 09:44:57 +0300 Subject: [PATCH] Fix actors_simple test without threads/EventFd. --- tdactor/test/actors_simple.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tdactor/test/actors_simple.cpp b/tdactor/test/actors_simple.cpp index 47140c822..9db0d01b7 100644 --- a/tdactor/test/actors_simple.cpp +++ b/tdactor/test/actors_simple.cpp @@ -31,16 +31,20 @@ static char buf2[BUF_SIZE]; static td::StringBuilder sb(td::MutableSlice(buf, BUF_SIZE - 1)); static td::StringBuilder sb2(td::MutableSlice(buf2, BUF_SIZE - 1)); -static std::shared_ptr> create_queue() { +static td::vector>> create_queues() { +#if TD_THREAD_UNSUPPORTED || TD_EVENTFD_UNSUPPORTED + return {}; +#else auto res = std::make_shared>(); res->init(); - return res; + return {res}; +#endif } TEST(Actors, SendLater) { sb.clear(); td::Scheduler scheduler; - scheduler.init(0, {create_queue()}, nullptr); + scheduler.init(0, create_queues(), nullptr); auto guard = scheduler.get_guard(); class Worker final : public td::Actor { @@ -96,7 +100,7 @@ class XReceiver final : public td::Actor { TEST(Actors, simple_pass_event_arguments) { td::Scheduler scheduler; - scheduler.init(0, {create_queue()}, nullptr); + scheduler.init(0, create_queues(), nullptr); auto guard = scheduler.get_guard(); auto id = td::create_actor("XR").release(); @@ -201,7 +205,7 @@ class PrintChar final : public td::Actor { // TEST(Actors, simple_hand_yield) { td::Scheduler scheduler; - scheduler.init(0, {create_queue()}, nullptr); + scheduler.init(0, create_queues(), nullptr); sb.clear(); int cnt = 1000; { @@ -350,7 +354,7 @@ class MasterActor final : public MsgActor { TEST(Actors, call_after_destruct) { td::Scheduler scheduler; - scheduler.init(0, {create_queue()}, nullptr); + scheduler.init(0, create_queues(), nullptr); { auto guard = scheduler.get_guard(); td::create_actor("Master").release();