[lldb/Reproducers] Add a small artificial delay before exiting
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 9 Apr 2020 18:01:33 +0000 (11:01 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 9 Apr 2020 18:03:24 +0000 (11:03 -0700)
Add a small artificial delay in replay mode before exiting to ensure
that all asynchronous events have completed. This should reduce the
level of replay flakiness on some of the slower bots.

lldb/source/Utility/ReproducerInstrumentation.cpp

index 4c32d94..3bf8128 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "lldb/Utility/ReproducerInstrumentation.h"
 #include "lldb/Utility/Reproducer.h"
+#include <thread>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -94,6 +95,10 @@ bool Registry::Replay(llvm::StringRef buffer) {
     GetReplayer(id)->operator()(deserializer);
   }
 
+  // Add a small artificial delay to ensure that all asynchronous events have
+  // completed before we exit.
+  std::this_thread::sleep_for (std::chrono::milliseconds(100));
+
   return true;
 }