[Lldb-commits] [lldb] r256034 - Add a test case that validates that my change in r255603 does the right thing

Enrico Granata via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 18 13:35:21 PST 2015


Author: enrico
Date: Fri Dec 18 15:35:21 2015
New Revision: 256034

URL: http://llvm.org/viewvc/llvm-project?rev=256034&view=rev
Log:
Add a test case that validates that my change in r255603 does the right thing


Added:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/main.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/Makefile?rev=256034&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/Makefile Fri Dec 18 15:35:21 2015
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py?rev=256034&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py Fri Dec 18 15:35:21 2015
@@ -0,0 +1,60 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+
+import os, time
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+class LanguageCategoryUpdatesTestCase(TestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
+    def setUp(self):
+        # Call super's setUp().
+        TestBase.setUp(self)
+        # Find the line number to break at.
+        self.line = line_number('main.cpp', '// break here')
+
+    @expectedFailureWindows("llvm.org/pr24462") # Data formatters have problems on Windows
+    def test_with_run_command(self):
+        """Test that LLDB correctly cleans caches when language categories change."""
+        # This is the function to remove the custom formats in order to have a
+        # clean slate for the next test case.
+        def cleanup():
+            if hasattr(self, 'type_category') and hasattr(self, 'type_specifier'):
+                self.type_category.DeleteTypeSummary(self.type_specifier)
+
+        # Execute the cleanup function during test case tear down.
+        self.addTearDownHook(cleanup)
+
+        self.build()
+        self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        # The stop reason of the thread should be breakpoint.
+        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+            substrs = ['stopped',
+                       'stop reason = breakpoint'])
+
+        self.expect("frame variable", substrs = ['(S)', 'object', '123', '456'], matching=True)
+        
+        self.type_category = self.dbg.GetCategory(lldb.eLanguageTypeC_plus_plus)
+        type_summary = lldb.SBTypeSummary.CreateWithSummaryString("this is an object of type S")
+        self.type_specifier = lldb.SBTypeNameSpecifier('S')
+        self.type_category.AddTypeSummary(self.type_specifier, type_summary)
+
+        self.expect("frame variable", substrs = ['this is an object of type S'], matching=True)
+        
+        self.type_category.DeleteTypeSummary(self.type_specifier)
+        self.expect("frame variable", substrs = ['this is an object of type S'], matching=False)
+        self.expect("frame variable", substrs = ['(S)', 'object', '123', '456'], matching=True)
+

Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/main.cpp?rev=256034&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/main.cpp (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/main.cpp Fri Dec 18 15:35:21 2015
@@ -0,0 +1,20 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+struct S {
+  int x;
+  int y;
+  
+  S() : x(123), y(456) {}
+};
+
+int main() {
+  S object;
+  return 0; // break here
+}




More information about the lldb-commits mailing list