diff options
author | Enrico Granata <egranata@apple.com> | 2015-12-18 21:35:21 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2015-12-18 21:35:21 +0000 |
commit | 828eb2173bc57a0f44c15191e09f0fdf33c73044 (patch) | |
tree | 797e5e4b0d5446dba1d052f93c733e753356f2d7 /lldb/packages/Python/lldbsuite/test | |
parent | e242624ca9ba9bea39e2a570817ccf3c1c2e84f2 (diff) | |
download | bcm5719-llvm-828eb2173bc57a0f44c15191e09f0fdf33c73044.tar.gz bcm5719-llvm-828eb2173bc57a0f44c15191e09f0fdf33c73044.zip |
Add a test case that validates that my change in r255603 does the right thing
llvm-svn: 256034
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
3 files changed, 85 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/Makefile new file mode 100644 index 00000000000..314f1cb2f07 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py new file mode 100644 index 00000000000..b7562c4336a --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py @@ -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) + diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/main.cpp new file mode 100644 index 00000000000..ac77e537b80 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/main.cpp @@ -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 +} |