llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) <details> <summary>Changes</summary> assertRegexpMatches is a deprecated alias for assertRegex and has been removed in Python 3.12. This wasn't an issue previously because we used a vendored version of the unittest module. Now that we use the built-in version this gets updated together with the Python version used to run the test suite. --- Full diff: https://github.com/llvm/llvm-project/pull/82074.diff 8 Files Affected: - (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py (+3-3) - (modified) lldb/test/API/functionalities/memory-region/TestMemoryRegion.py (+3-4) - (modified) lldb/test/API/functionalities/wrong_commands/TestWrongCommands.py (+4-7) - (modified) lldb/test/API/linux/aarch64/tagged_memory_access/TestAArch64LinuxTaggedMemoryAccess.py (+1-2) - (modified) lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py (+1-2) - (modified) lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py (+11-7) - (modified) lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py (+1-1) - (modified) lldb/test/API/tools/lldb-server/TestGdbRemoteModuleInfo.py (+5-5) ``````````diff diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index 7436b9900e98b0..73bd037fd328cb 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -249,13 +249,13 @@ def continue_to_exception_breakpoint(self, filter_label): def continue_to_exit(self, exitCode=0): self.dap_server.request_continue() stopped_events = self.dap_server.wait_for_stopped() - self.assertEquals( + self.assertEqual( len(stopped_events), 1, "stopped_events = {}".format(stopped_events) ) - self.assertEquals( + self.assertEqual( stopped_events[0]["event"], "exited", "make sure program ran to completion" ) - self.assertEquals( + self.assertEqual( stopped_events[0]["body"]["exitCode"], exitCode, "exitCode == %i" % (exitCode), diff --git a/lldb/test/API/functionalities/memory-region/TestMemoryRegion.py b/lldb/test/API/functionalities/memory-region/TestMemoryRegion.py index d90ae310ecf0e8..577411ebc1037d 100644 --- a/lldb/test/API/functionalities/memory-region/TestMemoryRegion.py +++ b/lldb/test/API/functionalities/memory-region/TestMemoryRegion.py @@ -2,7 +2,6 @@ Test the 'memory region' command. """ - import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * @@ -62,7 +61,7 @@ def test_command(self): # We allow --all or an address argument, not both interp.HandleCommand("memory region --all 0", result) self.assertFalse(result.Succeeded()) - self.assertRegexpMatches( + self.assertRegex( result.GetError(), 'The "--all" option cannot be used when an address argument is given', ) @@ -81,7 +80,7 @@ def test_command(self): # Now let's print the memory region starting at 0 which should always work. interp.HandleCommand("memory region 0x0", result) self.assertTrue(result.Succeeded()) - self.assertRegexpMatches(result.GetOutput(), "\\[0x0+-") + self.assertRegex(result.GetOutput(), "\\[0x0+-") all_regions += result.GetOutput() # Keep printing memory regions until we printed all of them. @@ -94,7 +93,7 @@ def test_command(self): # Now that we reached the end, 'memory region' should again print the usage. interp.HandleCommand("memory region", result) self.assertFalse(result.Succeeded()) - self.assertRegexpMatches( + self.assertRegex( result.GetError(), "Usage: memory region <address\-expression> \(or \-\-all\)", ) diff --git a/lldb/test/API/functionalities/wrong_commands/TestWrongCommands.py b/lldb/test/API/functionalities/wrong_commands/TestWrongCommands.py index 83900a307f52e0..d8210b74dd7064 100644 --- a/lldb/test/API/functionalities/wrong_commands/TestWrongCommands.py +++ b/lldb/test/API/functionalities/wrong_commands/TestWrongCommands.py @@ -2,7 +2,6 @@ Test how lldb reacts to wrong commands """ - import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * @@ -18,12 +17,10 @@ def test_ambiguous_command(self): command_interpreter.HandleCommand("g", result) self.assertFalse(result.Succeeded()) - self.assertRegexpMatches( - result.GetError(), "Ambiguous command 'g'. Possible matches:" - ) - self.assertRegexpMatches(result.GetError(), "gui") - self.assertRegexpMatches(result.GetError(), "gdb-remote") - self.assertEquals(1, result.GetError().count("gdb-remote")) + self.assertRegex(result.GetError(), "Ambiguous command 'g'. Possible matches:") + self.assertRegex(result.GetError(), "gui") + self.assertRegex(result.GetError(), "gdb-remote") + self.assertEqual(1, result.GetError().count("gdb-remote")) @no_debug_info_test def test_unknown_command(self): diff --git a/lldb/test/API/linux/aarch64/tagged_memory_access/TestAArch64LinuxTaggedMemoryAccess.py b/lldb/test/API/linux/aarch64/tagged_memory_access/TestAArch64LinuxTaggedMemoryAccess.py index 7b16b043bd76e8..c023e77e57d5ac 100644 --- a/lldb/test/API/linux/aarch64/tagged_memory_access/TestAArch64LinuxTaggedMemoryAccess.py +++ b/lldb/test/API/linux/aarch64/tagged_memory_access/TestAArch64LinuxTaggedMemoryAccess.py @@ -6,7 +6,6 @@ always enables. """ - import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * @@ -83,7 +82,7 @@ def test_tagged_memory_find(self): out = self.res.GetOutput() # memory find does not fail when it doesn't find the data. # First check we actually got something. - self.assertRegexpMatches(out, "data found at location: 0x[0-9A-Fa-f]+") + self.assertRegex(out, "data found at location: 0x[0-9A-Fa-f]+") # Then that the location found does not display the tag bits. self.assertNotRegexpMatches( out, "data found at location: 0x(34|56)[0-9A-Fa-f]+" diff --git a/lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py b/lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py index b1717b1ddd6049..8eadd65466a49c 100644 --- a/lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py +++ b/lldb/test/API/linux/aarch64/tagged_memory_region/TestAArch64LinuxTaggedMemoryRegion.py @@ -3,7 +3,6 @@ non address bits from addresses before lookup. """ - import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * @@ -57,7 +56,7 @@ def test_mte_regions(self): if result.Succeeded(): repeats += 1 else: - self.assertRegexpMatches(result.GetError(), "Usage: memory region") + self.assertRegex(result.GetError(), "Usage: memory region") break # This time repeat until we get the last region. At that diff --git a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py index 0192746f1277b5..57cabf5b7f4113 100644 --- a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py +++ b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py @@ -13,7 +13,7 @@ class TestDAP_evaluate(lldbdap_testcase.DAPTestCaseBase): def assertEvaluate(self, expression, regex): - self.assertRegexpMatches( + self.assertRegex( self.dap_server.request_evaluate(expression, context=self.context)["body"][ "result" ], @@ -78,9 +78,11 @@ def run_test_evaluate_expressions( else: self.assertEvaluate( "struct1", - re.escape("{foo:15}") - if enableAutoVariableSummaries - else "my_struct @ 0x", + ( + re.escape("{foo:15}") + if enableAutoVariableSummaries + else "my_struct @ 0x" + ), ) self.assertEvaluate( "struct2", "0x.* {foo:16}" if enableAutoVariableSummaries else "0x.*" @@ -127,9 +129,11 @@ def run_test_evaluate_expressions( else: self.assertEvaluate( "struct1", - re.escape("{foo:15}") - if enableAutoVariableSummaries - else "my_struct @ 0x", + ( + re.escape("{foo:15}") + if enableAutoVariableSummaries + else "my_struct @ 0x" + ), ) self.assertEvaluate("struct1.foo", "15") self.assertEvaluate("struct2->foo", "16") diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py index 799eb9d867cd57..78a4d326c12d15 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py @@ -101,7 +101,7 @@ def test_launch_failure_via_vRun(self): ) with open(exe_path, "ab") as exe_for_writing: context = self.expect_gdbremote_sequence() - self.assertRegexpMatches( + self.assertRegex( seven.unhexlify(context.get("msg")), r"(execve failed: Text file busy|The process cannot access the file because it is being used by another process.)", ) diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteModuleInfo.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteModuleInfo.py index 3fbf62ca638221..132072547e207c 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteModuleInfo.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteModuleInfo.py @@ -41,8 +41,8 @@ def test_module_info(self): context = self.expect_gdbremote_sequence() spec = context.get("spec") - self.assertRegexpMatches(spec, '"file_path":".*"') - self.assertRegexpMatches(spec, '"file_offset":\d+') - self.assertRegexpMatches(spec, '"file_size":\d+') - self.assertRegexpMatches(spec, '"triple":"\w*-\w*-.*"') - self.assertRegexpMatches(spec, '"uuid":"[A-Fa-f0-9]+"') + self.assertRegex(spec, '"file_path":".*"') + self.assertRegex(spec, '"file_offset":\d+') + self.assertRegex(spec, '"file_size":\d+') + self.assertRegex(spec, '"triple":"\w*-\w*-.*"') + self.assertRegex(spec, '"uuid":"[A-Fa-f0-9]+"') `````````` </details> https://github.com/llvm/llvm-project/pull/82074 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits