blob: 1bd56b73216c61358fdab3eab5d292660c1dbc8e [file] [log] [blame]
; Test functionality of -D# option: numeric variables are defined to the right
; value and CHECK directives using them match as expected given the value set.
; Tests with default format specifier.
RUN: FileCheck -D#NUMVAL1=8 -D#NUMVAL2='NUMVAL1 + 4' --check-prefixes CHECKNUM1,CHECKNUM2 --input-file %s %s
RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -D#NUMVAL1=7 -D#NUMVAL2=12 --check-prefix CHECKNUM1 --input-file %s %s 2>&1 \
RUN: | FileCheck %s --strict-whitespace --check-prefix NUMERRMSG1
RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -D#NUMVAL1=8 -D#NUMVAL2=8 --check-prefix CHECKNUM2 --input-file %s %s 2>&1 \
RUN: | FileCheck %s --strict-whitespace --check-prefix NUMERRMSG2
RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -D#NUMVAL1=8 -D#NUMVAL2=8 --check-prefix NUMNOT1 --input-file %s %s 2>&1 \
RUN: | FileCheck %s --strict-whitespace --check-prefix NOT-NUMERRMSG1
RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -D#NUMVAL1=7 -D#NUMVAL2=12 --check-prefix NUMNOT1 --input-file %s %s 2>&1 \
RUN: | FileCheck %s --strict-whitespace --check-prefix NOT-NUMERRMSG2
RUN: FileCheck -D#NUMVAL1=7 -D#NUMVAL2=8 --check-prefix NUMNOT1 --input-file %s %s
Numeric value #1 = 8
Numeric value #2 = 12
CHECKNUM1: Numeric value #1 = [[#NUMVAL1]]
CHECKNUM2: Numeric value #2 = [[#NUMVAL2]]
NUMNOT1-NOT: Numeric value #1 = [[#NUMVAL1]]
NUMNOT1-NOT: Numeric value #2 = [[#NUMVAL2]]
NUMERRMSG1: defines.txt:[[#@LINE-5]]:12: error: CHECKNUM1: expected string not found in input
NUMERRMSG1: defines.txt:1:1: note: scanning from here
NUMERRMSG1: defines.txt:1:1: note: with "NUMVAL1" equal to "7"
NUMERRMSG1: defines.txt:[[#@LINE-10]]:1: note: possible intended match here
NUMERRMSG2: defines.txt:[[#@LINE-9]]:12: error: CHECKNUM2: expected string not found in input
NUMERRMSG2: defines.txt:1:1: note: scanning from here
NUMERRMSG2: defines.txt:1:1: note: with "NUMVAL2" equal to "8"
NUMERRMSG2: defines.txt:[[#@LINE-14]]:1: note: possible intended match here
NOT-NUMERRMSG1: defines.txt:[[#@LINE-13]]:14: error: {{NUMNOT1}}-NOT: excluded string found in input
NOT-NUMERRMSG1: defines.txt:[[#@LINE-18]]:1: note: found here
NOT-NUMERRMSG1: defines.txt:[[#@LINE-19]]:1: note: with "NUMVAL1" equal to "8"
NOT-NUMERRMSG2: defines.txt:[[#@LINE-16]]:14: error: {{NUMNOT1}}-NOT: excluded string found in input
NOT-NUMERRMSG2: defines.txt:[[#@LINE-21]]:1: note: found here
NOT-NUMERRMSG2: defines.txt:[[#@LINE-22]]:1: note: with "NUMVAL2" equal to "12"
; Tests with explicit format specifiers.
RUN: FileCheck -D#%X,NUMVAL3=8 -D#%X,NUMVAL4='NUMVAL3 + 4' --check-prefixes CHECKNUM3,CHECKNUM4 --input-file %s %s
RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -D#%X,NUMVAL3=7 -D#%X,NUMVAL4=12 --check-prefix CHECKNUM3 --input-file %s %s 2>&1 \
RUN: | FileCheck %s --strict-whitespace --check-prefix NUMERRMSG3
RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -D#%X,NUMVAL3=8 -D#%X,NUMVAL4=8 --check-prefix CHECKNUM4 --input-file %s %s 2>&1 \
RUN: | FileCheck %s --strict-whitespace --check-prefix NUMERRMSG4
RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -D#%X,NUMVAL3=8 -D#%X,NUMVAL4=8 --check-prefix NUMNOT2 --input-file %s %s 2>&1 \
RUN: | FileCheck %s --strict-whitespace --check-prefix NOT-NUMERRMSG3
RUN: %ProtectFileCheckOutput \
RUN: not FileCheck -D#%X,NUMVAL3=7 -D#%X,NUMVAL4=12 --check-prefix NUMNOT2 --input-file %s %s 2>&1 \
RUN: | FileCheck %s --strict-whitespace --check-prefix NOT-NUMERRMSG4
RUN: FileCheck -D#%X,NUMVAL3=7 -D#%X,NUMVAL4=8 --check-prefix NUMNOT2 --input-file %s %s
; Test with explicit and default format specifiers.
RUN: FileCheck -D#NUMVAL3=8 -D#%X,NUMVAL4='NUMVAL3 + 4' --check-prefixes CHECKNUM3,CHECKNUM4 --input-file %s %s
; Test with explicit and implicit format specifiers.
RUN: FileCheck -D#%X,NUMVAL3=8 -D#NUMVAL4='NUMVAL3 + 4' --check-prefixes CHECKNUM3,CHECKNUM4 --input-file %s %s
Numeric value #3 = 8
Numeric value #4 = C
CHECKNUM3: Numeric value #3 = [[#NUMVAL3]]
CHECKNUM4: Numeric value #4 = [[#NUMVAL4]]
NUMNOT2-NOT: Numeric value #3 = [[#NUMVAL3]]
NUMNOT2-NOT: Numeric value #4 = [[#NUMVAL4]]
NUMERRMSG3: defines.txt:[[#@LINE-5]]:12: error: CHECKNUM3: expected string not found in input
NUMERRMSG3: defines.txt:1:1: note: scanning from here
NUMERRMSG3: defines.txt:1:1: note: with "NUMVAL3" equal to "7"
NUMERRMSG3: defines.txt:[[#@LINE-10]]:1: note: possible intended match here
NUMERRMSG4: defines.txt:[[#@LINE-9]]:12: error: CHECKNUM4: expected string not found in input
NUMERRMSG4: defines.txt:1:1: note: scanning from here
NUMERRMSG4: defines.txt:1:1: note: with "NUMVAL4" equal to "8"
NUMERRMSG4: defines.txt:[[#@LINE-14]]:1: note: possible intended match here
NOT-NUMERRMSG3: defines.txt:[[#@LINE-13]]:14: error: {{NUMNOT2}}-NOT: excluded string found in input
NOT-NUMERRMSG3: defines.txt:[[#@LINE-18]]:1: note: found here
NOT-NUMERRMSG3: defines.txt:[[#@LINE-19]]:1: note: with "NUMVAL3" equal to "8"
NOT-NUMERRMSG4: defines.txt:[[#@LINE-16]]:14: error: {{NUMNOT2}}-NOT: excluded string found in input
NOT-NUMERRMSG4: defines.txt:[[#@LINE-21]]:1: note: found here
NOT-NUMERRMSG4: defines.txt:[[#@LINE-22]]:1: note: with "NUMVAL4" equal to "C"