Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: kostja@tarantool.org
Subject: [tarantool-patches] [PATCH 1/1] test: add srand(time(NULL)) to swim unit tests
Date: Fri, 12 Apr 2019 01:17:54 +0300	[thread overview]
Message-ID: <2b80e752186c78d68c92b852e6cf5798175b26c3.1555021026.git.v.shpilevoy@tarantool.org> (raw)

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)

             reply	other threads:[~2019-04-11 22:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 22:17 Vladislav Shpilevoy [this message]
2019-04-11 23:09 ` [tarantool-patches] " Konstantin Osipov
2019-04-11 23:20   ` 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=2b80e752186c78d68c92b852e6cf5798175b26c3.1555021026.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/1] test: add srand(time(NULL)) to swim unit tests' \
    /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