Author: David Spickett Date: 2023-09-11T16:44:12Z New Revision: 6bf923d5c3daf5d66e0acf53d037a12ceff4a275
URL: https://github.com/llvm/llvm-project/commit/6bf923d5c3daf5d66e0acf53d037a12ceff4a275 DIFF: https://github.com/llvm/llvm-project/commit/6bf923d5c3daf5d66e0acf53d037a12ceff4a275.diff LOG: [lldb][Tests] Reformat API tests with black These are all recent additions I think, including a few of mine for AArch64. Going forward the CI checks should help us fix these earlier. Added: Modified: lldb/test/API/commands/gui/spawn-threads/TestGuiSpawnThreads.py lldb/test/API/commands/register/register/aarch64_mte_ctrl_register/TestMTECtrlRegister.py lldb/test/API/commands/register/register/aarch64_sve_simd_registers/TestSVESIMDRegisters.py lldb/test/API/functionalities/archives/TestBSDArchives.py lldb/test/API/functionalities/dyld-multiple-rdebug/TestDyldWithMultupleRDebug.py lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py lldb/test/API/lang/rust/enum-structs/RustEnumValue.py lldb/test/API/lang/rust/enum-structs/TestRustEnumStructs.py lldb/test/API/python_api/event/TestEvents.py lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py Removed: ################################################################################ diff --git a/lldb/test/API/commands/gui/spawn-threads/TestGuiSpawnThreads.py b/lldb/test/API/commands/gui/spawn-threads/TestGuiSpawnThreads.py index 54726de22b100ee..de61d7967d2e677 100644 --- a/lldb/test/API/commands/gui/spawn-threads/TestGuiSpawnThreads.py +++ b/lldb/test/API/commands/gui/spawn-threads/TestGuiSpawnThreads.py @@ -10,6 +10,7 @@ import sys + class TestGuiSpawnThreadsTest(PExpectTest): # PExpect uses many timeouts internally and doesn't play well # under ASAN on a loaded machine.. @@ -18,12 +19,14 @@ class TestGuiSpawnThreadsTest(PExpectTest): def test_gui(self): self.build() - self.launch(executable=self.getBuildArtifact('a.out'), dimensions=(100, 500)) + self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100, 500)) self.expect( - 'breakpoint set -f main.cpp -p "break here"', substrs=['Breakpoint 1', 'address ='] + 'breakpoint set -f main.cpp -p "break here"', + substrs=["Breakpoint 1", "address ="], ) self.expect( - 'breakpoint set -f main.cpp -p "before join"', substrs=['Breakpoint 2', 'address ='] + 'breakpoint set -f main.cpp -p "before join"', + substrs=["Breakpoint 2", "address ="], ) self.expect("run", substrs=["stop reason ="]) diff --git a/lldb/test/API/commands/register/register/aarch64_mte_ctrl_register/TestMTECtrlRegister.py b/lldb/test/API/commands/register/register/aarch64_mte_ctrl_register/TestMTECtrlRegister.py index 48e8bb872e3f029..7fd6b2dada640e6 100644 --- a/lldb/test/API/commands/register/register/aarch64_mte_ctrl_register/TestMTECtrlRegister.py +++ b/lldb/test/API/commands/register/register/aarch64_mte_ctrl_register/TestMTECtrlRegister.py @@ -47,4 +47,4 @@ def test_mte_ctrl_register(self): # This would return to synchronous faults if we did not restore the # previous value. self.expect("expression setup_mte()", substrs=["= 0"]) - self.expect("register read mte_ctrl", substrs=["0x0000000000000005"]) \ No newline at end of file + self.expect("register read mte_ctrl", substrs=["0x0000000000000005"]) diff --git a/lldb/test/API/commands/register/register/aarch64_sve_simd_registers/TestSVESIMDRegisters.py b/lldb/test/API/commands/register/register/aarch64_sve_simd_registers/TestSVESIMDRegisters.py index c38a255aac6e296..814ca98369fca57 100644 --- a/lldb/test/API/commands/register/register/aarch64_sve_simd_registers/TestSVESIMDRegisters.py +++ b/lldb/test/API/commands/register/register/aarch64_sve_simd_registers/TestSVESIMDRegisters.py @@ -52,8 +52,10 @@ def check_simd_values(self, value_offset): # These are 128 bit registers, so getting them from the API as unsigned # values doesn't work. Check the command output instead. for i in range(32): - self.expect("register read v{}".format(i), - substrs=[self.make_simd_value(i+value_offset)]) + self.expect( + "register read v{}".format(i), + substrs=[self.make_simd_value(i + value_offset)], + ) def sve_simd_registers_impl(self, mode): self.skip_if_needed(mode) diff --git a/lldb/test/API/functionalities/archives/TestBSDArchives.py b/lldb/test/API/functionalities/archives/TestBSDArchives.py index 9ec21ba2e821c1f..b0609ac7410bd8c 100644 --- a/lldb/test/API/functionalities/archives/TestBSDArchives.py +++ b/lldb/test/API/functionalities/archives/TestBSDArchives.py @@ -70,7 +70,6 @@ def test(self): ) self.expect_var_path("__b_global", type="int", value="2") - def check_frame_variable_errors(self, thread, error_strings): command_result = lldb.SBCommandReturnObject() interp = self.dbg.GetCommandInterpreter() @@ -173,7 +172,6 @@ def test_archive_specifications(self): self.assertEqual(spec.GetObjectName(), "b.o") self.assertEqual(spec.GetObjectSize(), size_b, libfoothin_path) - @skipIfRemote @skipUnlessDarwin def test_frame_var_errors_when_thin_archive_malformed(self): diff --git a/lldb/test/API/functionalities/dyld-multiple-rdebug/TestDyldWithMultupleRDebug.py b/lldb/test/API/functionalities/dyld-multiple-rdebug/TestDyldWithMultupleRDebug.py index 11620fe7c8b07c7..72c1e6a842368fd 100644 --- a/lldb/test/API/functionalities/dyld-multiple-rdebug/TestDyldWithMultupleRDebug.py +++ b/lldb/test/API/functionalities/dyld-multiple-rdebug/TestDyldWithMultupleRDebug.py @@ -26,14 +26,15 @@ def test(self): # in the main executable. Setting breakpoints by file and line ensures # that the main executable was loaded correctly by the dynamic loader (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( - self, "// Break here", lldb.SBFileSpec("main.cpp"), - extra_images=["testlib"] + self, "// Break here", lldb.SBFileSpec("main.cpp"), extra_images=["testlib"] ) # Set breakpoints both on shared library function to ensure that # we hit a source breakpoint in the shared library which only will # happen if we load the shared library correctly in the dynamic # loader. lldbutil.continue_to_source_breakpoint( - self, process, "// Library break here", - lldb.SBFileSpec("library_file.cpp", False) + self, + process, + "// Library break here", + lldb.SBFileSpec("library_file.cpp", False), ) diff --git a/lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py b/lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py index 528c9fdce69ce3c..a7003c3c3f1f339 100644 --- a/lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py +++ b/lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py @@ -25,7 +25,7 @@ def setUp(self): # These tests are flakey and sometimes timeout. They work most of the time # so the basic event flow is right, but somehow the handling is off. @skipUnlessDarwin - @skipIfDarwin + @skipIfDarwin def test_passthrough_launch(self): """Test a simple pass-through process launch""" self.passthrough_launch() diff --git a/lldb/test/API/lang/rust/enum-structs/RustEnumValue.py b/lldb/test/API/lang/rust/enum-structs/RustEnumValue.py index dcf534ad587ae50..bc4fd7d695785fd 100644 --- a/lldb/test/API/lang/rust/enum-structs/RustEnumValue.py +++ b/lldb/test/API/lang/rust/enum-structs/RustEnumValue.py @@ -4,8 +4,8 @@ DISCRIMINANT_MEMBER_NAME = "$discr$" VALUE_MEMBER_NAME = "value" -class RustEnumValue: +class RustEnumValue: def __init__(self, value: lldb.SBValue): self.value = value @@ -19,7 +19,11 @@ def _inner(self) -> lldb.SBValue: return self.value.GetChildAtIndex(0) def getVariantByIndex(self, index): - return self._inner().GetChildAtIndex(index).GetChildMemberWithName(VALUE_MEMBER_NAME) + return ( + self._inner() + .GetChildAtIndex(index) + .GetChildMemberWithName(VALUE_MEMBER_NAME) + ) @staticmethod def _getDiscriminantValueAsUnsigned(discr_sbvalue: lldb.SBValue): @@ -42,10 +46,12 @@ def _getDiscriminantValueAsUnsigned(discr_sbvalue: lldb.SBValue): def getCurrentVariantIndex(self): default_index = 0 for i in range(self._inner().GetNumChildren()): - variant: lldb.SBValue = self._inner().GetChildAtIndex(i); + variant: lldb.SBValue = self._inner().GetChildAtIndex(i) discr = variant.GetChildMemberWithName(DISCRIMINANT_MEMBER_NAME) if discr.IsValid(): - discr_unsigned_value = RustEnumValue._getDiscriminantValueAsUnsigned(discr) + discr_unsigned_value = RustEnumValue._getDiscriminantValueAsUnsigned( + discr + ) if variant.GetName() == f"$variant${discr_unsigned_value}": return discr_unsigned_value else: diff --git a/lldb/test/API/lang/rust/enum-structs/TestRustEnumStructs.py b/lldb/test/API/lang/rust/enum-structs/TestRustEnumStructs.py index 4cd4243f17f68ca..46f96d89221d596 100644 --- a/lldb/test/API/lang/rust/enum-structs/TestRustEnumStructs.py +++ b/lldb/test/API/lang/rust/enum-structs/TestRustEnumStructs.py @@ -31,88 +31,125 @@ def test_clike_enums_are_represented_correctly(self): self.target().FindFirstGlobalVariable("CLIKE_U32_A").GetValue(), self.target().FindFirstGlobalVariable("CLIKE_U32_B").GetValue(), ] - self.assertEqual(all_values, ['A', 'B', 'VariantA', 'VariantC', 'VariantA', 'VariantB']) + self.assertEqual( + all_values, ["A", "B", "VariantA", "VariantC", "VariantA", "VariantB"] + ) def test_enum_with_tuples_has_all_variants(self): - self.assertEqual(self.getFromGlobal("ENUM_WITH_TUPLES_A").getAllVariantTypes(), - ['main::EnumWithTuples::A:8', - 'main::EnumWithTuples::B:8', - 'main::EnumWithTuples::C:8', - 'main::EnumWithTuples::D:8', - 'main::EnumWithTuples::AA:8', - 'main::EnumWithTuples::BB:8', - 'main::EnumWithTuples::BC:8', - 'main::EnumWithTuples::CC:8']) + self.assertEqual( + self.getFromGlobal("ENUM_WITH_TUPLES_A").getAllVariantTypes(), + [ + "main::EnumWithTuples::A:8", + "main::EnumWithTuples::B:8", + "main::EnumWithTuples::C:8", + "main::EnumWithTuples::D:8", + "main::EnumWithTuples::AA:8", + "main::EnumWithTuples::BB:8", + "main::EnumWithTuples::BC:8", + "main::EnumWithTuples::CC:8", + ], + ) def test_enum_with_tuples_values_are_correct_a(self): # static ENUM_WITH_TUPLES_A: EnumWithTuples = EnumWithTuples::A(13); self.assertEqual( - self.getFromGlobal("ENUM_WITH_TUPLES_A").getCurrentValue().GetChildAtIndex(0).GetData().GetUnsignedInt8( - lldb.SBError(), 0), - 13) + self.getFromGlobal("ENUM_WITH_TUPLES_A") + .getCurrentValue() + .GetChildAtIndex(0) + .GetData() + .GetUnsignedInt8(lldb.SBError(), 0), + 13, + ) def test_enum_with_tuples_values_are_correct_aa(self): # static ENUM_WITH_TUPLES_AA: EnumWithTuples = EnumWithTuples::AA(13, 37); value = self.getFromGlobal("ENUM_WITH_TUPLES_AA").getCurrentValue() self.assertEqual( - (value.GetChildAtIndex(0).GetData().GetUnsignedInt8( - lldb.SBError(), 0), - value.GetChildAtIndex(1).GetData().GetUnsignedInt8( - lldb.SBError(), 0)), - (13, 37)) + ( + value.GetChildAtIndex(0).GetData().GetUnsignedInt8(lldb.SBError(), 0), + value.GetChildAtIndex(1).GetData().GetUnsignedInt8(lldb.SBError(), 0), + ), + (13, 37), + ) def test_enum_with_tuples_values_are_correct_b(self): # static ENUM_WITH_TUPLES_B: EnumWithTuples = EnumWithTuples::B(37); self.assertEqual( - self.getFromGlobal("ENUM_WITH_TUPLES_B").getCurrentValue().GetChildAtIndex(0).GetData().GetUnsignedInt16( - lldb.SBError(), 0), - 37) + self.getFromGlobal("ENUM_WITH_TUPLES_B") + .getCurrentValue() + .GetChildAtIndex(0) + .GetData() + .GetUnsignedInt16(lldb.SBError(), 0), + 37, + ) def test_enum_with_tuples_values_are_correct_bb(self): # static ENUM_WITH_TUPLES_BB: EnumWithTuples = EnumWithTuples::BB(37, 5535); value = self.getFromGlobal("ENUM_WITH_TUPLES_BB").getCurrentValue() self.assertEqual( - (value.GetChildAtIndex(0).GetData().GetUnsignedInt16(lldb.SBError(), 0), - value.GetChildAtIndex(1).GetData().GetUnsignedInt16(lldb.SBError(), 0)), - (37, 5535)) + ( + value.GetChildAtIndex(0).GetData().GetUnsignedInt16(lldb.SBError(), 0), + value.GetChildAtIndex(1).GetData().GetUnsignedInt16(lldb.SBError(), 0), + ), + (37, 5535), + ) def test_enum_with_tuples_values_are_correct_bc(self): # static ENUM_WITH_TUPLES_BC: EnumWithTuples = EnumWithTuples::BC(65000, 165000); value = self.getFromGlobal("ENUM_WITH_TUPLES_BC").getCurrentValue() self.assertEqual( - (value.GetChildAtIndex(0).GetData().GetUnsignedInt16(lldb.SBError(), 0), - value.GetChildAtIndex(1).GetData().GetUnsignedInt32(lldb.SBError(), 0)), - (65000, 165000)) + ( + value.GetChildAtIndex(0).GetData().GetUnsignedInt16(lldb.SBError(), 0), + value.GetChildAtIndex(1).GetData().GetUnsignedInt32(lldb.SBError(), 0), + ), + (65000, 165000), + ) def test_enum_with_tuples_values_are_correct_c(self): # static ENUM_WITH_TUPLES_C: EnumWithTuples = EnumWithTuples::C(31337); self.assertEqual( - self.getFromGlobal("ENUM_WITH_TUPLES_C").getCurrentValue().GetChildAtIndex(0).GetData().GetUnsignedInt32( - lldb.SBError(), 0), - 31337) + self.getFromGlobal("ENUM_WITH_TUPLES_C") + .getCurrentValue() + .GetChildAtIndex(0) + .GetData() + .GetUnsignedInt32(lldb.SBError(), 0), + 31337, + ) def test_enum_with_tuples_values_are_correct_cc(self): # static ENUM_WITH_TUPLES_CC: EnumWithTuples = EnumWithTuples::CC(31337, 87236); value = self.getFromGlobal("ENUM_WITH_TUPLES_CC").getCurrentValue() self.assertEqual( - (value.GetChildAtIndex(0).GetData().GetUnsignedInt32(lldb.SBError(), 0), - value.GetChildAtIndex(1).GetData().GetUnsignedInt32(lldb.SBError(), 0)), - (31337, 87236)) + ( + value.GetChildAtIndex(0).GetData().GetUnsignedInt32(lldb.SBError(), 0), + value.GetChildAtIndex(1).GetData().GetUnsignedInt32(lldb.SBError(), 0), + ), + (31337, 87236), + ) def test_enum_with_tuples_values_are_correct_d(self): # static ENUM_WITH_TUPLES_D: EnumWithTuples = EnumWithTuples::D(123456789012345678); self.assertEqual( - self.getFromGlobal("ENUM_WITH_TUPLES_D").getCurrentValue().GetChildAtIndex(0).GetData().GetUnsignedInt64( - lldb.SBError(), 0), - 123456789012345678) + self.getFromGlobal("ENUM_WITH_TUPLES_D") + .getCurrentValue() + .GetChildAtIndex(0) + .GetData() + .GetUnsignedInt64(lldb.SBError(), 0), + 123456789012345678, + ) def test_mixed_enum_variants(self): # static MIXED_ENUM_A: MixedEnum1 = MixedEnum1::A; - self.assertEqual(self.getFromGlobal("MIXED_ENUM_A").getAllVariantTypes(), ['main::MixedEnum::A:64', - 'main::MixedEnum::B:64', - 'main::MixedEnum::C:64', - 'main::MixedEnum::D:64', - 'main::MixedEnum::E:64']) + self.assertEqual( + self.getFromGlobal("MIXED_ENUM_A").getAllVariantTypes(), + [ + "main::MixedEnum::A:64", + "main::MixedEnum::B:64", + "main::MixedEnum::C:64", + "main::MixedEnum::D:64", + "main::MixedEnum::E:64", + ], + ) def test_mixed_enum_a(self): # static MIXED_ENUM_A: MixedEnum = MixedEnum::A; @@ -124,18 +161,30 @@ def test_mixed_enum_c(self): # static MIXED_ENUM_C: MixedEnum = MixedEnum::C(254, -254); value = self.getFromGlobal("MIXED_ENUM_C").getCurrentValue() self.assertEqual( - (value.GetChildAtIndex(0).GetData().GetUnsignedInt8(lldb.SBError(), 0), - value.GetChildAtIndex(1).GetData().GetSignedInt32(lldb.SBError(), 0)), - (254, -254)) + ( + value.GetChildAtIndex(0).GetData().GetUnsignedInt8(lldb.SBError(), 0), + value.GetChildAtIndex(1).GetData().GetSignedInt32(lldb.SBError(), 0), + ), + (254, -254), + ) def test_mixed_enum_d_none(self): # static MIXED_ENUM_D_NONE: MixedEnum = MixedEnum::D(None); - value = RustEnumValue(self.getFromGlobal("MIXED_ENUM_D_NONE").getCurrentValue().GetChildAtIndex(0)) - self.assertEqual(value.getAllVariantTypes(), ["core::option::Option<main::Struct2>::None<main::Struct2>:32", - "core::option::Option<main::Struct2>::Some<main::Struct2>:32"]) + value = RustEnumValue( + self.getFromGlobal("MIXED_ENUM_D_NONE").getCurrentValue().GetChildAtIndex(0) + ) + self.assertEqual( + value.getAllVariantTypes(), + [ + "core::option::Option<main::Struct2>::None<main::Struct2>:32", + "core::option::Option<main::Struct2>::Some<main::Struct2>:32", + ], + ) self.assertEqual(value.getCurrentValue().GetValue(), None) - self.assertEqual(value.getCurrentValue().GetType().GetDisplayTypeName(), - "core::option::Option<main::Struct2>::None<main::Struct2>") + self.assertEqual( + value.getCurrentValue().GetType().GetDisplayTypeName(), + "core::option::Option<main::Struct2>::None<main::Struct2>", + ) def test_mixed_enum_d_some(self): # static MIXED_ENUM_D_SOME: MixedEnum = MixedEnum::D(Some(Struct2 { @@ -143,49 +192,74 @@ def test_mixed_enum_d_some(self): # inner: Struct1 { field: 123 }, # })); variant_with_option = RustEnumValue( - self.getFromGlobal("MIXED_ENUM_D_SOME").getCurrentValue().GetChildAtIndex(0)) + self.getFromGlobal("MIXED_ENUM_D_SOME").getCurrentValue().GetChildAtIndex(0) + ) value_inside_option = variant_with_option.getCurrentValue().GetChildAtIndex(0) self.assertEqual( - value_inside_option.GetChildMemberWithName("field").GetData().GetUnsignedInt32(lldb.SBError(), 0), 123456) + value_inside_option.GetChildMemberWithName("field") + .GetData() + .GetUnsignedInt32(lldb.SBError(), 0), + 123456, + ) self.assertEqual( - value_inside_option.GetChildMemberWithName("inner").GetChildMemberWithName( - "field").GetData().GetSignedInt32(lldb.SBError(), 0), - 123) - self.assertEqual(value_inside_option.GetType().GetDisplayTypeName(), "main::Struct2") + value_inside_option.GetChildMemberWithName("inner") + .GetChildMemberWithName("field") + .GetData() + .GetSignedInt32(lldb.SBError(), 0), + 123, + ) + self.assertEqual( + value_inside_option.GetType().GetDisplayTypeName(), "main::Struct2" + ) def test_option_non_null_some_pointer(self): - type = self.target().FindFirstType("core::option::Option<core::ptr::non_null::NonNull<u64>>") + type = self.target().FindFirstType( + "core::option::Option<core::ptr::non_null::NonNull<u64>>" + ) # this type is "optimized" by rust compiler so the discriminant isn't present on Some variant of option data = [1337] pointer_size = self.target().GetAddressByteSize() byte_order = self.target().GetByteOrder() - value = RustEnumValue(self.target().CreateValueFromData("adhoc_value", - lldb.SBData.CreateDataFromUInt64Array(byte_order, - pointer_size, - data), - type)) + value = RustEnumValue( + self.target().CreateValueFromData( + "adhoc_value", + lldb.SBData.CreateDataFromUInt64Array(byte_order, pointer_size, data), + type, + ) + ) self.assertEqual(value.getFields(), ["$variant$0", "$variant$"]) self.assertEqual( - value.getCurrentValue().GetChildAtIndex(0).GetChildMemberWithName("pointer").GetValueAsUnsigned(), 1337) + value.getCurrentValue() + .GetChildAtIndex(0) + .GetChildMemberWithName("pointer") + .GetValueAsUnsigned(), + 1337, + ) def test_option_non_null_none(self): - type = self.target().FindFirstType("core::option::Option<core::ptr::non_null::NonNull<u64>>") + type = self.target().FindFirstType( + "core::option::Option<core::ptr::non_null::NonNull<u64>>" + ) # this type is "optimized" by rust compiler so the discriminant isn't present on Some variant of option # in this test case 0 is used to represent 'None' data = [0] pointer_size = self.target().GetAddressByteSize() byte_order = self.target().GetByteOrder() - value = RustEnumValue(self.target().CreateValueFromData("adhoc_value", - lldb.SBData.CreateDataFromUInt64Array(byte_order, - pointer_size, - data), - type)) + value = RustEnumValue( + self.target().CreateValueFromData( + "adhoc_value", + lldb.SBData.CreateDataFromUInt64Array(byte_order, pointer_size, data), + type, + ) + ) self.assertEqual(value.getFields(), ["$variant$0", "$variant$"]) self.assertEqual(value.getCurrentValue().GetValue(), None) - self.assertEqual(value.getCurrentValue().GetType().GetDisplayTypeName(), - "core::option::Option<core::ptr::non_null::NonNull<u64>>::None<core::ptr::non_null::NonNull<unsigned long> >") + self.assertEqual( + value.getCurrentValue().GetType().GetDisplayTypeName(), + "core::option::Option<core::ptr::non_null::NonNull<u64>>::None<core::ptr::non_null::NonNull<unsigned long> >", + ) def test_niche_layout_with_fields_2(self): # static NICHE_W_FIELDS_2_A: NicheLayoutWithFields2 = @@ -193,10 +267,13 @@ def test_niche_layout_with_fields_2(self): value = self.getFromGlobal("NICHE_W_FIELDS_2_A").getCurrentValue() self.assertEqual( ( - value.GetChildAtIndex(0).GetChildAtIndex(0).GetData().GetUnsignedInt32(lldb.SBError(), 0), - value.GetChildAtIndex(1).GetData().GetUnsignedInt32(lldb.SBError(), 0) + value.GetChildAtIndex(0) + .GetChildAtIndex(0) + .GetData() + .GetUnsignedInt32(lldb.SBError(), 0), + value.GetChildAtIndex(1).GetData().GetUnsignedInt32(lldb.SBError(), 0), ), - (800, 900) + (800, 900), ) def test_niche_layout_with_fields_3_a(self): @@ -207,13 +284,12 @@ def test_niche_layout_with_fields_3_a(self): value.GetChildAtIndex(0).GetData().GetUnsignedInt8(lldb.SBError(), 0), value.GetChildAtIndex(1).GetData().GetUnsignedInt8(lldb.SBError(), 0), ), - (137, 1) + (137, 1), ) def test_niche_layout_with_fields_3_a(self): # static NICHE_W_FIELDS_3_C: NicheLayoutWithFields3 = NicheLayoutWithFields3::C(false); value = self.getFromGlobal("NICHE_W_FIELDS_3_C").getCurrentValue() self.assertEqual( - value.GetChildAtIndex(0).GetData().GetUnsignedInt8(lldb.SBError(), 0), - 0 + value.GetChildAtIndex(0).GetData().GetUnsignedInt8(lldb.SBError(), 0), 0 ) diff --git a/lldb/test/API/python_api/event/TestEvents.py b/lldb/test/API/python_api/event/TestEvents.py index 9c933d440847c5b..3017c86a113d7d7 100644 --- a/lldb/test/API/python_api/event/TestEvents.py +++ b/lldb/test/API/python_api/event/TestEvents.py @@ -314,10 +314,10 @@ def run(self): self.state, "stopped", "Both expected state changed events received" ) - def wait_for_next_event(self, expected_state, test_shadow = False): + def wait_for_next_event(self, expected_state, test_shadow=False): """Wait for an event from self.primary & self.shadow listener. - If test_shadow is true, we also check that the shadow listener only - receives events AFTER the primary listener does.""" + If test_shadow is true, we also check that the shadow listener only + receives events AFTER the primary listener does.""" # Waiting on the shadow listener shouldn't have events yet because # we haven't fetched them for the primary listener yet: event = lldb.SBEvent() @@ -336,15 +336,23 @@ def wait_for_next_event(self, expected_state, test_shadow = False): restart = lldb.SBProcess.GetRestartedFromEvent(event) if expected_state != None: - self.assertEqual(state, expected_state, "Primary thread got the correct event") - + self.assertEqual( + state, expected_state, "Primary thread got the correct event" + ) + # And after pulling that one there should be an equivalent event for the shadow # listener: success = self.shadow_listener.WaitForEvent(5, event) self.assertTrue(success, "Shadow listener got event too") - self.assertEqual(state, lldb.SBProcess.GetStateFromEvent(event), "It was the same event") - self.assertEqual(restart, lldb.SBProcess.GetRestartedFromEvent(event), "It was the same restarted") - + self.assertEqual( + state, lldb.SBProcess.GetStateFromEvent(event), "It was the same event" + ) + self.assertEqual( + restart, + lldb.SBProcess.GetRestartedFromEvent(event), + "It was the same restarted", + ) + return state, restart @expectedFlakeyLinux("llvm.org/pr23730") # Flaky, fails ~1/100 cases @@ -367,13 +375,15 @@ def test_shadow_listener(self): self.shadow_listener = lldb.SBListener("shadow listener") self.cur_thread = None - + error = lldb.SBError() launch_info = target.GetLaunchInfo() launch_info.SetListener(self.primary_listener) launch_info.SetShadowListener(self.shadow_listener) - self.runCmd("settings set target.process.extra-startup-command QSetLogging:bitmask=LOG_PROCESS|LOG_EXCEPTIONS|LOG_RNB_PACKETS|LOG_STEP;") + self.runCmd( + "settings set target.process.extra-startup-command QSetLogging:bitmask=LOG_PROCESS|LOG_EXCEPTIONS|LOG_RNB_PACKETS|LOG_STEP;" + ) self.dbg.SetAsync(True) self.process = target.Launch(launch_info, error) @@ -394,8 +404,14 @@ def test_shadow_listener(self): # Make sure we're at our expected breakpoint: self.assertTrue(self.cur_thread.IsValid(), "Got a zeroth thread") self.assertEqual(self.cur_thread.stop_reason, lldb.eStopReasonBreakpoint) - self.assertEqual(self.cur_thread.GetStopReasonDataCount(), 2, "Only one breakpoint/loc here") - self.assertEqual(bkpt1.GetID(), self.cur_thread.GetStopReasonDataAtIndex(0), "Hit the right breakpoint") + self.assertEqual( + self.cur_thread.GetStopReasonDataCount(), 2, "Only one breakpoint/loc here" + ) + self.assertEqual( + bkpt1.GetID(), + self.cur_thread.GetStopReasonDataAtIndex(0), + "Hit the right breakpoint", + ) # Disable the first breakpoint so it doesn't get in the way... bkpt1.SetEnabled(False) @@ -429,8 +445,9 @@ def test_shadow_listener(self): counter = 0 while state != lldb.eStateExited: counter += 1 - self.assertLess(counter, 50, "Took more than 50 events to hit two breakpoints.") + self.assertLess( + counter, 50, "Took more than 50 events to hit two breakpoints." + ) if state == lldb.eStateStopped and not restarted: self.process.Continue() - state, restarted = self.wait_for_next_event(None, False) - + state, restarted = self.wait_for_next_event(None, False) diff --git a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py b/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py index 733c461305178d2..39845468888fb21 100644 --- a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py +++ b/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py @@ -422,10 +422,7 @@ def test_extra_launch_commands(self): @skipIfWindows @skipIfNetBSD # Hangs on NetBSD as well - @skipIf( - archs=["arm", "aarch64"], - oslist=["linux"] - ) + @skipIf(archs=["arm", "aarch64"], oslist=["linux"]) def test_terminate_commands(self): """ Tests that the "terminateCommands", that can be passed during diff --git a/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py b/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py index 41292c71fa459e5..e9596ac56e0ea95 100644 --- a/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py +++ b/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py @@ -528,10 +528,11 @@ def test_indexedVariables(self): "[4]": {"equals": {"type": "int", "value": "0"}}, "[raw]": {"contains": {"type": ["vector"]}}, } - children = self.vscode.request_variables(locals[2]["variablesReference"])["body"]["variables"] + children = self.vscode.request_variables(locals[2]["variablesReference"])[ + "body" + ]["variables"] self.verify_variables(verify_children, children) - @skipIfWindows @skipIfRemote def test_registers(self): _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits