From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 3B54F2BFE6 for ; Thu, 11 Apr 2019 18:17:58 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NRAn67fzuXbQ for ; Thu, 11 Apr 2019 18:17:58 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 858D92BC63 for ; Thu, 11 Apr 2019 18:17:57 -0400 (EDT) From: Vladislav Shpilevoy Subject: [tarantool-patches] [PATCH 1/1] test: add srand(time(NULL)) to swim unit tests Date: Fri, 12 Apr 2019 01:17:54 +0300 Message-Id: <2b80e752186c78d68c92b852e6cf5798175b26c3.1555021026.git.v.shpilevoy@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: kostja@tarantool.org 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)