https://github.com/charles-zablit updated https://github.com/llvm/llvm-project/pull/213462
>From c6285265aa60d18716e0f8eb42bb2c39f6856867 Mon Sep 17 00:00:00 2001 From: Charles Zablit <[email protected]> Date: Sat, 1 Aug 2026 18:10:31 +0200 Subject: [PATCH] [lldb-dap] Convert test to use the require decorator --- .../API/tools/lldb-dap/attach/TestDAP_attach.py | 4 ++-- .../API/tools/lldb-dap/console/TestDAP_console.py | 15 +++++++++------ .../databreakpoint/TestDAP_setDataBreakpoints.py | 8 +++++--- .../lldb-dap/disconnect/TestDAP_disconnect.py | 2 +- .../tools/lldb-dap/exception/TestDAP_exception.py | 4 ++-- .../exception/objc/TestDAP_exception_objc.py | 6 +++--- .../TestDAP_extendedStackTrace.py | 4 ++-- .../launch/TestDAP_launch_win_debug_heap.py | 4 ++-- .../lldb-dap/longpath/TestDAP_launch_longPath.py | 4 ++-- .../API/tools/lldb-dap/module/TestDAP_module.py | 6 +++--- .../API/tools/lldb-dap/server/TestDAP_server.py | 2 +- .../tools/lldb-dap/variables/TestDAP_variables.py | 6 +++--- 12 files changed, 35 insertions(+), 30 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py index 96c5b193df39f..f2a7e4819e644 100644 --- a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py +++ b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py @@ -10,8 +10,8 @@ from lldbsuite.test.decorators import ( expectedFailureWindows, expectedFailureWindowsAndNoLLDBServer, + requireNotWasm, skipIf, - skipIfWasm, skipIfWindowsAndLLDBServer, ) from lldbsuite.test.tools.lldb_dap import DAPTestCaseBase @@ -25,7 +25,7 @@ # Often fails on Arm Linux, but not specifically because it's Arm, something in # process scheduling can cause a massive (minutes) delay during this test. @skipIf(oslist=["linux"], archs=["arm$"]) -@skipIfWasm # No attach support +@requireNotWasm # No attach support class TestDAP_attach(DAPTestCaseBase): SHARED_BUILD_TESTCASE = False diff --git a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py index de175b4b5134a..7ef4050a4e908 100644 --- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py +++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py @@ -6,15 +6,18 @@ import os import unittest -from lldbsuite.test.decorators import skipIfWasm, skipIfWindows +from lldbsuite.test.decorators import requireNotWindows, requireNotWasm from lldbsuite.test.lldbtest import line_number from lldbsuite.test.tools.lldb_dap.types import LaunchArgs from lldbsuite.test.tools.lldb_dap import DAPTestCaseBase, DAPTestSession +from lldbsuite.test.skip_reason import UnsupportedReason -skipUnlessPsutil = unittest.skipUnless( +requirePsutil = unittest.skipUnless( importlib.util.find_spec("psutil") is not None, - "psutil not installed, please install using 'pip install psutil'.", + UnsupportedReason( + "psutil not installed, please install using 'pip install psutil'." + ), ) @@ -113,9 +116,9 @@ def test_custom_escape_prefix(self): def test_empty_escape_prefix(self): self.do_test_with_escape_prefix("") - @skipIfWindows - @skipUnlessPsutil - @skipIfWasm # the test signals the debug server, which for Wasm is the runtime + @requireNotWindows + @requirePsutil + @requireNotWasm # the test signals the debug server, which for Wasm is the runtime def test_exit_status_message_sigterm(self): import psutil diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py index 225a947674351..0142f8abf36c1 100644 --- a/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py +++ b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py @@ -2,15 +2,17 @@ Test lldb-dap dataBreakpointInfo and setDataBreakpoints requests """ -from lldbsuite.test.decorators import skipIfWasm, skipIfWindows +from lldbsuite.test.decorators import requireNotWasm, skipIfWindows from lldbsuite.test.lldbtest import line_number from lldbsuite.test.tools.lldb_dap import DAPTestCaseBase from lldbsuite.test.tools.lldb_dap.types import DataBreakpoint, LaunchArgs -@skipIfWasm # data breakpoints map to watchpoints. +@requireNotWasm # data breakpoints map to watchpoints class TestDAP_setDataBreakpoints(DAPTestCaseBase): - ACCESS_TYPES = ["read", "write", "readWrite"] + def setUp(self): + DAPTestCaseBase.setUp(self) + self.accessTypes = ["read", "write", "readWrite"] @skipIfWindows def test_duplicate_start_addresses(self): diff --git a/lldb/test/API/tools/lldb-dap/disconnect/TestDAP_disconnect.py b/lldb/test/API/tools/lldb-dap/disconnect/TestDAP_disconnect.py index 972c0fa46df06..537d4e399b06c 100644 --- a/lldb/test/API/tools/lldb-dap/disconnect/TestDAP_disconnect.py +++ b/lldb/test/API/tools/lldb-dap/disconnect/TestDAP_disconnect.py @@ -11,7 +11,7 @@ import os -@skipIfWasm # no attach support +@requireNotWasm # no attach support class TestDAP_disconnect(lldbdap_testcase.DAPTestCaseBase): SHARED_BUILD_TESTCASE = False diff --git a/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py b/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py index 23e8763cf8d81..9170118e2f309 100644 --- a/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py +++ b/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py @@ -3,11 +3,11 @@ """ from lldbsuite.test.tools.lldb_dap import DAPTestCaseBase -from lldbsuite.test.decorators import skipIfNoSignals +from lldbsuite.test.decorators import requireSignals from lldbsuite.test.tools.lldb_dap.types import LaunchArgs -@skipIfNoSignals +@requireSignals class TestDAP_exception(DAPTestCaseBase): def test_stopped_description(self): """ diff --git a/lldb/test/API/tools/lldb-dap/exception/objc/TestDAP_exception_objc.py b/lldb/test/API/tools/lldb-dap/exception/objc/TestDAP_exception_objc.py index 5d56744dc77fe..5fd50882b0978 100644 --- a/lldb/test/API/tools/lldb-dap/exception/objc/TestDAP_exception_objc.py +++ b/lldb/test/API/tools/lldb-dap/exception/objc/TestDAP_exception_objc.py @@ -2,13 +2,13 @@ Test exception behavior in DAP with obj-c throw. """ -from lldbsuite.test.decorators import skipUnlessDarwin +from lldbsuite.test.decorators import requireDarwin from lldbsuite.test.tools.lldb_dap.types import ExceptionFilterOptions, LaunchArgs from lldbsuite.test.tools.lldb_dap import DAPTestCaseBase class TestDAP_exception_objc(DAPTestCaseBase): - @skipUnlessDarwin + @requireDarwin def test_stopped_description(self): """ Test that exception description is shown correctly in stopped event. @@ -34,7 +34,7 @@ def test_stopped_description(self): stack_trace = self.expect_not_none(exception_details.stackTrace) self.assertRegex(stack_trace, "main.m") - @skipUnlessDarwin + @requireDarwin def test_break_on_throw_and_catch(self): """ Test that breakpoints on exceptions work as expected. diff --git a/lldb/test/API/tools/lldb-dap/extendedStackTrace/TestDAP_extendedStackTrace.py b/lldb/test/API/tools/lldb-dap/extendedStackTrace/TestDAP_extendedStackTrace.py index 3ee3e203c2767..67ed029d4d018 100644 --- a/lldb/test/API/tools/lldb-dap/extendedStackTrace/TestDAP_extendedStackTrace.py +++ b/lldb/test/API/tools/lldb-dap/extendedStackTrace/TestDAP_extendedStackTrace.py @@ -42,7 +42,7 @@ def build_and_run_to_breakpoint(self, display_extended_backtrace: bool = True): stop_event = session.verify_stopped_on_breakpoint(bp_id, after=cm.process_event) return session, stop_event - @skipUnlessDarwin + @requireDarwin def test_stackTrace(self): """Tests the 'stackTrace' packet on a thread with an extended backtrace.""" session, stop_event = self.build_and_run_to_breakpoint() @@ -104,7 +104,7 @@ def test_stackTrace(self): total_frames, i, "total frames should include a pagination offset" ) - @skipUnlessDarwin + @requireDarwin def test_stackTraceWithFormat(self): """Tests the 'stackTrace' packet using stack trace formats.""" session, stop_event = self.build_and_run_to_breakpoint( diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_win_debug_heap.py b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_win_debug_heap.py index 5bd2dc10f6590..e6298b66b57aa 100644 --- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_win_debug_heap.py +++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_win_debug_heap.py @@ -2,14 +2,14 @@ Test lldb-dap launch request. """ -from lldbsuite.test.decorators import skipUnlessWindows, skipIfBuildType +from lldbsuite.test.decorators import requireWindows, skipIfBuildType from lldbsuite.test.tools.lldb_dap.types import LaunchArgs, Console from lldbsuite.test.tools.lldb_dap import DAPTestCaseBase from typing import List @skipIfBuildType(["debug"]) -@skipUnlessWindows +@requireWindows class TestDAP_launch_win_debug_heap(DAPTestCaseBase): """ Test that lldb-dap respects the debug heap setting on Windows when launching in an integrated terminal. diff --git a/lldb/test/API/tools/lldb-dap/longpath/TestDAP_launch_longPath.py b/lldb/test/API/tools/lldb-dap/longpath/TestDAP_launch_longPath.py index 94221a99653cc..0e74d479be9df 100644 --- a/lldb/test/API/tools/lldb-dap/longpath/TestDAP_launch_longPath.py +++ b/lldb/test/API/tools/lldb-dap/longpath/TestDAP_launch_longPath.py @@ -7,14 +7,14 @@ import shutil from lldbsuite.test import lldbutil -from lldbsuite.test.decorators import skipUnlessWindows +from lldbsuite.test.decorators import requireWindows from lldbsuite.test.tools.lldb_dap import DAPTestCaseBase from lldbsuite.test.tools.lldb_dap.types import ExitedEvent, LaunchArgs, TerminatedEvent MAX_PATH = 260 -@skipUnlessWindows +@requireWindows class TestDAP_launch_longPath(DAPTestCaseBase): def _long_path(self, path): return lldbutil.get_extended_windows_path(path) diff --git a/lldb/test/API/tools/lldb-dap/module/TestDAP_module.py b/lldb/test/API/tools/lldb-dap/module/TestDAP_module.py index fc9d1f2f9a20d..7bc90e36349dd 100644 --- a/lldb/test/API/tools/lldb-dap/module/TestDAP_module.py +++ b/lldb/test/API/tools/lldb-dap/module/TestDAP_module.py @@ -6,9 +6,9 @@ import re from lldbsuite.test.decorators import ( - skipIfTargetDoesNotSupportSharedLibraries, + requireDarwin, skipIfWindows, - skipUnlessDarwin, + skipIfTargetDoesNotSupportSharedLibraries, ) from lldbsuite.test.lldbtest import line_number from lldbsuite.test.tools.lldb_dap.types import ( @@ -112,7 +112,7 @@ def test_modules(self): "a.out", expect_debug_info_size=platform.system() != "Darwin" ) - @skipUnlessDarwin + @requireDarwin def test_modules_dsym(self): """ Darwin only test with dSYM file. diff --git a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py index 1debd6c3d07f8..cf9b0c47744e8 100644 --- a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py +++ b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py @@ -76,7 +76,7 @@ def test_server_port(self): self.run_debug_session(connection, "Alice") self.run_debug_session(connection, "Bob") - @skipIfWindows + @requirePOSIX def test_server_unix_socket(self): """ Test launching a binary with a lldb-dap in server mode on a unix socket. diff --git a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py index 1615939b02364..294b1d1560345 100644 --- a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py +++ b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py @@ -8,9 +8,9 @@ from lldbsuite.test import lldbplatformutil from lldbsuite.test.decorators import ( no_debug_info_test, + requireDarwin, skipIfAsan, skipIfWindows, - skipUnlessDarwin, ) from lldbsuite.test.lldbtest import line_number from lldbsuite.test.tools.lldb_dap.types import ( @@ -724,7 +724,7 @@ def test_registers(self): self.assertIn("at main.cpp:", pc_reg.value) @no_debug_info_test - @skipUnlessDarwin + @requireDarwin def test_darwin_dwarf_missing_obj(self): """ Test that if we build a binary with DWARF in .o files and we remove @@ -738,7 +738,7 @@ def test_darwin_dwarf_missing_obj(self): self.darwin_dwarf_missing_obj(None) @no_debug_info_test - @skipUnlessDarwin + @requireDarwin def test_darwin_dwarf_missing_obj_with_symbol_ondemand_enabled(self): """ Test that if we build a binary with DWARF in .o files and we remove _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
