From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id CD72445C304 for ; Tue, 15 Dec 2020 13:02:27 +0300 (MSK) References: <4dd1ae98a065ac8b348aa2da3edaf28f66724adf.1607879643.git.v.shpilevoy@tarantool.org> From: Serge Petrenko Message-ID: <69a570eb-e594-be09-7761-e3d04772a5f3@tarantool.org> Date: Tue, 15 Dec 2020 13:02:26 +0300 MIME-Version: 1.0 In-Reply-To: <4dd1ae98a065ac8b348aa2da3edaf28f66724adf.1607879643.git.v.shpilevoy@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [Tarantool-patches] [PATCH 3/8] raft: introduce raft_ev List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org 13.12.2020 20:15, Vladislav Shpilevoy пишет: > Raft_ev.h/.c encapsulates usage of libev, to a certain extent. All > libev functions are wrapped into raft_ev_* wrappers. Objects and > types are left intact. > > This is done in order to be able to replace raft_ev.c in the > soon coming unit tests with fakeev functions. That will allow to > simulate time and catch all the raft events with 100% > reproducibility, and without actual waiting for the events in > real time. > > The similar approach is used for swim unit tests. > > Original raft core file is built into a new library 'raft_algo'. > It is done for the sake of code coverage in unit tests. A test > could be built by directly referencing raft.c in > unit/CMakeLists.txt, but it can't apply compilation options to it, > including gcov options. > > When raft.c is built into a library right where it is defined, it > gets the gcov options, and the code covered by unit tests can be > properly shown. > > Part of #5303 Thanks for the patch! LGTM. > --- > src/lib/raft/CMakeLists.txt | 8 +++++ > src/lib/raft/raft.c | 65 +++++++++++++++++++------------------ > src/lib/raft/raft_ev.c | 57 ++++++++++++++++++++++++++++++++ > src/lib/raft/raft_ev.h | 57 ++++++++++++++++++++++++++++++++ > 4 files changed, 156 insertions(+), 31 deletions(-) > create mode 100644 src/lib/raft/raft_ev.c > create mode 100644 src/lib/raft/raft_ev.h > -- Serge Petrenko