Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@dev.tarantool.org, sergepetrenko@tarantool.org
Subject: [Tarantool-patches] [PATCH 10/10] fakesys: move fakeev to fakesys library
Date: Tue,  1 Dec 2020 00:56:10 +0100	[thread overview]
Message-ID: <0cf5b6fd7a2bc95ea9501d7bc409dae3356cd51e.1606780408.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1606780408.git.v.shpilevoy@tarantool.org>

Fakesys is a collection of fake implementations of deep system
things such as libev and libc.

The fake subsystems will provide API just like their original
counterparts (except for function names), but with full control of
their behaviour in user-space for the sake of unit testing.

Fakeev is a bogus version of libev, whose main feature is virtual
time. Fakeev has internal clock, which is fully controllable in
user-space. That allows to roll hours of tests in milliseconds of
real time.

Fakeev is used in SWIM tests, and will be used in Raft tests.

Part of #5303
---
 src/lib/fakesys/CMakeLists.txt          | 1 +
 {test/unit => src/lib/fakesys}/fakeev.c | 0
 {test/unit => src/lib/fakesys}/fakeev.h | 0
 test/unit/CMakeLists.txt                | 6 +++---
 test/unit/swim_test_ev.c                | 2 +-
 test/unit/swim_test_utils.h             | 2 +-
 6 files changed, 6 insertions(+), 5 deletions(-)
 rename {test/unit => src/lib/fakesys}/fakeev.c (100%)
 rename {test/unit => src/lib/fakesys}/fakeev.h (100%)

diff --git a/src/lib/fakesys/CMakeLists.txt b/src/lib/fakesys/CMakeLists.txt
index b4d6af817..71e6a558e 100644
--- a/src/lib/fakesys/CMakeLists.txt
+++ b/src/lib/fakesys/CMakeLists.txt
@@ -1,5 +1,6 @@
 set(lib_sources
     fakenet.c
+    fakeev.c
 )
 
 set_source_files_compile_flags(${lib_sources})
diff --git a/test/unit/fakeev.c b/src/lib/fakesys/fakeev.c
similarity index 100%
rename from test/unit/fakeev.c
rename to src/lib/fakesys/fakeev.c
diff --git a/test/unit/fakeev.h b/src/lib/fakesys/fakeev.h
similarity index 100%
rename from test/unit/fakeev.h
rename to src/lib/fakesys/fakeev.h
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index 7f64f9685..e6a79e911 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -240,16 +240,16 @@ target_link_libraries(sio.test unit core)
 add_executable(crypto.test crypto.c core_test_utils.c)
 target_link_libraries(crypto.test crypto unit)
 
-add_executable(swim.test swim.c swim_test_transport.c fakeev.c swim_test_ev.c
+add_executable(swim.test swim.c swim_test_transport.c swim_test_ev.c
                swim_test_utils.c ${PROJECT_SOURCE_DIR}/src/version.c core_test_utils.c)
 target_link_libraries(swim.test unit fakesys swim)
 
-add_executable(swim_proto.test swim_proto.c swim_test_transport.c fakeev.c swim_test_ev.c
+add_executable(swim_proto.test swim_proto.c swim_test_transport.c swim_test_ev.c
                swim_test_utils.c ${PROJECT_SOURCE_DIR}/src/version.c core_test_utils.c)
 target_link_libraries(swim_proto.test unit fakesys swim)
 
 add_executable(swim_errinj.test swim_errinj.c swim_test_transport.c
-               fakeev.c swim_test_ev.c swim_test_utils.c
+               swim_test_ev.c swim_test_utils.c
                ${PROJECT_SOURCE_DIR}/src/version.c core_test_utils.c)
 target_link_libraries(swim_errinj.test unit fakesys swim)
 
diff --git a/test/unit/swim_test_ev.c b/test/unit/swim_test_ev.c
index 876aa4eea..e075194e8 100644
--- a/test/unit/swim_test_ev.c
+++ b/test/unit/swim_test_ev.c
@@ -29,7 +29,7 @@
  * SUCH DAMAGE.
  */
 #include "swim/swim_ev.h"
-#include "fakeev.h"
+#include "fakesys/fakeev.h"
 
 double
 swim_time(void)
diff --git a/test/unit/swim_test_utils.h b/test/unit/swim_test_utils.h
index 665423a03..61a6787d9 100644
--- a/test/unit/swim_test_utils.h
+++ b/test/unit/swim_test_utils.h
@@ -39,7 +39,7 @@
 #include "swim/swim_ev.h"
 #include "swim/swim_proto.h"
 #include "fakesys/fakenet.h"
-#include "fakeev.h"
+#include "fakesys/fakeev.h"
 
 struct swim_cluster;
 
-- 
2.24.3 (Apple Git-128)

  parent reply	other threads:[~2020-11-30 23:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 23:56 [Tarantool-patches] [PATCH 00/10] Raft module, part 3 - fake network and libev for Raft and SWIM Vladislav Shpilevoy
2020-11-30 23:56 ` [Tarantool-patches] [PATCH 01/10] test: stop using swim_transport.addr as in-param Vladislav Shpilevoy
2020-11-30 23:56 ` Vladislav Shpilevoy [this message]
2020-11-30 23:56 ` [Tarantool-patches] [PATCH 02/10] test: factor out swim from libc emulation funcs Vladislav Shpilevoy
2020-11-30 23:56 ` [Tarantool-patches] [PATCH 03/10] test: rename fake libc network methods to fakenet Vladislav Shpilevoy
2020-11-30 23:56 ` [Tarantool-patches] [PATCH 04/10] test: move fake network code to fakenet.c/.h files Vladislav Shpilevoy
2020-11-30 23:56 ` [Tarantool-patches] [PATCH 05/10] test: factor out swim from " Vladislav Shpilevoy
2020-11-30 23:56 ` [Tarantool-patches] [PATCH 06/10] fakesys: introduce fake system library Vladislav Shpilevoy
2020-11-30 23:56 ` [Tarantool-patches] [PATCH 07/10] test: rename fake libev methods to fakeev Vladislav Shpilevoy
2020-11-30 23:56 ` [Tarantool-patches] [PATCH 08/10] test: move fake libev code to fakeev.c/.h files Vladislav Shpilevoy
2020-11-30 23:56 ` [Tarantool-patches] [PATCH 09/10] test: factor out swim from fakeev.h/.c files Vladislav Shpilevoy
2020-12-01 13:42 ` [Tarantool-patches] [PATCH 00/10] Raft module, part 3 - fake network and libev for Raft and SWIM Serge Petrenko
2020-12-01 22:33 ` Vladislav Shpilevoy
2020-12-04  0:35 ` Alexander V. Tikhonov
2020-12-04 22:53   ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0cf5b6fd7a2bc95ea9501d7bc409dae3356cd51e.1606780408.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 10/10] fakesys: move fakeev to fakesys library' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox