33
44; Reference run: variables remain defined at all time when not using
55; --enable-var-scope option.
6- RUN: FileCheck --check-prefixes CHECK,LOCAL3, GLOBAL --input-file %s %s
6+ RUN: FileCheck --check-prefixes CHECK,CHECK-LOCAL-BOTH,CHECK- GLOBAL --input-file %s %s
77
8- RUN: FileCheck --check-prefixes CHECK,GLOBAL --enable-var-scope --input-file %s %s
9- RUN: %ProtectFileCheckOutput not FileCheck --check-prefixes CHECK,LOCAL1 --enable-var-scope --input-file %s %s 2>&1 \
10- RUN: | FileCheck --check-prefix ERRUNDEFLOCAL %s
11- RUN: %ProtectFileCheckOutput not FileCheck --check-prefixes CHECK,LOCAL2 --enable-var-scope --input-file %s %s 2>&1 \
12- RUN: | FileCheck --check-prefix ERRUNDEFLOCNUM %s
13- RUN: %ProtectFileCheckOutput not FileCheck --check-prefixes CHECK,LOCAL3 --enable-var-scope --input-file %s %s 2>&1 \
14- RUN: | FileCheck --check-prefixes ERRUNDEFLOCAL,ERRUNDEFLOCNUM %s
8+ RUN: FileCheck --check-prefixes CHECK,CHECK- GLOBAL --enable-var-scope --input-file %s %s
9+ RUN: %ProtectFileCheckOutput not FileCheck --check-prefixes CHECK,CHECK-LOCAL-TEXT --enable-var-scope --input-file %s %s 2>&1 \
10+ RUN: | FileCheck --implicit- check-not "undefined variable:" --check-prefixes ERRUNDEF,ERRUNDEF-LOCAL %s
11+ RUN: %ProtectFileCheckOutput not FileCheck --check-prefixes CHECK,CHECK-LOCAL-NUM --enable-var-scope --input-file %s %s 2>&1 \
12+ RUN: | FileCheck --implicit- check-not "undefined variable:" --check-prefixes ERRUNDEF,ERRUNDEF-LOCNUM %s
13+ RUN: %ProtectFileCheckOutput not FileCheck --check-prefixes CHECK,CHECK-LOCAL-BOTH --enable-var-scope --input-file %s %s 2>&1 \
14+ RUN: | FileCheck --implicit- check-not "undefined variable:" --check- prefixes ERRUNDEF,ERRUNDEF-LOCAL,ERRUNDEF-LOCNUM %s
1515
1616local1
1717global1
@@ -23,15 +23,47 @@ global2
2323CHECK: [[LOCAL]][[#LOCNUM+1]]
2424CHECK: [[$GLOBAL]][[#$GLOBNUM+1]]
2525
26- barrier:
27- CHECK-LABEL: barrier
26+ // Barrier to clear local variables
27+ barrier1:
28+ CHECK-LABEL: barrier1
2829
2930local3
3031global3
31- LOCAL1 : [[LOCAL]]3
32- LOCAL2 : local[[#LOCNUM+2]]
33- LOCAL3 : [[LOCAL]][[#LOCNUM+2]]
34- GLOBAL: [[$GLOBAL]][[#$GLOBNUM+2]]
32+ CHECK-LOCAL-TEXT : [[LOCAL]]3
33+ CHECK-LOCAL-NUM : local[[#LOCNUM+2]]
34+ CHECK-LOCAL-BOTH : [[LOCAL]][[#LOCNUM+2]]
35+ CHECK- GLOBAL: [[$GLOBAL]][[#$GLOBNUM+2]]
3536
36- ERRUNDEFLOCAL: undefined variable: LOCAL
37- ERRUNDEFLOCNUM: undefined variable: LOCNUM
37+ // Barrier to continue FileCheck execution even after the first fail
38+ barrier2:
39+ CHECK-LABEL: barrier2
40+
41+ // Reassign the variables to check that clearing-after-reassigning works
42+ local4
43+ global4
44+ CHECK: [[LOCAL:loc[^[:digit:]]*]][[#LOCNUM:]]
45+ CHECK: [[$GLOBAL:glo[^[:digit:]]*]][[#$GLOBNUM:]]
46+
47+ // Barrier to clear local variables
48+ barrier3:
49+ CHECK-LABEL: barrier3
50+
51+ local5
52+ global5
53+ CHECK-LOCAL-TEXT: [[LOCAL]]5
54+ CHECK-LOCAL-NUM: local[[#LOCNUM+1]]
55+ CHECK-LOCAL-BOTH: [[LOCAL]][[#LOCNUM+1]]
56+ CHECK-GLOBAL: [[$GLOBAL]][[#$GLOBNUM+1]]
57+
58+
59+ // Check that the tests fail as expected
60+ ERRUNDEF-LOCAL: undefined variable: LOCAL
61+ ERRUNDEF-LOCNUM: undefined variable: LOCNUM
62+ ERRUNDEF-LOCAL: undefined variable: LOCAL
63+ ERRUNDEF-LOCNUM: undefined variable: LOCNUM
64+
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-not
69+ ERRUNDEF: {{^Input was:([[:space:]]|.)*}}
0 commit comments