mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 06:26:08 +00:00

In one of my recent PRs I mistakenly had two test-cases with the same name, preventing one of them to run. Since it's an easy mistake to make (e.g., copy pasting existing test-cases), I ran following sanity-check script over `lldb/test/API`, which found couple of tests which were losing coverage because of this (or in some cases simply had duplicate tests): ``` import ast import sys filename = sys.argv[1] print(f'Checking {filename}...') tree = ast.parse(open(filename, 'r').read()) for node in ast.walk(tree): if not isinstance(node, ast.ClassDef): continue func_names = [] for child in ast.iter_child_nodes(node): if isinstance(child, ast.FunctionDef): func_names.append(child.name) seen_func_names = set() duplicate_func_names = [] for name in func_names: if name in seen_func_names: duplicate_func_names.append(name) else: seen_func_names.add(name) if len(duplicate_func_names) != 0: print(f'Multiple func names found:\n\t{duplicate_func_names}\n\tclass {node.name}\n\tfile: {filename}') ``` This patch fixes these cases.