Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions filecheck/FileCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ def main():
print("FileCheck command line: {}".format(check_file))
exit(2)

current_not_checks = []
try:
current_not_checks = []
failed_check = None

while True:
Expand Down Expand Up @@ -415,6 +415,9 @@ def main():
raise CheckFailedException(failed_check)

elif check_result == CheckResult.CHECK_NOT_WITHOUT_MATCH:
if failed_check:
raise CheckFailedException(failed_check)

try:
current_not_checks.append(current_check)
current_check = next(check_iterator)
Expand Down Expand Up @@ -454,10 +457,18 @@ def main():
try:
while True:
line_idx, line = next(stdin_input_iter)
if check_line(line, current_check, args.match_full_lines) == \
CheckResult.CHECK_NOT_MATCH:
current_check_line_idx = line_idx
break

for not_check in current_not_checks:
if check_line(line, not_check, args.match_full_lines) == \
CheckResult.CHECK_NOT_MATCH:
current_check_line_idx = line_idx
failed_check = FailedCheck(not_check, line_idx)
raise CheckFailedException(failed_check)

except CheckFailedException as e:
current_check = e.failed_check.check
current_check_line_idx = e.failed_check.line_idx

except StopIteration:
exit(0)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
; CHECK-NOT:warning
; CHECK-NOT:error
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
not w a r n i n g string
warning
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; RUN: cat %S/filecheck.input | (%FILECHECK_EXEC %S/filecheck.check 2>&1; test $? = 1;) | %FILECHECK_TESTER_EXEC %s --strict-whitespace --match-full-lines
; CHECK:{{^.*}}FileCheck{{(\.py)?$}}
; CHECK:; CHECK-NOT:warning
; CHECK: ^
; CHECK:<stdin>:2:1: note: found here
; CHECK:warning
; CHECK:^~~~~~~
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
; CHECK-NOT:warning
; CHECK-NOT:error
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
warning
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
; RUN: cat %S/filecheck.input | (%FILECHECK_EXEC %S/filecheck.check 2>&1; test $? = 1;) | %FILECHECK_TESTER_EXEC %s --strict-whitespace --match-full-lines
; CHECK:{{^.*}}FileCheck{{(\.py)?$}}
; CHECK:{{^.*}}filecheck.check:1:13: error: CHECK-NOT: excluded string found in input
; CHECK:; CHECK-NOT:warning
; CHECK: ^
; CHECK:<stdin>:1:1: note: found here
; CHECK:warning
; CHECK:^~~~~~~
; CHECK-EMPTY: