From bd1dd3654c12e57146d271c2786d7c39ec3e51c6 Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Thu, 8 Oct 2020 12:23:30 +0200 Subject: [PATCH] [lldb][swift] Add missing swiftTest decorators The swiftTest decorator should be on all Swift tests to make sure they are only run in configurations where Swift is supported. Otherwise these tests are still run and will fail when the Swift plugin is disabled. --- lldb/packages/Python/lldbsuite/test/lldbplaygroundrepl.py | 1 + lldb/test/API/commands/help/TestHelp.py | 1 + .../functionalities/mtc/swift-property/TestMTCSwiftProperty.py | 1 + lldb/test/API/functionalities/mtc/swift/TestMTCSwift.py | 1 + lldb/test/API/lang/swift/availability/TestAvailability.py | 1 + lldb/test/API/lang/swift/completion/TestSwiftREPLCompletion.py | 2 ++ .../swift/delayed_parsing_crash/TestDelayedParsingCrash.py | 2 +- .../deserialization_failure/TestSwiftDeserializationFailure.py | 2 ++ lldb/test/API/lang/swift/enum_associated/TestEnumAssociated.py | 2 +- .../API/lang/swift/expression/errors/TestExpressionErrors.py | 1 + lldb/test/API/lang/swift/missing_sdk/TestMissingSDK.py | 1 + .../API/lang/swift/objc_runtime_ivars/TestObjCIvarDiscovery.py | 2 ++ .../API/lang/swift/private_import/TestSwiftPrivateImport.py | 1 + .../swift/protocol_extension_two/TestProtocolExtensionTwo.py | 2 +- lldb/test/API/repl/array/TestREPLArray.py | 3 ++- lldb/test/API/repl/cpp_exceptions/TestCPPExceptionsInREPL.py | 2 ++ 16 files changed, 21 insertions(+), 4 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbplaygroundrepl.py b/lldb/packages/Python/lldbsuite/test/lldbplaygroundrepl.py index b3238f5025a26..74ed2bd0c8ccb 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbplaygroundrepl.py +++ b/lldb/packages/Python/lldbsuite/test/lldbplaygroundrepl.py @@ -129,6 +129,7 @@ def did_crash(self, result): error = self.get_stream_data(result) print("Crash Error: {}".format(error)) + @swiftTest def test_playgrounds(self): # Build self.build_all() diff --git a/lldb/test/API/commands/help/TestHelp.py b/lldb/test/API/commands/help/TestHelp.py index c9dc39650d881..3147a2a47520b 100644 --- a/lldb/test/API/commands/help/TestHelp.py +++ b/lldb/test/API/commands/help/TestHelp.py @@ -81,6 +81,7 @@ def test_help_arch(self): substrs=['arm', 'i386', 'x86_64']) @no_debug_info_test + @swiftTest # Checks for the Swift version number in the output def test_help_version(self): """Test 'help version' and 'version' commands.""" self.expect("help version", diff --git a/lldb/test/API/functionalities/mtc/swift-property/TestMTCSwiftProperty.py b/lldb/test/API/functionalities/mtc/swift-property/TestMTCSwiftProperty.py index de5ed00f4d28a..b27f8530be4fb 100644 --- a/lldb/test/API/functionalities/mtc/swift-property/TestMTCSwiftProperty.py +++ b/lldb/test/API/functionalities/mtc/swift-property/TestMTCSwiftProperty.py @@ -19,6 +19,7 @@ class MTCSwiftPropertyTestCase(TestBase): @expectedFailureAll(bugnumber="rdar://60396797", setting=('symbols.use-swift-clangimporter', 'false')) @skipUnlessDarwin + @swiftTest def test(self): self.mtc_dylib_path = findMainThreadCheckerDylib() self.assertTrue(self.mtc_dylib_path != "") diff --git a/lldb/test/API/functionalities/mtc/swift/TestMTCSwift.py b/lldb/test/API/functionalities/mtc/swift/TestMTCSwift.py index fbfaeea46e09b..9fc68a2e8feb9 100644 --- a/lldb/test/API/functionalities/mtc/swift/TestMTCSwift.py +++ b/lldb/test/API/functionalities/mtc/swift/TestMTCSwift.py @@ -19,6 +19,7 @@ class MTCSwiftTestCase(TestBase): @expectedFailureAll(bugnumber="rdar://60396797", setting=('symbols.use-swift-clangimporter', 'false')) @skipUnlessDarwin + @swiftTest def test(self): self.mtc_dylib_path = findMainThreadCheckerDylib() self.assertTrue(self.mtc_dylib_path != "") diff --git a/lldb/test/API/lang/swift/availability/TestAvailability.py b/lldb/test/API/lang/swift/availability/TestAvailability.py index 9d9f89da06a7b..e497d6920e347 100644 --- a/lldb/test/API/lang/swift/availability/TestAvailability.py +++ b/lldb/test/API/lang/swift/availability/TestAvailability.py @@ -41,6 +41,7 @@ def setUp(self): # Call super's setUp(). TestBase.setUp(self) + @swiftTest @skipIf(oslist=['linux', 'windows']) def testAvailability(self): platform_name = lldbplatformutil.getPlatform() diff --git a/lldb/test/API/lang/swift/completion/TestSwiftREPLCompletion.py b/lldb/test/API/lang/swift/completion/TestSwiftREPLCompletion.py index e54408916884e..6e665e17e0228 100644 --- a/lldb/test/API/lang/swift/completion/TestSwiftREPLCompletion.py +++ b/lldb/test/API/lang/swift/completion/TestSwiftREPLCompletion.py @@ -12,6 +12,7 @@ class SwiftCompletionTest(PExpectTest): # under ASAN on a loaded machine.. @skipIfAsan @skipUnlessDarwin + @swiftTest def test_basic_completion(self): self.launch(extra_args=["--repl"], executable=None, dimensions=(100,500)) @@ -41,6 +42,7 @@ def test_basic_completion(self): # under ASAN on a loaded machine.. @skipIfAsan @skipIf(oslist=['windows']) + @swiftTest def test_lldb_command_completion(self): self.launch(extra_args=["--repl"], executable=None, dimensions=(100,500)) diff --git a/lldb/test/API/lang/swift/delayed_parsing_crash/TestDelayedParsingCrash.py b/lldb/test/API/lang/swift/delayed_parsing_crash/TestDelayedParsingCrash.py index 3c0912ac0181f..e0768afb05784 100644 --- a/lldb/test/API/lang/swift/delayed_parsing_crash/TestDelayedParsingCrash.py +++ b/lldb/test/API/lang/swift/delayed_parsing_crash/TestDelayedParsingCrash.py @@ -1,4 +1,4 @@ import lldbsuite.test.lldbinline as lldbinline from lldbsuite.test.decorators import * -lldbinline.MakeInlineTest(__file__, globals()) +lldbinline.MakeInlineTest(__file__, globals(), decorators=[swiftTest]) diff --git a/lldb/test/API/lang/swift/deserialization_failure/TestSwiftDeserializationFailure.py b/lldb/test/API/lang/swift/deserialization_failure/TestSwiftDeserializationFailure.py index 5499d5d21dae4..56fe6b2af2186 100644 --- a/lldb/test/API/lang/swift/deserialization_failure/TestSwiftDeserializationFailure.py +++ b/lldb/test/API/lang/swift/deserialization_failure/TestSwiftDeserializationFailure.py @@ -37,6 +37,7 @@ def run_tests(self, target, process): # FIXME: this is formatted incorrectly. self.expect("fr var t", substrs=["(T)"]) #, "world"]) + @swiftTest @skipIf(oslist=['windows']) @skipIf(debug_info=no_match(["dwarf"])) @expectedFailureAll(archs=["arm64", "arm64e", 'arm64_32'], bugnumber="") @@ -47,6 +48,7 @@ def test_missing_module(self): target, process, _, _ = lldbutil.run_to_name_breakpoint(self, 'main') self.run_tests(target, process) + @swiftTest @skipIf(oslist=['windows']) @skipIf(debug_info=no_match(["dwarf"])) @expectedFailureAll(archs=["arm64", "arm64e", 'arm64_32'], bugnumber="") diff --git a/lldb/test/API/lang/swift/enum_associated/TestEnumAssociated.py b/lldb/test/API/lang/swift/enum_associated/TestEnumAssociated.py index 3c0912ac0181f..e0768afb05784 100644 --- a/lldb/test/API/lang/swift/enum_associated/TestEnumAssociated.py +++ b/lldb/test/API/lang/swift/enum_associated/TestEnumAssociated.py @@ -1,4 +1,4 @@ import lldbsuite.test.lldbinline as lldbinline from lldbsuite.test.decorators import * -lldbinline.MakeInlineTest(__file__, globals()) +lldbinline.MakeInlineTest(__file__, globals(), decorators=[swiftTest]) diff --git a/lldb/test/API/lang/swift/expression/errors/TestExpressionErrors.py b/lldb/test/API/lang/swift/expression/errors/TestExpressionErrors.py index e52aa32956af8..74927b5bc0869 100644 --- a/lldb/test/API/lang/swift/expression/errors/TestExpressionErrors.py +++ b/lldb/test/API/lang/swift/expression/errors/TestExpressionErrors.py @@ -24,6 +24,7 @@ class TestExpressionErrors(TestBase): mydir = TestBase.compute_mydir(__file__) + @swiftTest def test_CanThrowError(self): """Tests that swift expressions resolve scoped variables correctly""" self.build() diff --git a/lldb/test/API/lang/swift/missing_sdk/TestMissingSDK.py b/lldb/test/API/lang/swift/missing_sdk/TestMissingSDK.py index ca01eaf57eca5..f6bb817f70661 100644 --- a/lldb/test/API/lang/swift/missing_sdk/TestMissingSDK.py +++ b/lldb/test/API/lang/swift/missing_sdk/TestMissingSDK.py @@ -19,6 +19,7 @@ def setUp(self): # Call super's setUp(). TestBase.setUp(self) + @swiftTest @skipIf(oslist=['windows']) @skipIfDarwinEmbedded # swift crash inspecting swift stdlib with little other swift loaded def testMissingSDK(self): diff --git a/lldb/test/API/lang/swift/objc_runtime_ivars/TestObjCIvarDiscovery.py b/lldb/test/API/lang/swift/objc_runtime_ivars/TestObjCIvarDiscovery.py index b9d7ea746ad57..7a5870fd28c9b 100644 --- a/lldb/test/API/lang/swift/objc_runtime_ivars/TestObjCIvarDiscovery.py +++ b/lldb/test/API/lang/swift/objc_runtime_ivars/TestObjCIvarDiscovery.py @@ -28,6 +28,7 @@ class TestObjCIVarDiscovery(TestBase): @skipUnlessDarwin @skipIf(debug_info=no_match("dsym")) + @swiftTest def test_nodbg(self): self.build() shutil.rmtree(self.getBuildArtifact("aTestFramework.framework/Versions/A/aTestFramework.dSYM")) @@ -35,6 +36,7 @@ def test_nodbg(self): @skipUnlessDarwin @skipIf(debug_info=no_match("dsym")) + @swiftTest def test_dbg(self): self.build() self.do_test(True) diff --git a/lldb/test/API/lang/swift/private_import/TestSwiftPrivateImport.py b/lldb/test/API/lang/swift/private_import/TestSwiftPrivateImport.py index 698b4bc0511fd..da77c07c8dbef 100644 --- a/lldb/test/API/lang/swift/private_import/TestSwiftPrivateImport.py +++ b/lldb/test/API/lang/swift/private_import/TestSwiftPrivateImport.py @@ -11,6 +11,7 @@ def setUp(self): TestBase.setUp(self) @skipUnlessDarwin + @swiftTest def test_private_import(self): """Test a library with a private import for which there is no debug info""" invisible_swift = self.getBuildArtifact("Invisible.swift") diff --git a/lldb/test/API/lang/swift/protocol_extension_two/TestProtocolExtensionTwo.py b/lldb/test/API/lang/swift/protocol_extension_two/TestProtocolExtensionTwo.py index 3c0912ac0181f..e0768afb05784 100644 --- a/lldb/test/API/lang/swift/protocol_extension_two/TestProtocolExtensionTwo.py +++ b/lldb/test/API/lang/swift/protocol_extension_two/TestProtocolExtensionTwo.py @@ -1,4 +1,4 @@ import lldbsuite.test.lldbinline as lldbinline from lldbsuite.test.decorators import * -lldbinline.MakeInlineTest(__file__, globals()) +lldbinline.MakeInlineTest(__file__, globals(), decorators=[swiftTest]) diff --git a/lldb/test/API/repl/array/TestREPLArray.py b/lldb/test/API/repl/array/TestREPLArray.py index caabfff293660..8cbb966ab63ba 100644 --- a/lldb/test/API/repl/array/TestREPLArray.py +++ b/lldb/test/API/repl/array/TestREPLArray.py @@ -1,4 +1,5 @@ import lldbsuite.test.lldbinrepl as lldbinrepl import lldbsuite.test.lldbtest as lldbtest +from lldbsuite.test.decorators import * -lldbinrepl.MakeREPLTest(__file__, globals(), []) +lldbinrepl.MakeREPLTest(__file__, globals(), decorators=[swiftTest]) diff --git a/lldb/test/API/repl/cpp_exceptions/TestCPPExceptionsInREPL.py b/lldb/test/API/repl/cpp_exceptions/TestCPPExceptionsInREPL.py index f305b01bbf8ba..00c1993cecd82 100644 --- a/lldb/test/API/repl/cpp_exceptions/TestCPPExceptionsInREPL.py +++ b/lldb/test/API/repl/cpp_exceptions/TestCPPExceptionsInREPL.py @@ -26,6 +26,7 @@ class TestREPLExceptions(TestBase): NO_DEBUG_INFO_TESTCASE = True @decorators.skipUnlessDarwin + @decorators.swiftTest def test_set_repl_mode_exceptions(self): """ Test that SetREPLMode turns off trapping exceptions.""" self.build() @@ -33,6 +34,7 @@ def test_set_repl_mode_exceptions(self): self.do_repl_mode_test() @decorators.skipUnlessDarwin + @decorators.swiftTest def test_repl_exceptions(self): """ Test the lldb --repl turns off trapping exceptions.""" self.build()