summaryrefslogtreecommitdiffstats
path: root/lldb/test/lang/c/anonymous/TestAnonymous.py
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2015-09-30 10:12:40 +0000
committerTamas Berghammer <tberghammer@google.com>2015-09-30 10:12:40 +0000
commitc8fd130a2cbf7ade53d05e597f9d48e8c2f37442 (patch)
tree3c9cfb6d1674ee147e83fb80c6ab25e0444ad958 /lldb/test/lang/c/anonymous/TestAnonymous.py
parentebfd72493cc68b085d3feac59f032acb518f4163 (diff)
downloadbcm5719-llvm-c8fd130a2cbf7ade53d05e597f9d48e8c2f37442.tar.gz
bcm5719-llvm-c8fd130a2cbf7ade53d05e597f9d48e8c2f37442.zip
Merge dwarf and dsym tests
Currently most of the test files have a separate dwarf and a separate dsym test with almost identical content (only the build step is different). With adding dwo symbol file handling to the test suit it would increase this to a 3-way duplication. The purpose of this change is to eliminate this redundancy with generating 2 test case (one dwarf and one dsym) for each test function specified (dwo handling will be added at a later commit). Main design goals: * There should be no boilerplate code in each test file to support the multiple debug info in most of the tests (custom scenarios are acceptable in special cases) so adding a new test case is easier and we can't miss one of the debug info type. * In case of a test failure, the debug symbols used during the test run have to be cleanly visible from the output of dotest.py to make debugging easier both from build bot logs and from local test runs * Each test case should have a unique, fully qualified name so we can run exactly 1 test with "-f <test-case>.<test-function>" syntax * Test output should be grouped based on test files the same way as it happens now (displaying dwarf/dsym results separately isn't preferable) Proposed solution (main logic in lldbtest.py, rest of them are test cases fixed up for the new style): * Have only 1 test fuction in the test files what will run for all debug info separately and this test function should call just "self.build(...)" to build an inferior with the right debug info * When a class is created by python (the class object, not the class instance), we will generate a new test method for each debug info format in the test class with the name "<test-function>_<debug-info>" and remove the original test method. This way unittest2 see multiple test methods (1 for each debug info, pretty much as of now) and will handle the test selection and the failure reporting correctly (the debug info will be visible from the end of the test name) * Add new annotation @no_debug_info_test to disable the generation of multiple tests for each debug info format when the test don't have an inferior Differential revision: http://reviews.llvm.org/D13028 llvm-svn: 248883
Diffstat (limited to 'lldb/test/lang/c/anonymous/TestAnonymous.py')
-rw-r--r--lldb/test/lang/c/anonymous/TestAnonymous.py152
1 files changed, 49 insertions, 103 deletions
diff --git a/lldb/test/lang/c/anonymous/TestAnonymous.py b/lldb/test/lang/c/anonymous/TestAnonymous.py
index 6637909d5fc..da0ef5b9f11 100644
--- a/lldb/test/lang/c/anonymous/TestAnonymous.py
+++ b/lldb/test/lang/c/anonymous/TestAnonymous.py
@@ -10,105 +10,9 @@ class AnonymousTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @dsym_test
- def test_expr_nest_with_dsym(self):
- self.buildDsym()
- self.expr_nest()
-
- @dsym_test
- def test_expr_child_with_dsym(self):
- self.buildDsym()
- self.expr_child()
-
- @dsym_test
- def test_expr_grandchild_with_dsym(self):
- self.buildDsym()
- self.expr_grandchild()
-
- @dsym_test
- def test_expr_parent_with_dsym(self):
- self.buildDsym()
- self.expr_parent()
-
- @dsym_test
- def test_expr_null_with_dsym(self):
- self.buildDsym()
- self.expr_null()
-
- @dsym_test
- def test_child_by_name_with_dsym(self):
- self.buildDsym()
- self.child_by_name()
-
@skipIfIcc # llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC
- @dwarf_test
- def test_expr_nest_with_dwarf(self):
- self.buildDwarf()
- self.expr_nest()
-
- @dwarf_test
- def test_expr_child_with_dwarf(self):
- self.buildDwarf()
- self.expr_child()
-
- @skipIfIcc # llvm.org/pr15036: This particular regression was introduced by r181498
- @dwarf_test
- def test_expr_grandchild_with_dwarf(self):
- self.buildDwarf()
- self.expr_grandchild()
-
- @dwarf_test
- def test_expr_parent_with_dwarf(self):
- self.buildDwarf()
- self.expr_parent()
-
- @expectedFailureWindows('llvm.org/pr21550')
- @dwarf_test
- def test_expr_null_with_dwarf(self):
- self.buildDwarf()
- self.expr_null()
-
- @dwarf_test
- def test_child_by_name_with_dwarf(self):
- self.buildDwarf()
- self.child_by_name()
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line numbers to break in main.c.
- self.source = 'main.c'
- self.line0 = line_number(self.source, '// Set breakpoint 0 here.')
- self.line1 = line_number(self.source, '// Set breakpoint 1 here.')
- self.line2 = line_number(self.source, '// Set breakpoint 2 here.')
-
- def common_setup(self, line):
-
- # Set debugger into synchronous mode
- self.dbg.SetAsync(False)
-
- # Create a target
- exe = os.path.join(os.getcwd(), "a.out")
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
-
- # Set breakpoints inside and outside methods that take pointers to the containing struct.
- lldbutil.run_break_set_by_file_and_line (self, self.source, line, num_expected_locations=1, loc_exact=True)
-
- # Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue(process, PROCESS_IS_VALID)
-
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- # The breakpoint should have a hit count of 1.
- self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
-
- def expr_nest(self):
+ def test_expr_nest(self):
+ self.build()
self.common_setup(self.line0)
# These should display correctly.
@@ -118,7 +22,8 @@ class AnonymousTestCase(TestBase):
self.expect("expression n->b", VARIABLES_DISPLAYED_CORRECTLY,
substrs = ["= 2"])
- def expr_child(self):
+ def test_expr_child(self):
+ self.build()
self.common_setup(self.line1)
# These should display correctly.
@@ -128,7 +33,9 @@ class AnonymousTestCase(TestBase):
self.expect("expression c->grandchild.b", VARIABLES_DISPLAYED_CORRECTLY,
substrs = ["= 2"])
- def expr_grandchild(self):
+ @skipIfIcc # llvm.org/pr15036: This particular regression was introduced by r181498
+ def test_expr_grandchild(self):
+ self.build()
self.common_setup(self.line2)
# These should display correctly.
@@ -138,7 +45,8 @@ class AnonymousTestCase(TestBase):
self.expect("expression g.child.b", VARIABLES_DISPLAYED_CORRECTLY,
substrs = ["= 2"])
- def expr_parent(self):
+ def test_expr_parent(self):
+ self.build()
if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
self.skipTest("llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
self.common_setup(self.line2)
@@ -150,7 +58,9 @@ class AnonymousTestCase(TestBase):
self.expect("expression z.y", VARIABLES_DISPLAYED_CORRECTLY,
substrs = ["(type_y) $", "dummy = 2"])
- def expr_null(self):
+ @expectedFailureWindows('llvm.org/pr21550')
+ def test_expr_null(self):
+ self.build()
self.common_setup(self.line2)
# This should fail because pz is 0, but it succeeds on OS/X.
@@ -158,7 +68,8 @@ class AnonymousTestCase(TestBase):
# Note that this can also trigger llvm.org/pr15036 when run interactively at the lldb command prompt.
self.expect("expression *(type_z *)pz", error = True)
- def child_by_name(self):
+ def test_child_by_name(self):
+ self.build()
# Set debugger into synchronous mode
self.dbg.SetAsync(False)
@@ -197,6 +108,41 @@ class AnonymousTestCase(TestBase):
if not error.Success() or value != 0:
self.fail ("failed to get the correct value for element a in n")
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line numbers to break in main.c.
+ self.source = 'main.c'
+ self.line0 = line_number(self.source, '// Set breakpoint 0 here.')
+ self.line1 = line_number(self.source, '// Set breakpoint 1 here.')
+ self.line2 = line_number(self.source, '// Set breakpoint 2 here.')
+
+ def common_setup(self, line):
+
+ # Set debugger into synchronous mode
+ self.dbg.SetAsync(False)
+
+ # Create a target
+ exe = os.path.join(os.getcwd(), "a.out")
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ # Set breakpoints inside and outside methods that take pointers to the containing struct.
+ lldbutil.run_break_set_by_file_and_line (self, self.source, line, num_expected_locations=1, loc_exact=True)
+
+ # Now launch the process, and do not stop at entry point.
+ process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ # The breakpoint should have a hit count of 1.
+ self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+ substrs = [' resolved, hit count = 1'])
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
OpenPOWER on IntegriCloud