summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerUtil.cpp
diff options
context:
space:
mode:
authorDan Liew <dan@su-root.co.uk>2016-08-12 18:29:36 +0000
committerDan Liew <dan@su-root.co.uk>2016-08-12 18:29:36 +0000
commited3c9cae4972099135982093d40301f7d96fa3b4 (patch)
tree0a9af3f830bb1230450d59a0341a04c819d9d3b5 /llvm/lib/Fuzzer/FuzzerUtil.cpp
parentb7abde0343e1042fec643faca571882e3fc133b7 (diff)
downloadbcm5719-llvm-ed3c9cae4972099135982093d40301f7d96fa3b4.tar.gz
bcm5719-llvm-ed3c9cae4972099135982093d40301f7d96fa3b4.zip
[LibFuzzer] Fix `-jobs=<N>` where <N> > 1 and the number of workers is > 1 on macOS.
The original `ExecuteCommand()` called `system()` from the C library. The C library implementation of this on macOS contains a mutex which serializes calls to `system()`. This prevented the `-jobs=` flag from running copies of the fuzzing binary in parallel which is the opposite of what is intended. To fix this on macOS an alternative implementation of `ExecuteCommand()` is provided that can be used concurrently. This is provided in `FuzzerUtilDarwin.cpp` which is guarded to only compile code on Apple platforms. The existing implementation has been moved to a new file `FuzzerUtilLinux.cpp` which is guarded to only compile code on Linux. This commit includes a simple test to check that LibFuzzer is being executed in parallel when requested. Differential Revision: https://reviews.llvm.org/D22742 llvm-svn: 278544
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerUtil.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerUtil.cpp4
1 files changed, 0 insertions, 4 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerUtil.cpp b/llvm/lib/Fuzzer/FuzzerUtil.cpp
index c2ae94c4d3d..a5218d422da 100644
--- a/llvm/lib/Fuzzer/FuzzerUtil.cpp
+++ b/llvm/lib/Fuzzer/FuzzerUtil.cpp
@@ -146,10 +146,6 @@ int NumberOfCpuCores() {
return N;
}
-int ExecuteCommand(const std::string &Command) {
- return system(Command.c_str());
-}
-
bool ToASCII(uint8_t *Data, size_t Size) {
bool Changed = false;
for (size_t i = 0; i < Size; i++) {
OpenPOWER on IntegriCloud