[PATCH] D29546: [libFuzzer] Improve fuzzer-jobs test for Posix.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 4 14:02:03 PST 2017

mpividori created this revision.

I update the test to check if the process is running after 2 seconds, with:

  # Check if libFuzzer is still running.
  RUN: kill -0 ${FUZZER_PID}

Before this diff, the test didn't check if libFuzzer is running after 2 seconds, so running it in background and waiting 2 second was useless.



Index: lib/Fuzzer/test/fuzzer-jobs.test
--- lib/Fuzzer/test/fuzzer-jobs.test
+++ lib/Fuzzer/test/fuzzer-jobs.test
@@ -1,3 +1,5 @@
+REQUIRES: posix
 RUN: rm -rf %tmp
 RUN: mkdir %tmp && cd %tmp
 # Create a shared corpus directory
@@ -14,16 +16,14 @@
 # files by now.
 RUN: ls fuzz-0.log
 RUN: ls fuzz-1.log
+# Check if libFuzzer is still running.
+RUN: kill -0 ${FUZZER_PID}
 # Wait for libfuzzer to finish.
-# This probably isn't portable but we need a way to block until
-# the fuzzer is done otherwise we might remove the files while
-# they are being used.
-RUN: while kill -0 ${FUZZER_PID}; do : ; done
+RUN: wait ${FUZZER_PID}
 RUN: rm -f fuzz-{0,1}.log
 RUN: rm -rf FuzzerJobsTestCORPUS
 RUN: FileCheck -input-file=%t-fuzzer-jobs-test.log %s
 RUN: rm %t-fuzzer-jobs-test.log
-RUN: cd ../
 CHECK-DAG: Job 0 exited with exit code 0
 CHECK-DAG: Job 1 exited with exit code 0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29546.87105.patch
Type: text/x-patch
Size: 950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170204/5843fae0/attachment.bin>

More information about the llvm-commits mailing list