[Lldb-commits] [lldb] r334454 - [Test] Update static variable test.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 11 16:26:16 PDT 2018


Author: jdevlieghere
Date: Mon Jun 11 16:26:15 2018
New Revision: 334454

URL: http://llvm.org/viewvc/llvm-project?rev=334454&view=rev
Log:
[Test] Update static variable test.

Before Pavel's change in r334181, we were printing too many global
variables. This patch updates the test suite to ensure we don't regress
again in the future.

rdar://problem/29180927

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py?rev=334454&r1=334453&r2=334454&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py Mon Jun 11 16:26:15 2018
@@ -39,14 +39,33 @@ class StaticVariableTestCase(TestBase):
                     substrs=['stopped',
                              'stop reason = breakpoint'])
 
-        # global variables are no longer displayed with the "frame variable"
+        # Global variables are no longer displayed with the "frame variable"
         # command.
         self.expect(
             'target variable A::g_points',
             VARIABLES_DISPLAYED_CORRECTLY,
-            patterns=['\(PointType \[[1-9]*\]\) A::g_points = {'])
-        self.expect('target variable g_points', VARIABLES_DISPLAYED_CORRECTLY,
-                    substrs=['(PointType [2]) g_points'])
+            patterns=[
+                '\(PointType \[[1-9]*\]\) A::g_points = {', '(x = 1, y = 2)',
+                '(x = 11, y = 22)'
+            ])
+
+        # Ensure that we take the context into account and only print
+        # A::g_points.
+        self.expect(
+            'target variable A::g_points',
+            VARIABLES_DISPLAYED_CORRECTLY,
+            matching=False,
+            patterns=['(x = 3, y = 4)', '(x = 33, y = 44)'])
+
+        # Finally, ensure that we print both points when not specifying a
+        # context.
+        self.expect(
+            'target variable g_points',
+            VARIABLES_DISPLAYED_CORRECTLY,
+            substrs=[
+                '(PointType [2]) g_points', '(x = 1, y = 2)',
+                '(x = 11, y = 22)', '(x = 3, y = 4)', '(x = 33, y = 44)'
+            ])
 
         # On Mac OS X, gcc 4.2 emits the wrong debug info for A::g_points.
         # A::g_points is an array of two elements.




More information about the lldb-commits mailing list