https://github.com/da-viper updated https://github.com/llvm/llvm-project/pull/214701
>From 53dd0b551ce46892169ee1646249e36ba014a121 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike <[email protected]> Date: Fri, 7 Aug 2026 11:39:31 +0100 Subject: [PATCH 1/2] [lldb] Add a reason for all requireNot* decorators. Previously, tests using the @requireNot* decorators documented by the test was skipped using a trailing comment that never made it into the test report. Change the decorator to take a required `reason` parameter. as the test should have a reason why it is not required. --- .../Python/lldbsuite/test/decorators.py | 32 +++++++++++-------- .../API/driver/batch_mode/TestBatchMode.py | 2 +- lldb/test/API/macosx/mte/TestDarwinMTE.py | 2 +- .../TestExprPathRegisters.py | 2 +- .../TestGlobalModuleCache.py | 2 +- .../python_api/hello_world/TestHelloWorld.py | 4 +-- .../process/address-masks/TestAddressMasks.py | 2 +- .../read-mem-cstring/TestReadMemCString.py | 2 +- .../sbenvironment/TestSBEnvironment.py | 2 +- .../python_api/sbplatform/TestSBPlatform.py | 2 +- lldb/test/API/qemu/TestQemuLaunch.py | 2 +- .../lldb-server/TestGdbRemoteAuxvSupport.py | 10 +++--- .../tools/lldb-server/TestLldbGdbServer.py | 2 +- .../test/API/tools/lldb-server/TestNonStop.py | 2 +- .../inferior-crash/TestGdbRemoteAbort.py | 2 +- .../inferior-crash/TestGdbRemoteSegFault.py | 2 +- .../TestGdbRemote_QPassSignals.py | 2 +- .../lldb-server/vCont-threads/TestSignal.py | 16 +++++----- 18 files changed, 47 insertions(+), 43 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index 6524d73e4a349..51e065b2e855f 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -5,6 +5,7 @@ from collections.abc import Callable from functools import wraps +from typing import Optional from packaging import version import contextlib import ctypes @@ -1153,16 +1154,19 @@ def requirePlatform(oslist): ) -def requireNotPlatform(oslist): +def requireNotPlatform(oslist: list[str], reason: Optional[str] = None): """Mark the item as inherently inapplicable to the listed target platforms. Unlike `skipIfPlatform`, the listed platforms are reported as UNSUPPORTED rather than SKIPPED. """ - return unittest.skipIf( - lldbplatformutil.getPlatform() in oslist, - UnsupportedReason("unsupported on %s" % (", ".join(oslist))), - ) + assert isinstance( + reason, (str, type(None)) + ), f"expects 'str' or 'None' got {type(reason).__name__!r}" + + skip_reason = reason or UnsupportedReason(f"unsupported on {', '.join(oslist)}") + + return unittest.skipIf(lldbplatformutil.getPlatform() in oslist, skip_reason) def requireDarwin(func): @@ -1171,9 +1175,9 @@ def requireDarwin(func): return requirePlatform(lldbplatform.translate(lldbplatform.darwin_all))(func) -def requireNotDarwin(func): +def requireNotDarwin(reason: str): """Mark the item as inherently inapplicable to Darwin targets.""" - return requireNotPlatform(lldbplatform.translate(lldbplatform.darwin_all))(func) + return requireNotPlatform(lldbplatform.translate(lldbplatform.darwin_all), reason=reason) def requireLinux(func): @@ -1182,9 +1186,9 @@ def requireLinux(func): return requirePlatform(["linux"])(func) -def requireNotLinux(func): +def requireNotLinux(reason: str): """Mark the item as inherently inapplicable to Linux targets.""" - return requireNotPlatform(["linux"])(func) + return requireNotPlatform(["linux"], reason=reason) def requireWindows(func): @@ -1193,13 +1197,13 @@ def requireWindows(func): return requirePlatform(["windows"])(func) -def requireNotWindows(func): +def requireNotWindows(reason: str): """Mark the item as inherently inapplicable to Windows targets. Use this for tests built on POSIX-only concepts: fork/exec semantics, POSIX signals, ptrace, ELF/Mach-O specifics, shell pipelines, and so on. """ - return requireNotPlatform(["windows"])(func) + return requireNotPlatform(["windows"], reason=reason) def requirePOSIX(func): @@ -1209,7 +1213,7 @@ def requirePOSIX(func): dependency is POSIX semantics generally rather than anything about Windows specifically. """ - return requireNotPlatform(["windows"])(func) + return requireNotPlatform(["windows"], reason="uses the posix API.")(func) def requireSignals(func): @@ -1217,14 +1221,14 @@ def requireSignals(func): return requireNotPlatform(["windows", "wasip1", "wasi"])(func) -def requireNotWasm(func): +def requireNotWasm(reason: str): """Mark the item as inherently inapplicable to WebAssembly targets. WebAssembly has no processes, no signals, no shared libraries and no ptrace-style debugging, so a large amount of the test suite can never apply to it. """ - return requireNotPlatform(["wasip1", "wasi"])(func) + return requireNotPlatform(["wasip1", "wasi"], reason=reason) def requireHostPlatform(oslist): diff --git a/lldb/test/API/driver/batch_mode/TestBatchMode.py b/lldb/test/API/driver/batch_mode/TestBatchMode.py index 38b0871178395..f0998a7b56dbd 100644 --- a/lldb/test/API/driver/batch_mode/TestBatchMode.py +++ b/lldb/test/API/driver/batch_mode/TestBatchMode.py @@ -11,7 +11,7 @@ from lldbsuite.test.lldbpexpect import PExpectTest -@requireNotWasm # driver cannot launch a Wasm inferior +@requireNotWasm("driver cannot launch a Wasm inferior") class DriverBatchModeTest(PExpectTest): source = "main.c" diff --git a/lldb/test/API/macosx/mte/TestDarwinMTE.py b/lldb/test/API/macosx/mte/TestDarwinMTE.py index 812d563b88f5c..df627809385c8 100644 --- a/lldb/test/API/macosx/mte/TestDarwinMTE.py +++ b/lldb/test/API/macosx/mte/TestDarwinMTE.py @@ -11,7 +11,7 @@ exe_name = "uaf" # Must match Makefile -@requireNotWasm # memory tagging is a Darwin AArch64 feature +@requireNotWasm("memory tagging is a Darwin AArch64 feature") class TestDarwinMTE(TestBase): SHARED_BUILD_TESTCASE = False NO_DEBUG_INFO_TESTCASE = True diff --git a/lldb/test/API/python_api/exprpath_register/TestExprPathRegisters.py b/lldb/test/API/python_api/exprpath_register/TestExprPathRegisters.py index 8cb6851516b3f..aa06f701b560d 100644 --- a/lldb/test/API/python_api/exprpath_register/TestExprPathRegisters.py +++ b/lldb/test/API/python_api/exprpath_register/TestExprPathRegisters.py @@ -50,7 +50,7 @@ def test_float_registers(self): if reg_value: self.verify_register_path(reg_value) - @requireNotWasm # wasm exposes no registers + @requireNotWasm("wasm exposes no registers") def test_all_registers(self): """Test all the registers that is avaiable on the machine""" self.build() diff --git a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py index a39d6fe191315..10bf7a3d2821d 100644 --- a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py +++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py @@ -12,7 +12,7 @@ import time -@requireNotWasm # modules carry no build ID to cache on +@requireNotWasm("modules carry no build ID to cache on") class GlobalModuleCacheTestCase(TestBase): SHARED_BUILD_TESTCASE = False # NO_DEBUG_INFO_TESTCASE = True diff --git a/lldb/test/API/python_api/hello_world/TestHelloWorld.py b/lldb/test/API/python_api/hello_world/TestHelloWorld.py index 888f0d8a04b45..8935ec2fdd447 100644 --- a/lldb/test/API/python_api/hello_world/TestHelloWorld.py +++ b/lldb/test/API/python_api/hello_world/TestHelloWorld.py @@ -72,7 +72,7 @@ def test_with_process_launch_api(self): @expectedFailureAll(oslist=["windows"], archs=["aarch64"]) @skipIfiOSSimulator - @requireNotWasm # attaching requires launching the inferior as a host process + @requireNotWasm("attaching requires launching the inferior as a host process") def test_with_attach_to_process_with_id_api(self): """Create target, spawn a process, and attach to it with process id.""" exe = "%s_%d" % (self.testMethodName, os.getpid()) @@ -105,7 +105,7 @@ def test_with_attach_to_process_with_id_api(self): @expectedFailureAll(oslist=["windows"], archs=["aarch64"]) @skipIfiOSSimulator @skipIfAsan # FIXME: Hangs indefinitely. - @requireNotWasm # attaching requires launching the inferior as a host process + @requireNotWasm("attaching requires launching the inferior as a host process") def test_with_attach_to_process_with_name_api(self): """Create target, spawn a process, and attach to it with process name.""" exe = "%s_%d" % (self.testMethodName, os.getpid()) diff --git a/lldb/test/API/python_api/process/address-masks/TestAddressMasks.py b/lldb/test/API/python_api/process/address-masks/TestAddressMasks.py index 866972de5520d..83a2e294b0542 100644 --- a/lldb/test/API/python_api/process/address-masks/TestAddressMasks.py +++ b/lldb/test/API/python_api/process/address-masks/TestAddressMasks.py @@ -7,7 +7,7 @@ from lldbsuite.test import lldbutil -@requireNotWasm # no ABI plugin, so address masks are never applied +@requireNotWasm("no ABI plugin, so address masks are never applied") class AddressMasksTestCase(TestBase): NO_DEBUG_INFO_TESTCASE = True diff --git a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py index 0373c225a60e8..5f094b036b32c 100644 --- a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py +++ b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py @@ -11,7 +11,7 @@ class TestReadMemCString(TestBase): NO_DEBUG_INFO_TESTCASE = True - @requireNotWasm # linear memory has no unmapped pages, so a bad in-range pointer still reads + @requireNotWasm("linear memory has no unmapped pages, so a bad in-range pointer still reads") def test_read_memory_c_string(self): """Test corner case behavior of SBProcess::ReadCStringFromMemory""" self.build() diff --git a/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py b/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py index f78b7a681bd68..621abe2b8af1b 100644 --- a/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py +++ b/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py @@ -8,7 +8,7 @@ from lldbsuite.test import lldbutil -@requireNotWasm # no remote environment support +@requireNotWasm("no remote environment support") class SBEnvironmentAPICase(TestBase): NO_DEBUG_INFO_TESTCASE = True diff --git a/lldb/test/API/python_api/sbplatform/TestSBPlatform.py b/lldb/test/API/python_api/sbplatform/TestSBPlatform.py index 2a78f0106e18c..c98178b59dec0 100644 --- a/lldb/test/API/python_api/sbplatform/TestSBPlatform.py +++ b/lldb/test/API/python_api/sbplatform/TestSBPlatform.py @@ -10,7 +10,7 @@ from lldbsuite.test import lldbutil -@requireNotWasm # no remote platform file/process APIs +@requireNotWasm("no remote platform file/process APIs") class SBPlatformAPICase(TestBase): NO_DEBUG_INFO_TESTCASE = True diff --git a/lldb/test/API/qemu/TestQemuLaunch.py b/lldb/test/API/qemu/TestQemuLaunch.py index ecdb16afc2c12..0967f3c214cb6 100644 --- a/lldb/test/API/qemu/TestQemuLaunch.py +++ b/lldb/test/API/qemu/TestQemuLaunch.py @@ -14,7 +14,7 @@ @skipIfRemote @skipIfWindows @skipIf(archs=["arm64e"]) -@requireNotWasm # no qemu-wasm32 +@requireNotWasm("no qemu-wasm32") class TestQemuLaunch(TestBase): NO_DEBUG_INFO_TESTCASE = True diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py index 43eac3ed2fb93..e3981b214c95a 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py @@ -69,14 +69,14 @@ def get_raw_auxv_data(self): self.assertIsNotNone(content_raw) return (word_size, self.decode_gdbremote_binary(content_raw)) - @requireNotWindows # no auxv support. - @requireNotDarwin + @requireNotWindows("no auxv support.") + @requireNotDarwin("no auxv support.") def test_supports_auxv(self): self.build() self.set_inferior_startup_launch() self.assertTrue(self.has_auxv_support()) - @requireNotWindows + @requireNotWindows("no auxv support.") @expectedFailureNetBSD def test_auxv_data_is_correct_size(self): self.build() @@ -90,7 +90,7 @@ def test_auxv_data_is_correct_size(self): self.assertEqual(len(auxv_data) % (2 * word_size), 0) self.trace("auxv contains {} entries".format(len(auxv_data) / (2 * word_size))) - @requireNotWindows + @requireNotWindows("no auxv support.") @expectedFailureNetBSD def test_auxv_keys_look_valid(self): self.build() @@ -120,7 +120,7 @@ def test_auxv_keys_look_valid(self): self.assertGreaterEqual(auxv_key, 1) self.assertLessEqual(auxv_key, 2500) - @requireNotWindows + @requireNotWindows("no auxv support.") @expectedFailureNetBSD def test_auxv_chunked_reads_work(self): self.build() diff --git a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py index 3fe21cd9d53a9..921dff7f0a0a8 100644 --- a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py +++ b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py @@ -479,7 +479,7 @@ def Hc_then_Csignal_signals_correct_thread(self, segfault_signo): self.assertEqual(post_handle_thread_id, print_thread_id) @expectedFailureDarwin - @requireNotWindows # no SIGSEGV support + @requireSignals @expectedFailureNetBSD def test_Hc_then_Csignal_signals_correct_thread_launch(self): self.build() diff --git a/lldb/test/API/tools/lldb-server/TestNonStop.py b/lldb/test/API/tools/lldb-server/TestNonStop.py index 71314195ac7f6..6f7dbd11982d7 100644 --- a/lldb/test/API/tools/lldb-server/TestNonStop.py +++ b/lldb/test/API/tools/lldb-server/TestNonStop.py @@ -5,7 +5,7 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase): - @requireNotWindows # no SIGSEGV support + @requireSignals @add_test_categories(["llgs"]) def test_run(self): self.build() diff --git a/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py b/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py index 9997365f6d738..834da35b9da4e 100644 --- a/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py +++ b/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py @@ -5,7 +5,7 @@ class TestGdbRemoteAbort(gdbremote_testcase.GdbRemoteTestCaseBase): - @requireNotWindows # No signal is sent on Windows. + @requireSignals # std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836 @expectedFailureAndroid(api_levels=list(range(16 + 1))) def test_inferior_abort_received_llgs(self): diff --git a/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py b/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py index be157c6f81e53..bf66e2128f3c0 100644 --- a/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py +++ b/lldb/test/API/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py @@ -30,7 +30,7 @@ def inferior_seg_fault_received(self, expected_signo): self.assertIsNotNone(hex_exit_code) self.assertEqual(int(hex_exit_code, 16), expected_signo) - @requireNotWindows # No signal is sent on Windows. + @requireSignals def test_inferior_seg_fault_received(self): self.build() if self.platformIsDarwin(): diff --git a/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py b/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py index f1016a035cf43..2a2ee8d186a04 100644 --- a/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py +++ b/lldb/test/API/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py @@ -87,7 +87,7 @@ def test_change_signals_at_runtime(self): self.ignore_signals(signals_to_ignore) self.expect_exit_code(len(signals_to_ignore)) - @requireNotWindows # no signal support + @requireSignals @expectedFailureNetBSD def test_default_signals_behavior(self): self.build() diff --git a/lldb/test/API/tools/lldb-server/vCont-threads/TestSignal.py b/lldb/test/API/tools/lldb-server/vCont-threads/TestSignal.py index 667411c58a61e..c39efaad4a42f 100644 --- a/lldb/test/API/tools/lldb-server/vCont-threads/TestSignal.py +++ b/lldb/test/API/tools/lldb-server/vCont-threads/TestSignal.py @@ -54,7 +54,7 @@ def get_pid(self): procinfo = self.parse_process_info_response(context) return int(procinfo["pid"], 16) - @requireNotWindows + @requireSignals @skipIfDarwin @expectedFailureNetBSD @expectedFailureAll( @@ -85,7 +85,7 @@ def test_signal_one_thread(self): "C{0:x}:{1:x};c".format(lldbutil.get_signal_number("SIGUSR1")), threads[:1] ) - @requireNotWindows + @requireSignals @skipIfDarwin @expectedFailureNetBSD @expectedFailureAll( @@ -106,7 +106,7 @@ def test_signal_all_threads(self): threads, ) - @requireNotWindows + @requireSignals @expectedFailureNetBSD @expectedFailureAll( oslist=["freebsd"], bugnumber="github.com/llvm/llvm-project/issues/56086" @@ -126,7 +126,7 @@ def test_signal_process_by_pid(self): threads, ) - @requireNotWindows + @requireSignals @expectedFailureNetBSD @expectedFailureAll( oslist=["freebsd"], bugnumber="github.com/llvm/llvm-project/issues/56086" @@ -143,7 +143,7 @@ def test_signal_process_minus_one(self): "C{0:x}:p-1".format(lldbutil.get_signal_number("SIGUSR1")), threads ) - @requireNotWindows + @requireSignals @expectedFailureNetBSD @expectedFailureAll( oslist=["freebsd"], bugnumber="github.com/llvm/llvm-project/issues/56086" @@ -159,7 +159,7 @@ def test_signal_minus_one(self): "C{0:x}:-1".format(lldbutil.get_signal_number("SIGUSR1")), threads ) - @requireNotWindows + @requireSignals @expectedFailureNetBSD @expectedFailureAll( oslist=["freebsd"], bugnumber="github.com/llvm/llvm-project/issues/56086" @@ -180,7 +180,7 @@ def test_signal_all_threads_by_pid(self): threads, ) - @requireNotWindows + @requireSignals @expectedFailureNetBSD @expectedFailureAll( oslist=["freebsd"], bugnumber="github.com/llvm/llvm-project/issues/56086" @@ -200,7 +200,7 @@ def test_signal_minus_one_by_pid(self): threads, ) - @requireNotWindows + @requireSignals @expectedFailureNetBSD @expectedFailureAll( oslist=["freebsd"], bugnumber="github.com/llvm/llvm-project/issues/56086" >From 7a551c17c3b04313ecf482aed4625ccc22f0c5e0 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike <[email protected]> Date: Fri, 7 Aug 2026 12:19:22 +0100 Subject: [PATCH 2/2] fix format --- lldb/packages/Python/lldbsuite/test/decorators.py | 6 ++++-- .../process/read-mem-cstring/TestReadMemCString.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index 51e065b2e855f..d20a3e381e46e 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -1154,7 +1154,7 @@ def requirePlatform(oslist): ) -def requireNotPlatform(oslist: list[str], reason: Optional[str] = None): +def requireNotPlatform(oslist: list, reason: Optional[str] = None): """Mark the item as inherently inapplicable to the listed target platforms. Unlike `skipIfPlatform`, the listed platforms are reported as UNSUPPORTED @@ -1177,7 +1177,9 @@ def requireDarwin(func): def requireNotDarwin(reason: str): """Mark the item as inherently inapplicable to Darwin targets.""" - return requireNotPlatform(lldbplatform.translate(lldbplatform.darwin_all), reason=reason) + return requireNotPlatform( + lldbplatform.translate(lldbplatform.darwin_all), reason=reason + ) def requireLinux(func): diff --git a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py index 5f094b036b32c..27465d3791dd8 100644 --- a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py +++ b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py @@ -11,7 +11,9 @@ class TestReadMemCString(TestBase): NO_DEBUG_INFO_TESTCASE = True - @requireNotWasm("linear memory has no unmapped pages, so a bad in-range pointer still reads") + @requireNotWasm( + "linear memory has no unmapped pages, so a bad in-range pointer still reads" + ) def test_read_memory_c_string(self): """Test corner case behavior of SBProcess::ReadCStringFromMemory""" self.build() _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
