[all-commits] [llvm/llvm-project] a4c181: [lldb][test] Remove duplicate testcase names in AP...
Michael Buch via All-commits
all-commits at lists.llvm.org
Fri Jun 28 12:09:16 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a4c18137d84bc48df49ee0101bef465a955e62ac
https://github.com/llvm/llvm-project/commit/a4c18137d84bc48df49ee0101bef465a955e62ac
Author: Michael Buch <michaelbuch12 at gmail.com>
Date: 2024-06-28 (Fri, 28 Jun 2024)
Changed paths:
M lldb/test/API/commands/log/invalid-args/TestInvalidArgsLog.py
M lldb/test/API/commands/thread/backtrace/TestThreadBacktraceRepeat.py
M lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py
M lldb/test/API/functionalities/completion/TestCompletion.py
M lldb/test/API/functionalities/gdb_remote_client/TestIOSSimulator.py
M lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
M lldb/test/API/lang/cpp/diamond/TestCppDiamond.py
M lldb/test/API/lang/objcxx/cxx-bridged-po/TestObjCXXBridgedPO.py
M lldb/test/API/lang/rust/enum-structs/TestRustEnumStructs.py
M lldb/test/API/test_utils/TestDecorators.py
Log Message:
-----------
[lldb][test] Remove duplicate testcase names in API test-suite (#97043)
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.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list