Debian Codegraph @

llvm/utils/lit/tests/shtest-external-shell-kill.py

raw
1 # This test exercises an external shell use case that, at least at one time,
2 # appeared in the following tests:
3 #
4 # compiler-rt/test/fuzzer/fork-sigusr.test
5 # compiler-rt/test/fuzzer/merge-sigusr.test
6 # compiler-rt/test/fuzzer/sigint.test
7 # compiler-rt/test/fuzzer/sigusr.test
8 #
9 # That is, a RUN line can be:
10 #
11 # cmd & PID=$!
12 #
13 # It is important that '&' only puts 'cmd' in the background and not the
14 # debugging commands that lit inserts before 'cmd'. Otherwise:
15 #
16 # - The debugging commands might execute later than they are supposed to.
17 # - A later 'kill $PID' can kill more than just 'cmd'. We've seen it even
18 # manage to terminate the shell running lit.
19 #
20 # The last FileCheck directive below checks that the debugging commands for the
21 # above RUN line are not killed and do execute at the right time.
22
23 # RUN: %{lit} -a %{inputs}/shtest-external-shell-kill | %{filter-lit} | FileCheck %s
24 # END.
25
26 # CHECK: Command Output (stdout):
27 # CHECK-NEXT: --
28 # CHECK-NEXT: start
29 # CHECK-NEXT: end
30 # CHECK-EMPTY:
31 # CHECK-NEXT: --
32 # CHECK-NEXT: Command Output (stderr):
33 # CHECK-NEXT: --
34 # CHECK-NEXT: echo start # RUN: at line 1
35 # CHECK-NEXT: echo start
36 # CHECK-NEXT: sleep [[#]] & PID=$! # RUN: at line 2