xref: /llvm-project/llvm/utils/lit/tests/shtest-inject.py (revision 3dc7039f244f5da7368b8ba2f0e419c7d851c851)
1# Check that we can inject preamble commands at the beginning of a ShTest.
2#
3# For one case, check the execution trace as these preamble commands have
4# "preamble command" instead of the usual "{{RUN}}: at line N".
5
6# RUN: %{lit} %{inputs}/shtest-inject/test-empty.txt --show-all | FileCheck --check-prefix=CHECK-TEST1 %s
7#
8#       CHECK-TEST1: Command Output (stdout):
9#  CHECK-TEST1-NEXT: --
10#  CHECK-TEST1-NEXT: # preamble command line
11#  CHECK-TEST1-NEXT: echo "THIS WAS"
12#  CHECK-TEST1-NEXT: # executed command: echo 'THIS WAS'
13#  CHECK-TEST1-NEXT: # .---command stdout{{-*}}
14#  CHECK-TEST1-NEXT: # | THIS WAS
15#  CHECK-TEST1-NEXT: # `---{{-*}}
16#  CHECK-TEST1-NEXT: # preamble command line
17#  CHECK-TEST1-NEXT: echo
18#  CHECK-TEST1-NEXT: "INJECTED"
19#  CHECK-TEST1-NEXT: # executed command: echo INJECTED
20#  CHECK-TEST1-NEXT: # .---command stdout{{-*}}
21#  CHECK-TEST1-NEXT: # | INJECTED
22#  CHECK-TEST1-NEXT: # `---{{-*}}
23# CHECK-TEST1-EMPTY:
24#  CHECK-TEST1-NEXT: --
25#
26# CHECK-TEST1: Passed: 1
27
28# RUN: %{lit} %{inputs}/shtest-inject/test-one.txt --show-all | FileCheck --check-prefix=CHECK-TEST2 %s
29#
30# CHECK-TEST2: THIS WAS
31# CHECK-TEST2: INJECTED
32# CHECK-TEST2: IN THE FILE
33#
34# CHECK-TEST2: Passed: 1
35
36# RUN: %{lit} %{inputs}/shtest-inject/test-many.txt --show-all | FileCheck --check-prefix=CHECK-TEST3 %s
37#
38# CHECK-TEST3: THIS WAS
39# CHECK-TEST3: INJECTED
40# CHECK-TEST3: IN THE FILE
41# CHECK-TEST3: IF IT WORKS
42# CHECK-TEST3: AS EXPECTED
43#
44# CHECK-TEST3: Passed: 1
45