From da07f6e9e0efe35241060f5c30f30141af0a6b17 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Sat, 4 Oct 2025 17:18:39 -0700 Subject: [PATCH 1/4] [lldb] Update TestSwiftPOValTypes.py In conjunction with https://github.com/swiftlang/swift/pull/84677 rdar://161919005 --- .../lang/swift/po/val_types/TestSwiftPOValTypes.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py b/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py index 471f659b15ab2..448554221b183 100644 --- a/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py +++ b/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py @@ -22,14 +22,18 @@ def test_value_types(self): """Test 'po' on a variety of value types with and without custom descriptions.""" self.build() (_,_,_,_) = lldbutil.run_to_source_breakpoint(self, "Break here to run tests", lldb.SBFileSpec("main.swift")) - + self.expect("po dm", substrs=['a', '12', 'b', '24']) self.expect("po cm", substrs=['c', '36']) self.expect("po cm", substrs=['12', '24'], matching=False) self.expect("po cs", substrs=['CustomDebugStringConvertible']) self.expect("po cs", substrs=['CustomStringConvertible'], matching=False) - self.expect("po cs", substrs=['a', '12', 'b', '24']) - self.expect("script lldb.frame.FindVariable('cs').GetObjectDescription()", substrs=['a', '12', 'b', '24']) + self.expect("po cs", substrs=["a", "12", "b", "24"], matching=False) + self.expect( + "script lldb.frame.FindVariable('cs').GetObjectDescription()", + substrs=["a", "12", "b", "24"], + matching=False, + ) self.expect("po (12,24,36,48)", substrs=['12', '24', '36', '48']) self.expect("po (dm as Any, cm as Any,48 as Any)", substrs=['12', '24', '36', '48']) self.expect("po patatino", substrs=['foo']) @@ -46,6 +50,3 @@ def test_ignore_bkpts_in_po(self): # As part of the po expression we should auto-continue past the breakpoint so this succeeds: self.expect("po cs", substrs=['CustomDebugStringConvertible']) self.assertEqual(po_bkpt.GetHitCount(), 1, "Did hit the breakpoint") - - - From 2a61448c89790e66ef235232c145403470e7d9a6 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Sun, 5 Oct 2025 09:32:53 -0700 Subject: [PATCH 2/4] Prevent matching any "b" --- .../API/lang/swift/po/val_types/TestSwiftPOValTypes.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py b/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py index 448554221b183..b59a9f50700e9 100644 --- a/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py +++ b/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py @@ -28,10 +28,14 @@ def test_value_types(self): self.expect("po cm", substrs=['12', '24'], matching=False) self.expect("po cs", substrs=['CustomDebugStringConvertible']) self.expect("po cs", substrs=['CustomStringConvertible'], matching=False) - self.expect("po cs", substrs=["a", "12", "b", "24"], matching=False) + def pair(key, value): + # match 'key = value', 'key: value', etc + rf"\b{key}\b[[:blank:][:punct:]]+\b{value}\b" + + self.expect("po cs", patterns=[pair("a", 12), pair("b", 24)], matching=False) self.expect( "script lldb.frame.FindVariable('cs').GetObjectDescription()", - substrs=["a", "12", "b", "24"], + patterns=[pair("a", 12), pair("b", 24)], matching=False, ) self.expect("po (12,24,36,48)", substrs=['12', '24', '36', '48']) From bc0ec1847a8f2072d58208a05a9c4391c9662c30 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Sun, 5 Oct 2025 17:19:49 -0700 Subject: [PATCH 3/4] Add missing return --- lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py b/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py index b59a9f50700e9..42cf565a068da 100644 --- a/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py +++ b/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py @@ -30,7 +30,7 @@ def test_value_types(self): self.expect("po cs", substrs=['CustomStringConvertible'], matching=False) def pair(key, value): # match 'key = value', 'key: value', etc - rf"\b{key}\b[[:blank:][:punct:]]+\b{value}\b" + return rf"\b{key}\b[[:blank:][:punct:]]+\b{value}\b" self.expect("po cs", patterns=[pair("a", 12), pair("b", 24)], matching=False) self.expect( From d2fef765da91abe42785bdf73dca71a78ce8f0d8 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Mon, 6 Oct 2025 08:39:57 -0700 Subject: [PATCH 4/4] Simplify the changes --- .../API/lang/swift/po/val_types/TestSwiftPOValTypes.py | 8 ++------ lldb/test/API/lang/swift/po/val_types/main.swift | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py b/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py index 42cf565a068da..471e6913baf4d 100644 --- a/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py +++ b/lldb/test/API/lang/swift/po/val_types/TestSwiftPOValTypes.py @@ -28,14 +28,10 @@ def test_value_types(self): self.expect("po cm", substrs=['12', '24'], matching=False) self.expect("po cs", substrs=['CustomDebugStringConvertible']) self.expect("po cs", substrs=['CustomStringConvertible'], matching=False) - def pair(key, value): - # match 'key = value', 'key: value', etc - return rf"\b{key}\b[[:blank:][:punct:]]+\b{value}\b" - - self.expect("po cs", patterns=[pair("a", 12), pair("b", 24)], matching=False) + self.expect("po cs", substrs=["abc", "12", "def", "24"], matching=False) self.expect( "script lldb.frame.FindVariable('cs').GetObjectDescription()", - patterns=[pair("a", 12), pair("b", 24)], + patterns=["abc", "12", "def", "24"], matching=False, ) self.expect("po (12,24,36,48)", substrs=['12', '24', '36', '48']) diff --git a/lldb/test/API/lang/swift/po/val_types/main.swift b/lldb/test/API/lang/swift/po/val_types/main.swift index 5312791316d34..f4ed3d24811ec 100644 --- a/lldb/test/API/lang/swift/po/val_types/main.swift +++ b/lldb/test/API/lang/swift/po/val_types/main.swift @@ -13,8 +13,8 @@ struct CustomMirror : CustomReflectable { } struct CustomSummary : CustomStringConvertible, CustomDebugStringConvertible { - var a = 12 - var b = 24 + var abc = 12 + var def = 24 var description: String { return "CustomStringConvertible"