70 lines · plain
1; Test that variables not starting with dollar sign get undefined after a2; CHECK-LABEL directive iff --enable-var-scope is used.3 4; Reference run: variables remain defined at all time when not using5; --enable-var-scope option.6RUN: FileCheck --check-prefixes CHECK,CHECK-LOCAL-BOTH,CHECK-GLOBAL --input-file %s %s7 8RUN: FileCheck --check-prefixes CHECK,CHECK-GLOBAL --enable-var-scope --input-file %s %s9RUN: %ProtectFileCheckOutput not FileCheck --check-prefixes CHECK,CHECK-LOCAL-TEXT --enable-var-scope --input-file %s %s 2>&1 \10RUN: | FileCheck --implicit-check-not "undefined variable:" --check-prefixes ERRUNDEF,ERRUNDEF-LOCAL %s11RUN: %ProtectFileCheckOutput not FileCheck --check-prefixes CHECK,CHECK-LOCAL-NUM --enable-var-scope --input-file %s %s 2>&1 \12RUN: | FileCheck --implicit-check-not "undefined variable:" --check-prefixes ERRUNDEF,ERRUNDEF-LOCNUM %s13RUN: %ProtectFileCheckOutput not FileCheck --check-prefixes CHECK,CHECK-LOCAL-BOTH --enable-var-scope --input-file %s %s 2>&1 \14RUN: | FileCheck --implicit-check-not "undefined variable:" --check-prefixes ERRUNDEF,ERRUNDEF-LOCAL,ERRUNDEF-LOCNUM %s15 16local117global118CHECK: [[LOCAL:loc[^[:digit:]]*]][[#LOCNUM:]]19CHECK: [[$GLOBAL:glo[^[:digit:]]*]][[#$GLOBNUM:]]20 21local222global223CHECK: [[LOCAL]][[#LOCNUM+1]]24CHECK: [[$GLOBAL]][[#$GLOBNUM+1]]25 26// Barrier to clear local variables27barrier1:28CHECK-LABEL: barrier129 30local331global332CHECK-LOCAL-TEXT: [[LOCAL]]333CHECK-LOCAL-NUM: local[[#LOCNUM+2]]34CHECK-LOCAL-BOTH: [[LOCAL]][[#LOCNUM+2]]35CHECK-GLOBAL: [[$GLOBAL]][[#$GLOBNUM+2]]36 37// Barrier to continue FileCheck execution even after the first fail38barrier2:39CHECK-LABEL: barrier240 41// Reassign the variables to check that clearing-after-reassigning works42local443global444CHECK: [[LOCAL:loc[^[:digit:]]*]][[#LOCNUM:]]45CHECK: [[$GLOBAL:glo[^[:digit:]]*]][[#$GLOBNUM:]]46 47// Barrier to clear local variables48barrier3:49CHECK-LABEL: barrier350 51local552global553CHECK-LOCAL-TEXT: [[LOCAL]]554CHECK-LOCAL-NUM: local[[#LOCNUM+1]]55CHECK-LOCAL-BOTH: [[LOCAL]][[#LOCNUM+1]]56CHECK-GLOBAL: [[$GLOBAL]][[#$GLOBNUM+1]]57 58 59// Check that the tests fail as expected60ERRUNDEF-LOCAL: undefined variable: LOCAL61ERRUNDEF-LOCNUM: undefined variable: LOCNUM62ERRUNDEF-LOCAL: undefined variable: LOCAL63ERRUNDEF-LOCNUM: undefined variable: LOCNUM64 65// Look for "Input was:" to only match the error messages before the input-context.66//67// The regex /([[:space:]]|.)*/ matches all remaining characters,68// to avoid fails due to --implicit-check-not69ERRUNDEF: {{^Input was:([[:space:]]|.)*}}70