37 lines · python
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.test5# compiler-rt/test/fuzzer/merge-sigusr.test6# compiler-rt/test/fuzzer/sigint.test7# compiler-rt/test/fuzzer/sigusr.test8#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 the14# 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 even18# manage to terminate the shell running lit.19#20# The last FileCheck directive below checks that the debugging commands for the21# 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 %s24# END.25 26# CHECK: Command Output (stdout):27# CHECK-NEXT: --28# CHECK-NEXT: start29# CHECK-NEXT: end30# 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 start36# CHECK-NEXT: sleep [[#]] & PID=$! # RUN: at line 237