brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · f9aa200 Raw
56 lines · plain
1import lit2 3# Use lit's internal shell to help guarantee test portability.4config.test_format = lit.formats.ShTest(execute_external=False)5 6# %ProtectFileCheckOutput should precede a FileCheck call if and only if the7# call's textual output affects test results.  It's usually easy to tell: just8# look for redirection or piping of the FileCheck call's stdout or stderr.9#10# Examples:11#12#   ; Test another program, using FileCheck to verify its textual output.13#   ; Only FileCheck's exit status affects test results, so a bare FileCheck14#   ; call is sufficient and more convenient for debugging.15#   ;16#   ; RUN: %t | FileCheck %s17#   ; CHECK: {{[0-9]+\.0}}18#19#   ; Test FileCheck itself, but only examine its exit status, so a bare20#   ; FileCheck call is still sufficient and more convenient for debugging.21#   ;22#   ; RUN: FileCheck -input-file %s %s23#   ; CHECK: {{[0-9]+\.0}}24#   ; 5.025#26#   ; Check that the FileCheck trace is off by default.  The first FileCheck27#   ; call's textual output affects test results, so it requires28#   ; %ProtectFileCheckOutput to be safe.29#   ;30#   ; RUN: %ProtectFileCheckOutput FileCheck -input-file %s %s 2>&1 \31#   ; RUN: | FileCheck -allow-empty -check-prefix QUIET %s32#   ;33#   ; CHECK: {{[0-9]+\.0}}34#   ; 5.035#   ; QUIET-NOT: expected string found in input36#37#   ; Check that the FileCheck trace is on when FILECHECK_OPTS=-v.38#   ; FILECHECK_OPTS must be set after %ProtectFileCheckOutput, which clears39#   ; FILECHECK_OPTS beforehand.40#   ;41#   ; RUN: %ProtectFileCheckOutput FILECHECK_OPTS=-v \42#   ; RUN: FileCheck -dump-input=never -input-file %s %s 2>&1 \43#   ; RUN: | FileCheck -check-prefix TRACE %s44#   ;45#   ; CHECK: {{[0-9]+\.0}}46#   ; 5.047#   ; TRACE: expected string found in input48#49# %ProtectFileCheckOutput's purpose is to ensure correct test results when50# developers set FileCheck environment variables (e.g.,51# FILECHECK_OPTS=-dump-input=fail) to tweak the output of FileCheck while52# debugging tests.  If a developer sets values that affect FileCheck's exit53# status (e.g., FILECHECK_OPTS=-strict-whitespace), he shouldn't be surprised54# that test results throughout all test suites are affected.55config.substitutions.append(("%ProtectFileCheckOutput", "env -u FILECHECK_OPTS"))56