rupprecht created this revision. Herald added a project: All. rupprecht requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
Some test cases are already marked @skipIfNoSBHeaders, but they make use of SBAPI headers in test setup. The setup will fail if the headers are missing, so it is too late to wait until the test case to apply the skip annotation. In addition to allowing this to apply to entire classes, I also changed all the existing annotations from test cases to test classes where necessary/appropriate. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D138181 Files: lldb/packages/Python/lldbsuite/test/decorators.py lldb/test/API/api/check_public_api_headers/TestPublicAPIHeaders.py lldb/test/API/api/multithreaded/TestMultithreaded.py lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py
Index: lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py =================================================================== --- lldb/test/API/functionalities/plugins/command_plugin/TestPluginCommands.py +++ 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"): Index: lldb/test/API/api/multithreaded/TestMultithreaded.py =================================================================== --- lldb/test/API/api/multithreaded/TestMultithreaded.py +++ 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 Index: lldb/test/API/api/check_public_api_headers/TestPublicAPIHeaders.py =================================================================== --- lldb/test/API/api/check_public_api_headers/TestPublicAPIHeaders.py +++ 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.""" Index: lldb/packages/Python/lldbsuite/test/decorators.py =================================================================== --- lldb/packages/Python/lldbsuite/test/decorators.py +++ 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(reason, reason)(func) @wraps(func) def wrapper(*args, **kwargs):
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits