forked from OSchip/llvm-project
[gen_ast_dump_json_test.py] Skip manual tests when using --update
See https://reviews.llvm.org/D70119
This commit is contained in:
parent
049f4c90eb
commit
90dbb47616
|
@ -68,6 +68,8 @@ def main():
|
|||
update_or_generate_group.add_argument("--update", help="Update the file in-place", action="store_true")
|
||||
update_or_generate_group.add_argument("--opts", help="other options",
|
||||
action="store", default='', type=str)
|
||||
parser.add_argument("--update-manual", help="When using --update, also update files that do not have the "
|
||||
"autogenerated disclaimer", action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
if not args.source:
|
||||
|
@ -89,17 +91,20 @@ def main():
|
|||
# When updating the first line of the test must be a RUN: line
|
||||
with open(args.source, "r") as srcf:
|
||||
first_line = srcf.readline()
|
||||
filters_line_next = False
|
||||
found_autogenerated_line = False
|
||||
filters_line = None
|
||||
for i, line in enumerate(srcf.readlines()):
|
||||
if filters_line_next:
|
||||
if found_autogenerated_line:
|
||||
# print("Filters line: '", line.rstrip(), "'", sep="")
|
||||
if line.startswith(filters_line_prefix):
|
||||
filters_line = line[len(filters_line_prefix):].rstrip()
|
||||
break
|
||||
if line.startswith(note_firstline):
|
||||
filters_line_next = True
|
||||
found_autogenerated_line = True
|
||||
# print("Found autogenerated disclaimer at line", i + 1)
|
||||
if not found_autogenerated_line and not args.update_manual:
|
||||
print("Not updating", args.source, "since it is not autogenerated.")
|
||||
sys.exit(0)
|
||||
if not args.filters and filters_line:
|
||||
args.filters = filters_line
|
||||
print("Inferred filters as '" + args.filters + "'")
|
||||
|
|
Loading…
Reference in New Issue