| 236 | } |
| 237 | |
| 238 | static void WorkerThread(const Command &BaseCmd, std::atomic<unsigned> *Counter, |
| 239 | unsigned NumJobs, std::atomic<bool> *HasErrors) { |
| 240 | while (true) { |
| 241 | unsigned C = (*Counter)++; |
| 242 | if (C >= NumJobs) break; |
| 243 | std::string Log = "fuzz-" + std::to_string(C) + ".log"; |
| 244 | Command Cmd(BaseCmd); |
| 245 | Cmd.setOutputFile(Log); |
| 246 | Cmd.combineOutAndErr(); |
| 247 | if (Flags.verbosity) { |
| 248 | std::string CommandLine = Cmd.toString(); |
| 249 | Printf("%s\n", CommandLine.c_str()); |
| 250 | } |
| 251 | int ExitCode = ExecuteCommand(Cmd); |
| 252 | if (ExitCode != 0) |
| 253 | *HasErrors = true; |
| 254 | std::lock_guard<std::mutex> Lock(Mu); |
| 255 | Printf("================== Job %u exited with exit code %d ============\n", |
| 256 | C, ExitCode); |
| 257 | fuzzer::CopyFileToErr(Log); |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | static void ValidateDirectoryExists(const std::string &Path, |
| 262 | bool CreateDirectory) { |
nothing calls this directly
no test coverage detected