1# Check that libFuzzer honors SIGUSR1/SIGUSR2
2# FIXME: Disabled on Windows for now because of reliance on posix only features
3# (eg: export, "&", pkill).
4UNSUPPORTED: darwin, windows
5RUN: rm -rf %t
6RUN: mkdir -p %t
7RUN: %cpp_compiler %S/SleepOneSecondTest.cpp -o %t/LFSIGUSR
8
9RUN: mkdir -p %t/C1 %t/C2
10RUN: echo a > %t/C2/a
11RUN: echo b > %t/C2/b
12RUN: echo c > %t/C2/c
13RUN: echo d > %t/C2/d
14RUN: echo e > %t/C2/e
15RUN: echo f > %t/C2/f
16RUN: echo g > %t/C2/g
17RUN: echo h > %t/C2/g
18RUN: echo i > %t/C2/g
19RUN: echo j > %t/C2/g
20RUN: echo k > %t/C2/g
21RUN: echo l > %t/C2/g
22RUN: echo m > %t/C2/g
23RUN: echo n > %t/C2/g
24RUN: echo o > %t/C2/g
25
26# Run in new session so we can easily kill child processes all at once.
27RUN: setsid %run %t/LFSIGUSR -merge=1 -merge_control_file=%t/MCF %t/C1 %t/C2 2>%t/log & export PID=$!
28RUN: sleep 3
29RUN: kill -SIGUSR2 -$(ps -o sess= $PID | grep -o '[0-9]*')
30RUN: wait $PID || true
31RUN: sleep 3
32RUN: cat %t/log | FileCheck %s --dump-input=fail
33RUN: grep C2/g %t/MCF
34RUN: grep STARTED %t/MCF
35RUN: tail -n 2 %t/MCF | grep FT
36RUN: tail -n 1 %t/MCF | grep COV
37
38CHECK: INFO: signal received, trying to exit gracefully
39CHECK: INFO: libFuzzer: exiting as requested
40