Skip to content

Commit c582f8d

Browse files
authored
[NFC] Fix note about manually generated test output (#7221)
The note mentioned update_lit_checks.py in the first line, which made update_lit_checks.py think that it _should_ update the test output, even though the comment was explicitly about how it should not update the test output. Reword the comment to avoid the problem. Also make the check in the update script stricter for good measure.
1 parent c8bfe28 commit c582f8d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

scripts/update_lit_checks.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
script_dir = os.path.dirname(__file__)
3131
script_name = os.path.basename(__file__)
3232

33-
NOTICE = (';; NOTE: Assertions have been generated by {script} and should not' +
34-
' be edited.')
33+
NOTICE_PREFIX = f';; NOTE: Assertions have been generated by {script_name}'
34+
NOTICE = NOTICE_PREFIX + '{args} and should not be edited.'
3535

3636
RUN_LINE_RE = re.compile(r'^\s*;;\s*RUN:\s*(.*)$')
3737
CHECK_PREFIX_RE = re.compile(r'.*--check-prefix[= ](\S+).*')
@@ -80,7 +80,7 @@ def itertests(args):
8080
with open(test) as f:
8181
lines = [line.rstrip() for line in f]
8282
first_line = lines[0] if lines else ''
83-
if script_name not in first_line and not args.force:
83+
if NOTICE_PREFIX not in first_line and not args.force:
8484
warn(f'Skipping test {test} which was not generated by '
8585
f'{script_name}. Use -f to override.')
8686
continue
@@ -258,12 +258,12 @@ def update_test(args, test, lines, tmp):
258258
_, kind, name = indentKindName(match)
259259
named_items.append((kind, name))
260260

261-
script = script_name
261+
notice_args = ''
262262
if all_items:
263-
script += ' --all-items'
263+
notice_args += ' --all-items'
264264
if output_kind != 'wat':
265-
script += f' --output={output_kind}'
266-
output_lines = [NOTICE.format(script=script)]
265+
notice_args += f' --output={output_kind}'
266+
output_lines = [NOTICE.format(args=notice_args)]
267267

268268
def emit_checks(indent, prefix, lines):
269269
def pad(line):

test/lit/passes/memory-copy-fill-lowering.wast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
;; NOTE: These assertions have been manually generated, and cannot be updated by update_lit_checks.py
2-
;; because of the assertion at the end (update_lit_checks.py ignores the features section because it's
1+
;; NOTE: These assertions have been manually generated because of the assertion
2+
;; at the end (update_lit_checks.py ignores the features section because it's
33
;; not semantically part of the module.)
44

55
;; RUN: wasm-opt --enable-bulk-memory %s --llvm-memory-copy-fill-lowering --emit-target-features -S -o - | filecheck %s

0 commit comments

Comments
 (0)