xref: /llvm-project/llvm/test/FileCheck/dump-input/enable.txt (revision d3778490622bca45c0768e8ed590cd9fa1797dee)
1;--------------------------------------------------
2; Create the check file, good input, and bad input.
3;
4; For both good and bad input, make sure the -v trace has at least one remark
5; so we can check how trace suppression is affected by -dump-input.
6;--------------------------------------------------
7
8; RUN: echo hello > %t.good
9; RUN: echo world >> %t.good
10
11; RUN: echo hello > %t.err
12; RUN: echo whirled >> %t.err
13
14; RUN: echo 'CHECK: hello' > %t.check
15; RUN: echo 'CHECK-NEXT: world' >> %t.check
16
17;--------------------------------------------------
18; Check -dump-input=<bad value>.
19;--------------------------------------------------
20
21; RUN: %ProtectFileCheckOutput \
22; RUN: not FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
23; RUN:               -match-full-lines -dump-input=foobar 2>&1 \
24; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL
25
26; No positional arg.
27; RUN: %ProtectFileCheckOutput not FileCheck -dump-input=foobar 2>&1 \
28; RUN: | FileCheck %s -match-full-lines -check-prefix=BADVAL
29
30BADVAL: {{F|f}}ile{{C|c}}heck{{.*}}: for the --dump-input option: Cannot find option named 'foobar'!
31
32;--------------------------------------------------
33; Check -dump-input=help.
34;--------------------------------------------------
35
36; Appended to normal command line.
37; RUN: %ProtectFileCheckOutput \
38; RUN: FileCheck -input-file %t.err -color %t.check -dump-input=help \
39; RUN: | FileCheck %s -check-prefix=HELP
40
41; No positional arg.
42; RUN: %ProtectFileCheckOutput FileCheck -dump-input=help \
43; RUN: | FileCheck %s -check-prefix=HELP
44
45;--------------------------------------------------
46; Check -dump-input=never.
47;
48; Include the case without -v, which isn't covered elsewhere.
49;--------------------------------------------------
50
51; FileCheck success, no -v => no dump, no trace.
52; RUN: %ProtectFileCheckOutput \
53; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
54; RUN:           -match-full-lines -dump-input=never 2>&1 \
55; RUN: | FileCheck %s -match-full-lines -allow-empty \
56; RUN:             -check-prefixes=NOTRACE,NODUMP
57
58; FileCheck fail, no -v => no dump, no trace.
59; RUN: %ProtectFileCheckOutput \
60; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
61; RUN:               -match-full-lines -dump-input=never 2>&1 \
62; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,ERR,NODUMP
63
64; FileCheck success, -v => no dump, trace.
65; RUN: %ProtectFileCheckOutput \
66; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
67; RUN:           -match-full-lines -dump-input=never -v 2>&1 \
68; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,NODUMP
69
70; FileCheck fail, -v => no dump, trace.
71; RUN: %ProtectFileCheckOutput \
72; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
73; RUN:               -match-full-lines -dump-input=never -v 2>&1 \
74; RUN: | FileCheck %s -match-full-lines -check-prefixes=TRACE,ERR,NODUMP
75
76;--------------------------------------------------
77; Check no -dump-input, which defaults to fail.
78;--------------------------------------------------
79
80; FileCheck success, -v => no dump, no trace.
81; RUN: %ProtectFileCheckOutput \
82; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
83; RUN:           -match-full-lines -v 2>&1 \
84; RUN: | FileCheck %s -match-full-lines -allow-empty \
85; RUN:             -check-prefixes=NOTRACE,NODUMP
86
87; FileCheck fail, -v => dump, no trace.
88; RUN: %ProtectFileCheckOutput \
89; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
90; RUN:               -match-full-lines -v 2>&1 \
91; RUN: | FileCheck %s -match-full-lines \
92; RUN:                -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
93
94;--------------------------------------------------
95; Check -dump-input=fail.
96;
97; Include the case without -v, which isn't covered elsewhere.
98;--------------------------------------------------
99
100; FileCheck success, no -v => no dump, no trace.
101; RUN: %ProtectFileCheckOutput \
102; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
103; RUN:           -match-full-lines -dump-input=fail 2>&1 \
104; RUN: | FileCheck %s -match-full-lines -allow-empty \
105; RUN:             -check-prefixes=NOTRACE,NODUMP
106
107; FileCheck fail, no -v => dump, no trace.
108; RUN: %ProtectFileCheckOutput \
109; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
110; RUN:               -match-full-lines -dump-input=fail 2>&1 \
111; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,ERR,DUMP-ERR
112
113; FileCheck success, -v => no dump, no trace.
114; RUN: %ProtectFileCheckOutput \
115; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
116; RUN:           -match-full-lines -dump-input=fail -v 2>&1 \
117; RUN: | FileCheck %s -match-full-lines -allow-empty \
118; RUN:             -check-prefixes=NOTRACE,NODUMP
119
120; FileCheck fail, -v => dump, no trace.
121; RUN: %ProtectFileCheckOutput \
122; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
123; RUN:               -match-full-lines -dump-input=fail -v 2>&1 \
124; RUN: | FileCheck %s -match-full-lines \
125; RUN:                -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
126
127;--------------------------------------------------
128; Check -dump-input=always.
129;--------------------------------------------------
130
131; FileCheck success, -v => dump, no trace.
132; RUN: %ProtectFileCheckOutput \
133; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
134; RUN:           -match-full-lines -dump-input=always -v 2>&1 \
135; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
136
137; FileCheck fail, -v => dump, no trace.
138; RUN: %ProtectFileCheckOutput \
139; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
140; RUN:               -match-full-lines -dump-input=always -v 2>&1 \
141; RUN: | FileCheck %s -match-full-lines \
142; RUN:                -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
143
144;--------------------------------------------------
145; Check multiple -dump-input options.
146;
147; This occurs most commonly when a test author specifies -dump-input on a
148; specific FileCheck call while a test runner specifies -dump-input in
149; FILECHECK_OPTS, but check the behavior generally.
150;
151; "help" has precedence, and then the most verbose value wins.  The most
152; common combinations involve "fail" and "always", so test those the most.
153;--------------------------------------------------
154
155;- - - - - - - - - - - - - - - - - - - - - - - - -
156; Check duplicate.
157;- - - - - - - - - - - - - - - - - - - - - - - - -
158
159; fail, fail => fail (FileCheck fail => dump)
160; RUN: %ProtectFileCheckOutput \
161; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
162; RUN:               -match-full-lines -dump-input=fail -dump-input=fail -v \
163; RUN:               2>&1 \
164; RUN: | FileCheck %s -match-full-lines \
165; RUN:                -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
166
167;- - - - - - - - - - - - - - - - - - - - - - - - -
168; Check precedence.
169;- - - - - - - - - - - - - - - - - - - - - - - - -
170
171; help, always => help
172; RUN: %ProtectFileCheckOutput \
173; RUN: FileCheck -input-file %t.err -color %t.check \
174; RUN:           -dump-input=help -dump-input=always \
175; RUN: | FileCheck %s -check-prefix=HELP
176
177; always, fail => always (FileCheck success => dump)
178; RUN: %ProtectFileCheckOutput \
179; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
180; RUN:           -match-full-lines -dump-input=always -dump-input=fail \
181; RUN:           -v 2>&1 \
182; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
183
184; fail, never => fail (FileCheck fail => dump)
185; RUN: %ProtectFileCheckOutput \
186; RUN: not FileCheck -input-file %t.err %t.check -check-prefix=CHECK \
187; RUN:               -match-full-lines -dump-input=fail -dump-input=never -v \
188; RUN:               2>&1 \
189; RUN: | FileCheck %s -match-full-lines \
190; RUN:                -check-prefixes=NOTRACE,ERR,DUMP-ERR,DUMP-ERR-V
191
192;- - - - - - - - - - - - - - - - - - - - - - - - -
193; Check that order doesn't matter.
194;- - - - - - - - - - - - - - - - - - - - - - - - -
195
196; fail, always => always (FileCheck success => dump)
197; RUN: %ProtectFileCheckOutput \
198; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
199; RUN:           -match-full-lines -dump-input=fail -dump-input=always \
200; RUN:           -v 2>&1 \
201; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
202
203;- - - - - - - - - - - - - - - - - - - - - - - - -
204; Check that FILECHECK_OPTS isn't handled differently.
205;- - - - - - - - - - - - - - - - - - - - - - - - -
206
207; always, fail => always (FileCheck success => dump)
208; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input=always \
209; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
210; RUN:           -match-full-lines -dump-input=fail -v 2>&1 \
211; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
212
213; fail, always => always (FileCheck success => dump)
214; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-dump-input=fail \
215; RUN: FileCheck -input-file %t.good %t.check -check-prefix=CHECK \
216; RUN:           -match-full-lines -dump-input=always -v 2>&1 \
217; RUN: | FileCheck %s -match-full-lines -check-prefixes=NOTRACE,DUMP-OK
218
219; END.
220
221;--------------------------------------------------
222; Check the output.
223;--------------------------------------------------
224
225; HELP-NOT: {{.}}
226; HELP: The following description was requested by -dump-input=help
227; HELP: - colors {{.*}}
228; HELP-NOT: {{.}}
229
230; Trace is sometimes suppressed.
231; TRACE:       {{.*}}remark:{{.*}}
232; NOTRACE-NOT: remark:
233
234; Error diagnostics are never suppressed.
235; ERR: {{.*}}error:{{.*}}
236
237; NODUMP-NOT: <<<<<<
238
239; DUMP-OK:      Input was:
240; DUMP-OK-NEXT: <<<<<<
241; DUMP-OK-NEXT:          1: hello
242; DUMP-OK-NEXT: check:1     ^~~~~
243; DUMP-OK-NEXT:          2: world
244; DUMP-OK-NEXT: next:2      ^~~~~
245; DUMP-OK-NEXT: >>>>>>
246
247; DUMP-ERR:        Input was:
248; DUMP-ERR-NEXT:   <<<<<<
249; DUMP-ERR-NEXT:            1: hello
250; DUMP-ERR-V-NEXT: check:1     ^~~~~
251; DUMP-ERR-NEXT:   next:2'0         X error: no match found
252; DUMP-ERR-NEXT:            2: whirled
253; DUMP-ERR-NEXT:   next:2'0    ~~~~~~~~
254; DUMP-ERR-NEXT:   next:2'1    ?        possible intended match
255; DUMP-ERR-NEXT:   >>>>>>
256