Debian Codegraph @

tests/thirdparty/Fuzzer/test/fuzzer-jobs.test

raw
1 RUN: rm -rf %tmp
2 RUN: mkdir %tmp && cd %tmp
3 # Create a shared corpus directory
4 RUN: rm -rf FuzzerJobsTestCORPUS
5 RUN: mkdir FuzzerJobsTestCORPUS
6 RUN: rm -f fuzz-{0,1}.log
7 # Start fuzzer and in parallel check that the output files
8 # that should be created exist.
9 RUN: LLVMFuzzer-EmptyTest -max_total_time=4 -jobs=2 -workers=2 FuzzerJobsTestCORPUS > %t-fuzzer-jobs-test.log 2>&1 & export FUZZER_PID=$!
10 # Wait a short while to give time for the child processes
11 # to start fuzzing
12 RUN: sleep 2
13 # If the instances are running in parallel they should have created their log
14 # files by now.
15 RUN: ls fuzz-0.log
16 RUN: ls fuzz-1.log
17 # Wait for libfuzzer to finish.
18 # This probably isn't portable but we need a way to block until
19 # the fuzzer is done otherwise we might remove the files while
20 # they are being used.
21 RUN: while kill -0 ${FUZZER_PID}; do : ; done
22 RUN: rm -f fuzz-{0,1}.log
23 RUN: rm -rf FuzzerJobsTestCORPUS
24 RUN: FileCheck -input-file=%t-fuzzer-jobs-test.log %s
25 RUN: rm %t-fuzzer-jobs-test.log
26 RUN: cd ../
27
28 CHECK-DAG: Job 0 exited with exit code 0
29 CHECK-DAG: Job 1 exited with exit code 0