summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-05-11 21:31:51 +0000
committerKostya Serebryany <kcc@google.com>2015-05-11 21:31:51 +0000
commit83fd486ff4266db238c2ad423caeb5f388ee07dc (patch)
tree27cb2b5c0487ae88dfe8e4fb7fb8e1168471d4ca /llvm/lib
parent869e0c1c599f93ca881eb1f2e6d760d99ead323d (diff)
downloadbcm5719-llvm-83fd486ff4266db238c2ad423caeb5f388ee07dc.tar.gz
bcm5719-llvm-83fd486ff4266db238c2ad423caeb5f388ee07dc.zip
[lib/Fuzzer] when running multiple fuzzing processes, print something every 10 minutes to avoid buildbot timeouts
llvm-svn: 237054
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Fuzzer/FuzzerDriver.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerDriver.cpp b/llvm/lib/Fuzzer/FuzzerDriver.cpp
index c24ecbd57eb..724714e6b89 100644
--- a/llvm/lib/Fuzzer/FuzzerDriver.cpp
+++ b/llvm/lib/Fuzzer/FuzzerDriver.cpp
@@ -13,6 +13,7 @@
#include "FuzzerInternal.h"
#include <cstring>
+#include <chrono>
#include <unistd.h>
#include <iostream>
#include <thread>
@@ -122,9 +123,18 @@ static void ParseFlags(int argc, char **argv) {
}
}
+static std::mutex Mu;
+
+static void PulseThread() {
+ while (true) {
+ std::this_thread::sleep_for(std::chrono::seconds(600));
+ std::lock_guard<std::mutex> Lock(Mu);
+ std::cerr << "pulse...\n";
+ }
+}
+
static void WorkerThread(const std::string &Cmd, std::atomic<int> *Counter,
int NumJobs, std::atomic<bool> *HasErrors) {
- static std::mutex CerrMutex;
while (true) {
int C = (*Counter)++;
if (C >= NumJobs) break;
@@ -135,7 +145,7 @@ static void WorkerThread(const std::string &Cmd, std::atomic<int> *Counter,
int ExitCode = system(ToRun.c_str());
if (ExitCode != 0)
*HasErrors = true;
- std::lock_guard<std::mutex> Lock(CerrMutex);
+ std::lock_guard<std::mutex> Lock(Mu);
std::cerr << "================== Job " << C
<< " exited with exit code " << ExitCode
<< " =================\n";
@@ -154,10 +164,12 @@ static int RunInMultipleProcesses(int argc, char **argv, int NumWorkers,
Cmd += " ";
}
std::vector<std::thread> V;
+ std::thread Pulse(PulseThread);
for (int i = 0; i < NumWorkers; i++)
V.push_back(std::thread(WorkerThread, Cmd, &Counter, NumJobs, &HasErrors));
for (auto &T : V)
T.join();
+ Pulse.join();
return HasErrors ? 1 : 0;
}
OpenPOWER on IntegriCloud