[Lldb-commits] [lldb] 560221a - [lldb] Modernize TestVLA.py

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 27 03:49:53 PDT 2021


Author: Pavel Labath
Date: 2021-10-27T12:47:56+02:00
New Revision: 560221ac7f5ca3d5dcae405587db066f4c4c8a7c

URL: https://github.com/llvm/llvm-project/commit/560221ac7f5ca3d5dcae405587db066f4c4c8a7c
DIFF: https://github.com/llvm/llvm-project/commit/560221ac7f5ca3d5dcae405587db066f4c4c8a7c.diff

LOG: [lldb] Modernize TestVLA.py

Use expect_expr/var_path instead of regular expect and substring checks

Added: 
    

Modified: 
    lldb/test/API/lang/c/vla/TestVLA.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lang/c/vla/TestVLA.py b/lldb/test/API/lang/c/vla/TestVLA.py
index 215eadc41a739..758406d72e635 100644
--- a/lldb/test/API/lang/c/vla/TestVLA.py
+++ b/lldb/test/API/lang/c/vla/TestVLA.py
@@ -32,14 +32,19 @@ def test_vla(self):
         _, process, _, _ = lldbutil.run_to_source_breakpoint(
             self, "break here", lldb.SBFileSpec('main.c'))
 
-        def test(a, array):
+        def test(a):
+            children = []
             for i in range(a):
-                self.expect("fr v vla[%d]"%i, substrs=["int", "%d"%(a-i)])
-                self.expect("expr vla[%d]"%i, substrs=["int", "%d"%(a-i)])
-            self.expect("fr v vla", substrs=array)
+                name = "[%d]"%i
+                value = str(a-i)
+                self.expect_var_path("vla"+name, type="int", value=value)
+                self.expect_expr("vla"+name, result_type="int",
+                        result_value=value)
+                children.append(ValueCheck(name=name, value=value))
+            self.expect_var_path("vla", type="int[]", children=children)
             self.expect("expr vla", error=True, substrs=["incomplete"])
 
-        test(2, ["int[]", "[0] = 2, [1] = 1"])
+        test(2)
         process.Continue()
-        test(4, ["int[]", "[0] = 4, [1] = 3, [2] = 2, [3] = 1"])
+        test(4)
 


        


More information about the lldb-commits mailing list