diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -140,8 +140,10 @@ def skipTestIfFn(expected_fn, bugnumber=None): def skipTestIfFn_impl(func): if isinstance(func, type) and issubclass(func, unittest2.TestCase): - raise Exception( - "@skipTestIfFn can only be used to decorate a test method") + reason = expected_fn() + # The return value is the reason (or None if we don't skip), so + # reason is used for both args. + return unittest2.skipIf(condition=reason, reason=reason)(func) @wraps(func) def wrapper(*args, **kwargs): diff --git a/lldb/test/API/api/check_public_api_headers/TestPublicAPIHeaders.py b/lldb/test/API/api/check_public_api_headers/TestPublicAPIHeaders.py --- a/lldb/test/API/api/check_public_api_headers/TestPublicAPIHeaders.py +++ b/lldb/test/API/api/check_public_api_headers/TestPublicAPIHeaders.py @@ -8,6 +8,7 @@ from lldbsuite.test import lldbutil +@skipIfNoSBHeaders class SBDirCheckerCase(TestBase): NO_DEBUG_INFO_TESTCASE = True @@ -16,7 +17,6 @@ self.source = 'main.cpp' self.generateSource(self.source) - @skipIfNoSBHeaders def test_sb_api_directory(self): """Test the SB API directory and make sure there's no unwanted stuff.""" diff --git a/lldb/test/API/api/multithreaded/TestMultithreaded.py b/lldb/test/API/api/multithreaded/TestMultithreaded.py --- a/lldb/test/API/api/multithreaded/TestMultithreaded.py +++ b/lldb/test/API/api/multithreaded/TestMultithreaded.py @@ -9,6 +9,7 @@ from lldbsuite.test import lldbutil +@skipIfNoSBHeaders class SBBreakpointCallbackCase(TestBase): NO_DEBUG_INFO_TESTCASE = True @@ -25,7 +26,6 @@ self.generateSource('test_stop-hook.cpp') @skipIfRemote - @skipIfNoSBHeaders # clang-cl does not support throw or catch (llvm.org/pr24538) @skipIfWindows def test_python_stop_hook(self): @@ -34,7 +34,6 @@ 'test_python_stop_hook') @skipIfRemote - @skipIfNoSBHeaders # clang-cl does not support throw or catch (llvm.org/pr24538) @skipIfWindows def test_breakpoint_callback(self): @@ -43,7 +42,6 @@ 'test_breakpoint_callback') @skipIfRemote - @skipIfNoSBHeaders # clang-cl does not support throw or catch (llvm.org/pr24538) @skipIfWindows def test_breakpoint_location_callback(self): @@ -52,7 +50,6 @@ 'test_breakpoint_location_callback') @skipIfRemote - @skipIfNoSBHeaders # clang-cl does not support throw or catch (llvm.org/pr24538) @skipIfWindows @expectedFlakeyFreeBSD @@ -63,7 +60,6 @@ 'test_listener_event_description') @skipIfRemote - @skipIfNoSBHeaders # clang-cl does not support throw or catch (llvm.org/pr24538) @skipIfWindows @expectedFlakeyFreeBSD @@ -76,7 +72,6 @@ 'test_listener_event_process_state') @skipIfRemote - @skipIfNoSBHeaders # clang-cl does not support throw or catch (llvm.org/pr24538) @skipIfWindows @expectedFlakeyFreeBSD diff --git a/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py b/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py --- a/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py +++ b/lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py @@ -12,7 +12,6 @@ def setUp(self): TestBase.setUp(self) - self.generateSource('plugin.cpp') @skipIfNoSBHeaders # Requires a compatible arch and platform to link against the host's built @@ -22,6 +21,7 @@ @no_debug_info_test def test_load_plugin(self): """Test that plugins that load commands work correctly.""" + self.generateSource('plugin.cpp') plugin_name = "plugin" if sys.platform.startswith("darwin"):