Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH 1/1] test: add srand(time(NULL)) to swim unit tests
@ 2019-04-11 22:17 Vladislav Shpilevoy
  2019-04-11 23:09 ` [tarantool-patches] " Konstantin Osipov
  0 siblings, 1 reply; 3+ messages in thread
From: Vladislav Shpilevoy @ 2019-04-11 22:17 UTC (permalink / raw)
  To: tarantool-patches; +Cc: kostja

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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-11 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 22:17 [tarantool-patches] [PATCH 1/1] test: add srand(time(NULL)) to swim unit tests Vladislav Shpilevoy
2019-04-11 23:09 ` [tarantool-patches] " Konstantin Osipov
2019-04-11 23:20   ` Vladislav Shpilevoy

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