[Lldb-commits] [lldb] r359992 - [test] Remove randomness

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Sun May 5 11:54:17 PDT 2019


Author: jdevlieghere
Date: Sun May  5 11:54:16 2019
New Revision: 359992

URL: http://llvm.org/viewvc/llvm-project?rev=359992&view=rev
Log:
[test] Remove randomness

This particular test fails once every so many runs on GreenDragon. Given
that the randomness in the inferior isn't critical to the test, I
removed it in the hopes that it is the cause of the flakiness.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/main.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/main.cpp?rev=359992&r1=359991&r2=359992&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/main.cpp (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/main.cpp Sun May  5 11:54:16 2019
@@ -9,11 +9,8 @@
 #include <chrono>
 #include <condition_variable>
 #include <cstdio>
-#include <random>
 #include <thread>
 
-std::default_random_engine g_random_engine{std::random_device{}()};
-std::uniform_int_distribution<> g_distribution{0, 3000000};
 std::condition_variable g_condition_variable;
 std::mutex g_mutex;
 int g_count;
@@ -74,17 +71,15 @@ thread_func (uint32_t thread_index)
     uint32_t val;
     while (count++ < 15)
     {
-        // random micro second sleep from zero to 3 seconds
-        int usec = g_distribution(g_random_engine);
-        printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, thread_index, usec);
-        std::this_thread::sleep_for(std::chrono::microseconds{usec});
+        printf ("%s (thread = %u) sleeping for 1 second...\n", __FUNCTION__, thread_index);
+        std::this_thread::sleep_for(std::chrono::seconds(1));
 
         if (count < 7)
             val = access_pool ();
         else
             val = access_pool (true);
 
-        printf ("%s (thread = %u) after usleep access_pool returns %d (count=%d)...\n", __FUNCTION__, thread_index, val, count);
+        printf ("%s (thread = %u) after sleep access_pool returns %d (count=%d)...\n", __FUNCTION__, thread_index, val, count);
     }
     printf ("%s (thread index = %u) exiting...\n", __FUNCTION__, thread_index);
 }




More information about the lldb-commits mailing list