[Tarantool-patches] [PATCH 3/8] raft: introduce raft_ev
Serge Petrenko
sergepetrenko at tarantool.org
Tue Dec 15 13:02:26 MSK 2020
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
More information about the Tarantool-patches
mailing list