[Tarantool-patches] [PATCH 10/10] fakesys: move fakeev to fakesys library
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Tue Dec 1 02:56:10 MSK 2020
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)
More information about the Tarantool-patches
mailing list