summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>2019-10-29 12:58:10 +0000
committerAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>2019-11-15 12:52:56 +0000
commit90dbb47616da69d9cb41e9dfd520ef90b8afa26f (patch)
treea79f3a463eeb8f5b676f4e958788089ff3407c1b
parent049f4c90eb146f80f0f8ca2c7341547b67513e3c (diff)
downloadbcm5719-llvm-90dbb47616da69d9cb41e9dfd520ef90b8afa26f.tar.gz
bcm5719-llvm-90dbb47616da69d9cb41e9dfd520ef90b8afa26f.zip
[gen_ast_dump_json_test.py] Skip manual tests when using --update
See https://reviews.llvm.org/D70119
-rw-r--r--clang/test/AST/gen_ast_dump_json_test.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/test/AST/gen_ast_dump_json_test.py b/clang/test/AST/gen_ast_dump_json_test.py
index 464987b2217..f32b69afb03 100644
--- a/clang/test/AST/gen_ast_dump_json_test.py
+++ b/clang/test/AST/gen_ast_dump_json_test.py
@@ -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 + "'")
OpenPOWER on IntegriCloud