[tarantool-patches] [PATCH 1/1] test: add srand(time(NULL)) to swim unit tests
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Fri Apr 12 01:17:54 MSK 2019
Appeared, that it is not called. But probably it should be, in
order to catch more errors.
---
Branch: https://github.com/tarantool/tarantool/tree/gerold103/swim-test-enable-random
Issue: No issue.
test/unit/swim.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/test/unit/swim.c b/test/unit/swim.c
index 03f6b412c..3767a8cbc 100644
--- a/test/unit/swim.c
+++ b/test/unit/swim.c
@@ -685,12 +685,19 @@ main_f(va_list ap)
int
main()
{
+ time_t seed = time(NULL);
+ srand(seed);
memory_init();
fiber_init(fiber_c_invoke);
int fd = open("log.txt", O_TRUNC);
if (fd != -1)
close(fd);
say_logger_init("log.txt", 6, 1, "plain", 0);
+ /*
+ * Print the seed to be able to reproduce a bug with the
+ * same seed.
+ */
+ say_info("Random seed = %llu", (unsigned long long) seed);
struct fiber *main_fiber = fiber_new("main", main_f);
fiber_set_joinable(main_fiber, true);
--
2.17.2 (Apple Git-113)
More information about the Tarantool-patches
mailing list