Skip to content

Commit a4c1813

Browse files
authored
[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.
1 parent 6cb45ae commit a4c1813

File tree

10 files changed

+8
-53
lines changed

10 files changed

+8
-53
lines changed

lldb/test/API/commands/log/invalid-args/TestInvalidArgsLog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_disable_empty(self):
2525
)
2626

2727
@no_debug_info_test
28-
def test_enable_empty(self):
28+
def test_enable_invalid_path(self):
2929
invalid_path = os.path.join("this", "is", "not", "a", "valid", "path")
3030
self.expect(
3131
"log enable lldb all -f " + invalid_path,

lldb/test/API/commands/thread/backtrace/TestThreadBacktraceRepeat.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ def test_thread_backtrace_one_thread(self):
1616
"""Run a simplified version of the test that just hits one breakpoint and
1717
doesn't care about synchronizing the two threads - hopefully this will
1818
run on more systems."""
19-
20-
def test_thread_backtrace_one_thread(self):
2119
self.build()
2220
(
2321
self.inferior_target,

lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,43 +31,6 @@ def testStartMultipleLiveThreads(self):
3131

3232
self.traceStopProcess()
3333

34-
@skipIf(oslist=no_match(["linux"]), archs=no_match(["i386", "x86_64"]))
35-
@testSBAPIAndCommands
36-
def testStartMultipleLiveThreadsWithStops(self):
37-
self.build()
38-
exe = self.getBuildArtifact("a.out")
39-
40-
self.dbg.CreateTarget(exe)
41-
42-
self.expect("b main")
43-
self.expect("b 6")
44-
self.expect("b 11")
45-
46-
self.expect("r")
47-
self.traceStartProcess()
48-
49-
# We'll see here the first thread
50-
self.expect("continue")
51-
52-
# We are in thread 2
53-
self.expect("thread trace dump instructions", substrs=["main.cpp:9"])
54-
self.expect("thread trace dump instructions 2", substrs=["main.cpp:9"])
55-
56-
# We stop tracing it
57-
self.expect("thread trace stop 2")
58-
59-
# The trace is still in memory
60-
self.expect("thread trace dump instructions 2", substrs=["main.cpp:9"])
61-
62-
# We'll stop at the next breakpoint, thread 2 will be still alive, but not traced. Thread 3 will be traced
63-
self.expect("continue")
64-
self.expect("thread trace dump instructions", substrs=["main.cpp:4"])
65-
self.expect("thread trace dump instructions 3", substrs=["main.cpp:4"])
66-
67-
self.expect("thread trace dump instructions 2", substrs=["not traced"])
68-
69-
self.traceStopProcess()
70-
7134
@skipIf(oslist=no_match(["linux"]), archs=no_match(["i386", "x86_64"]))
7235
@testSBAPIAndCommands
7336
def testStartMultipleLiveThreadsWithStops(self):

lldb/test/API/functionalities/completion/TestCompletion.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,6 @@ def test_disassemble_dash_f(self):
196196
def test_plugin_load(self):
197197
self.complete_from_to("plugin load ", [])
198198

199-
def test_log_enable(self):
200-
self.complete_from_to("log enable ll", ["lldb"])
201-
self.complete_from_to("log enable dw", ["dwarf"])
202-
self.complete_from_to("log enable lldb al", ["all"])
203-
self.complete_from_to("log enable lldb sym", ["symbol"])
204-
205199
def test_log_enable(self):
206200
self.complete_from_to("log disable ll", ["lldb"])
207201
self.complete_from_to("log disable dw", ["dwarf"])

lldb/test/API/functionalities/gdb_remote_client/TestIOSSimulator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_tvos_sim(self):
7979
)
8080

8181
@skipIfRemote
82-
def test_tvos_sim(self):
82+
def test_watchos_sim(self):
8383
self.platform_test(
8484
host="macosx",
8585
process="watchossimulator",

lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_python_os_plugin(self):
1717
self.build()
1818
self.run_python_os_funcionality()
1919

20-
def run_python_os_step(self):
20+
def test_run_python_os_step(self):
2121
"""Test that the Python operating system plugin works correctly when single stepping a virtual thread"""
2222
self.build()
2323
self.run_python_os_step()

lldb/test/API/lang/cpp/diamond/TestCppDiamond.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test(self):
109109

110110
@expectedFailureAll
111111
@no_debug_info_test
112-
def test(self):
112+
def test_invalid_member(self):
113113
self.build()
114114
lldbutil.run_to_source_breakpoint(
115115
self, "// breakpoint 1", lldb.SBFileSpec("main.cpp")

lldb/test/API/lang/objcxx/cxx-bridged-po/TestObjCXXBridgedPO.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class TestObjCXXBridgedPO(TestBase):
88
@skipIfDarwinEmbedded
99
@skipIf(macos_version=[">=", "13.0"])
10-
def test_bridged_type_po(self):
10+
def test_bridged_type_po_old(self):
1111
self.build()
1212
lldbutil.run_to_source_breakpoint(
1313
self, "break here", lldb.SBFileSpec("main.mm")

lldb/test/API/lang/rust/enum-structs/TestRustEnumStructs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def test_niche_layout_with_fields_3_a(self):
287287
(137, 1),
288288
)
289289

290-
def test_niche_layout_with_fields_3_a(self):
290+
def test_niche_layout_with_fields_3_c(self):
291291
# static NICHE_W_FIELDS_3_C: NicheLayoutWithFields3 = NicheLayoutWithFields3::C(false);
292292
value = self.getFromGlobal("NICHE_W_FIELDS_3_C").getCurrentValue()
293293
self.assertEqual(

lldb/test/API/test_utils/TestDecorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_add_test_categories(self):
2929
self.assertIsNone(self.getDebugInfo())
3030

3131
@expectedFailureAll
32-
def test_xfail_regexp(self):
32+
def test_xfail_empty(self):
3333
"""Test that expectedFailureAll can be empty (but please just use expectedFailure)"""
3434
self.fail()
3535

@@ -92,7 +92,7 @@ def test_decorator_skip2(self):
9292
# self.assertNotEqual(self.getDebugInfo(), "dwarf")
9393

9494
@expectedFailureAll
95-
def test_xfail_regexp(self):
95+
def test_xfail_empty(self):
9696
"""Test that xfail can be empty"""
9797
self.fail()
9898

0 commit comments

Comments
 (0)