3 # Use lit's internal shell to help guarantee test portability.
4 config.test_format = lit.formats.ShTest(execute_external=False)
6 # %ProtectFileCheckOutput should precede a FileCheck call if and only if the
7 # call's textual output affects test results. It's usually easy to tell: just
8 # look for redirection or piping of the FileCheck call's stdout or stderr.
12 # ; Test another program, using FileCheck to verify its textual output.
13 # ; Only FileCheck's exit status affects test results, so a bare FileCheck
14 # ; call is sufficient and more convenient for debugging.
16 # ; RUN: %t | FileCheck %s
17 # ; CHECK: {{[0-9]+\.0}}
19 # ; Test FileCheck itself, but only examine its exit status, so a bare
20 # ; FileCheck call is still sufficient and more convenient for debugging.
22 # ; RUN: FileCheck -input-file %s %s
23 # ; CHECK: {{[0-9]+\.0}}
26 # ; Check that the FileCheck trace is off by default. The first FileCheck
27 # ; call's textual output affects test results, so it requires
28 # ; %ProtectFileCheckOutput to be safe.
30 # ; RUN: %ProtectFileCheckOutput FileCheck -input-file %s %s 2>&1 \
31 # ; RUN: | FileCheck -allow-empty -check-prefix QUIET %s
33 # ; CHECK: {{[0-9]+\.0}}
35 # ; QUIET-NOT: expected string found in input
37 # ; Check that the FileCheck trace is on when FILECHECK_OPTS=-v.
38 # ; FILECHECK_OPTS must be set after %ProtectFileCheckOutput, which clears
39 # ; FILECHECK_OPTS beforehand.
41 # ; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-v \
42 # ; RUN: FileCheck -dump-input=never -input-file %s %s 2>&1 \
43 # ; RUN: | FileCheck -check-prefix TRACE %s
45 # ; CHECK: {{[0-9]+\.0}}
47 # ; TRACE: expected string found in input
49 # %ProtectFileCheckOutput's purpose is to ensure correct test results when
50 # developers set FileCheck environment variables (e.g.,
51 # FILECHECK_OPTS=-dump-input=fail) to tweak the output of FileCheck while
52 # debugging tests. If a developer sets values that affect FileCheck's exit
53 # status (e.g., FILECHECK_OPTS=-strict-whitespace), he shouldn't be surprised
54 # that test results throughout all test suites are affected.
55 config.substitutions.append(("%ProtectFileCheckOutput", "env -u FILECHECK_OPTS"))