diff options
Diffstat (limited to 'lldb/test/lang/cpp')
31 files changed, 231 insertions, 787 deletions
diff --git a/lldb/test/lang/cpp/bool/TestCPPBool.py b/lldb/test/lang/cpp/bool/TestCPPBool.py index fc1c57416e9..913821733c1 100644 --- a/lldb/test/lang/cpp/bool/TestCPPBool.py +++ b/lldb/test/lang/cpp/bool/TestCPPBool.py @@ -9,32 +9,13 @@ class CPPBoolTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Test that bool types work in the expression parser""" - self.buildDsym() - self.static_method_commands() - - @dwarf_test - def test_with_dwarf_and_run_command(self): - """Test that bool types work in the expression parser""" - self.buildDwarf() - self.static_method_commands() - - def setUp(self): - TestBase.setUp(self) - - def set_breakpoint(self, line): - # Some compilers (for example GCC 4.4.7 and 4.6.1) emit multiple locations for the statement with the ternary - # operator in the test program, while others emit only 1. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False) - - def static_method_commands(self): + def test_with_run_command(self): """Test that bool types work in the expression parser""" + self.build() self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) - self.set_breakpoint(line_number('main.cpp', '// breakpoint 1')) + line = line_number('main.cpp', '// breakpoint 1') + lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False) self.runCmd("process launch", RUN_SUCCEEDED) diff --git a/lldb/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py b/lldb/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py index e38bd463c15..851b3430e48 100644 --- a/lldb/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py +++ b/lldb/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py @@ -11,25 +11,9 @@ class CPPBreakpointCommandsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test a sequence of breakpoint command add, list, and delete.""" - self.buildDsym() - self.cpp_breakpoints() - - @dwarf_test - def test_with_dwarf(self): - """Test a sequence of breakpoint command add, list, and delete.""" - self.buildDwarf() - self.cpp_breakpoints() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def cpp_breakpoints (self): + def test(self): """Test a sequence of breakpoint command add, list, and delete.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") # Create a target from the debugger. diff --git a/lldb/test/lang/cpp/call-function/TestCallCPPFunction.py b/lldb/test/lang/cpp/call-function/TestCallCPPFunction.py index 2db9e694280..6adbcd6f790 100644 --- a/lldb/test/lang/cpp/call-function/TestCallCPPFunction.py +++ b/lldb/test/lang/cpp/call-function/TestCallCPPFunction.py @@ -10,26 +10,14 @@ class CallCPPFunctionTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Test calling a function by basename""" - self.buildDsym() - self.call_cpp_function() - - @dwarf_test - @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") - def test_with_dwarf_and_run_command(self): - """Test calling a function by basename""" - self.buildDwarf() - self.call_cpp_function() - def setUp(self): TestBase.setUp(self) self.line = line_number('main.cpp', '// breakpoint') - def call_cpp_function(self): + @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") + def test_with_run_command(self): """Test calling a function by basename""" + 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) diff --git a/lldb/test/lang/cpp/chained-calls/TestCppChainedCalls.py b/lldb/test/lang/cpp/chained-calls/TestCppChainedCalls.py index 5a85c416128..a6cf56cd6f6 100644 --- a/lldb/test/lang/cpp/chained-calls/TestCppChainedCalls.py +++ b/lldb/test/lang/cpp/chained-calls/TestCppChainedCalls.py @@ -6,22 +6,10 @@ class TestCppChainedCalls(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - self.buildDsym() - self.check() - - @dwarf_test @expectedFailureWindows("llvm.org/pr21765") - def test_with_dwarf_and_run_command(self): - self.buildDwarf() - self.check() - - def setUp(self): - TestBase.setUp(self) + def test_with_run_command(self): + self.build() - def check(self): # Get main source file src_file = "main.cpp" src_file_spec = lldb.SBFileSpec(src_file) diff --git a/lldb/test/lang/cpp/char1632_t/TestChar1632T.py b/lldb/test/lang/cpp/char1632_t/TestChar1632T.py index e415d837e12..f604c34516d 100644 --- a/lldb/test/lang/cpp/char1632_t/TestChar1632T.py +++ b/lldb/test/lang/cpp/char1632_t/TestChar1632T.py @@ -13,21 +13,6 @@ class Char1632TestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test that the C++11 support for char16_t and char32_t works correctly.""" - self.buildDsym() - self.char1632() - - @expectedFailureIcc # ICC (13.1) does not emit the DW_TAG_base_type for char16_t and char32_t. - @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") - @dwarf_test - def test_with_dwarf(self): - """Test that the C++11 support for char16_t and char32_t works correctly.""" - self.buildDwarf() - self.char1632() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -35,8 +20,12 @@ class Char1632TestCase(TestBase): self.source = 'main.cpp' self.lines = [ line_number(self.source, '// breakpoint1'), line_number(self.source, '// breakpoint2') ] - def char1632(self): + + @expectedFailureIcc # ICC (13.1) does not emit the DW_TAG_base_type for char16_t and char32_t. + @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") + def test(self): """Test that the C++11 support for char16_t and char32_t works correctly.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") # Create a target by the debugger. diff --git a/lldb/test/lang/cpp/class_static/TestStaticVariables.py b/lldb/test/lang/cpp/class_static/TestStaticVariables.py index 25bf9d8232f..88aeb72a799 100644 --- a/lldb/test/lang/cpp/class_static/TestStaticVariables.py +++ b/lldb/test/lang/cpp/class_static/TestStaticVariables.py @@ -11,42 +11,6 @@ import lldbutil class StaticVariableTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - failing_compilers = ['clang', 'gcc'] - - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Test that file and class static variables display correctly.""" - self.buildDsym() - self.static_variable_commands() - - @expectedFailureWindows("llvm.org/pr24764") - @dwarf_test - def test_with_dwarf_and_run_command(self): - """Test that file and class static variables display correctly.""" - self.buildDwarf() - self.static_variable_commands() - - @skipUnlessDarwin - @expectedFailureClang(9980907) - @expectedFailureGcc(9980907) - @python_api_test - @dsym_test - def test_with_dsym_and_python_api(self): - """Test Python APIs on file and class static variables.""" - self.buildDsym() - self.static_variable_python() - - @expectedFailureDarwin(9980907) - @expectedFailureClang('Clang emits incomplete debug info.') - @expectedFailureFreeBSD('llvm.org/pr20550 failing on FreeBSD-11') - @expectedFailureGcc('GCC emits incomplete debug info.') - @python_api_test - @dwarf_test - def test_with_dwarf_and_python_api(self): - """Test Python APIs on file and class static variables.""" - self.buildDwarf() - self.static_variable_python() def setUp(self): # Call super's setUp(). @@ -54,8 +18,10 @@ class StaticVariableTestCase(TestBase): # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') - def static_variable_commands(self): - """Test that that file and class static variables display correctly.""" + @expectedFailureWindows("llvm.org/pr24764") + def test_with_run_command(self): + """Test that file and class static variables display correctly.""" + 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) @@ -79,8 +45,14 @@ class StaticVariableTestCase(TestBase): self.expect("target variable A::g_points[1].x", VARIABLES_DISPLAYED_CORRECTLY, startstr = "(int) A::g_points[1].x = 11") - def static_variable_python(self): + @expectedFailureDarwin(9980907) + @expectedFailureClang('Clang emits incomplete debug info.') + @expectedFailureFreeBSD('llvm.org/pr20550 failing on FreeBSD-11') + @expectedFailureGcc('GCC emits incomplete debug info.') + @python_api_test + def test_with_python_api(self): """Test Python APIs on file and class static variables.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") target = self.dbg.CreateTarget(exe) diff --git a/lldb/test/lang/cpp/class_types/TestClassTypes.py b/lldb/test/lang/cpp/class_types/TestClassTypes.py index c0b8a249684..2e9353b5b65 100644 --- a/lldb/test/lang/cpp/class_types/TestClassTypes.py +++ b/lldb/test/lang/cpp/class_types/TestClassTypes.py @@ -11,79 +11,15 @@ class ClassTypesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Test 'frame variable this' when stopped on a class constructor.""" - self.buildDsym() - self.class_types() - - @skipUnlessDarwin - @python_api_test - @dsym_test - def test_with_dsym_and_python_api(self): - """Use Python APIs to create a breakpoint by (filespec, line).""" - self.buildDsym() - self.breakpoint_creation_by_filespec_python() - - # rdar://problem/8378863 - # "frame variable this" returns - # error: unable to find any variables named 'this' - @dwarf_test - def test_with_dwarf_and_run_command(self): - """Test 'frame variable this' when stopped on a class constructor.""" - self.buildDwarf() - self.class_types() - - @python_api_test - @dwarf_test - def test_with_dwarf_and_python_api(self): - """Use Python APIs to create a breakpoint by (filespec, line).""" - self.buildDwarf() - self.breakpoint_creation_by_filespec_python() - - @skipUnlessDarwin - # rdar://problem/8557478 - # test/class_types test failures: runCmd: expr this->m_c_int - @dsym_test - def test_with_dsym_and_expr_parser(self): - """Test 'frame variable this' and 'expr this' when stopped inside a constructor.""" - self.buildDsym() - self.class_types_expr_parser() - - # rdar://problem/8557478 - # test/class_types test failures: runCmd: expr this->m_c_int - @dwarf_test - def test_with_dwarf_and_expr_parser(self): - """Test 'frame variable this' and 'expr this' when stopped inside a constructor.""" - self.buildDwarf() - self.class_types_expr_parser() - - @skipUnlessDarwin - # rdar://problem/8557478 - # test/class_types test failures: runCmd: expr this->m_c_int - @dsym_test - def test_with_dsym_and_constructor_name(self): - """Test 'frame variable this' and 'expr this' when stopped inside a constructor.""" - self.buildDsym() - self.class_types_constructor_name() - - # rdar://problem/8557478 - # test/class_types test failures: runCmd: expr this->m_c_int - @dwarf_test - def test_with_dwarf_and_constructor_name (self): - """Test 'frame variable this' and 'expr this' when stopped inside a constructor.""" - self.buildDwarf() - self.class_types_constructor_name() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) # Find the line number to break for main.cpp. self.line = line_number('main.cpp', '// Set break point at this line.') - def class_types(self): + def test_with_run_command(self): """Test 'frame variable this' when stopped on a class constructor.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) @@ -113,8 +49,10 @@ class ClassTypesTestCase(TestBase): substrs = ['C *', ' this = ']) - def breakpoint_creation_by_filespec_python(self): + @python_api_test + def test_with_python_api(self): """Use Python APIs to create a breakpoint by (filespec, line).""" + self.build() exe = os.path.join(os.getcwd(), "a.out") target = self.dbg.CreateTarget(exe) @@ -171,8 +109,9 @@ class ClassTypesTestCase(TestBase): process.Continue() - def class_types_expr_parser(self): + def test_with_expr_parser(self): """Test 'frame variable this' and 'expr this' when stopped inside a constructor.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) @@ -222,9 +161,9 @@ class ClassTypesTestCase(TestBase): self.expect("expression this->m_c_int", VARIABLES_DISPLAYED_CORRECTLY, patterns = ['\(int\) \$[0-9]+ = 66']) - - def class_types_constructor_name (self): - """Check whether the constructor name has the class name prepended.""" + def test_with_constructor_name (self): + """Test 'frame variable this' and 'expr this' when stopped inside a constructor.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") target = self.dbg.CreateTarget(exe) diff --git a/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py b/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py index 2e401147591..866b100cbf5 100644 --- a/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py +++ b/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py @@ -11,66 +11,10 @@ import lldbutil class IterateFrameAndDisassembleTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - failing_compilers = ['clang', 'gcc'] - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Disassemble each call frame when stopped on C's constructor.""" - self.buildDsym() - self.disassemble_call_stack() - - @dwarf_test - def test_with_dwarf_and_run_command(self): - """Disassemble each call frame when stopped on C's constructor.""" - self.buildDwarf() - self.disassemble_call_stack() - - @skipUnlessDarwin - @python_api_test - @dsym_test - def test_with_dsym_and_python_api(self): - """Disassemble each call frame when stopped on C's constructor.""" - self.buildDsym() - self.disassemble_call_stack_python() - - @python_api_test - @dwarf_test - def test_with_dwarf_and_python_api(self): - """Disassemble each call frame when stopped on C's constructor.""" - self.buildDwarf() - self.disassemble_call_stack_python() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break for main.cpp. - self.line = line_number('main.cpp', '// Set break point at this line.') - - def breakOnCtor(self): - """Setup/run the program so it stops on C's constructor.""" - exe = os.path.join(os.getcwd(), "a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break on the ctor function of class C. - bpno = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1) - - 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 %d.'%(bpno)]) - - # This test was failing because we fail to put the C:: in front of constructore. - # We should maybe make another testcase to cover that specifically, but we shouldn't - # fail this whole testcase for an inessential issue. - # We should be stopped on the ctor function of class C. - # self.expect("thread backtrace", BACKTRACE_DISPLAYED_CORRECTLY, - # substrs = ['C::C']) - - def disassemble_call_stack(self): + def test_and_run_command(self): """Disassemble each call frame when stopped on C's constructor.""" + self.build() self.breakOnCtor() raw_output = self.res.GetOutput() @@ -89,8 +33,10 @@ class IterateFrameAndDisassembleTestCase(TestBase): #print "function:", function self.runCmd("disassemble -n '%s'" % function) - def disassemble_call_stack_python(self): + @python_api_test + def test_and_python_api(self): """Disassemble each call frame when stopped on C's constructor.""" + self.build() self.breakOnCtor() # Now use the Python API to get at each function on the call stack and @@ -116,6 +62,33 @@ class IterateFrameAndDisassembleTestCase(TestBase): if self.TraceOn(): print disasm + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + # Find the line number to break for main.cpp. + self.line = line_number('main.cpp', '// Set break point at this line.') + + def breakOnCtor(self): + """Setup/run the program so it stops on C's constructor.""" + exe = os.path.join(os.getcwd(), "a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + + # Break on the ctor function of class C. + bpno = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1) + + 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 %d.'%(bpno)]) + + # This test was failing because we fail to put the C:: in front of constructore. + # We should maybe make another testcase to cover that specifically, but we shouldn't + # fail this whole testcase for an inessential issue. + # We should be stopped on the ctor function of class C. + # self.expect("thread backtrace", BACKTRACE_DISPLAYED_CORRECTLY, + # substrs = ['C::C']) if __name__ == '__main__': import atexit diff --git a/lldb/test/lang/cpp/diamond/TestDiamond.py b/lldb/test/lang/cpp/diamond/TestDiamond.py index b1c838c2556..308fb13accf 100644 --- a/lldb/test/lang/cpp/diamond/TestDiamond.py +++ b/lldb/test/lang/cpp/diamond/TestDiamond.py @@ -9,31 +9,10 @@ class CPPTestDiamondInheritance(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Test that virtual base classes work in when SBValue objects are used to explore the variable value""" - self.buildDsym() - self.diamong_inheritace() - - @dwarf_test @expectedFailureWindows("llvm.org/pr24764") - def test_with_dwarf_and_run_command(self): - """Test that virtual base classes work in when SBValue objects are used to explore the variable value""" - self.buildDwarf() - self.diamong_inheritace() - - def setUp(self): - TestBase.setUp(self) - - def set_breakpoint(self, line): - # Some compilers (for example GCC 4.4.7 and 4.6.1) emit multiple locations for the statement with the ternary - # operator in the test program, while others emit only 1. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False) - - def diamong_inheritace(self): + def test_with_run_command(self): """Test that virtual base classes work in when SBValue objects are used to explore the variable value""" - + self.build() exe = os.path.join(os.getcwd(), "a.out") target = self.dbg.CreateTarget(exe) @@ -56,6 +35,11 @@ class CPPTestDiamondInheritance(TestBase): self.assertTrue(frame.FindVariable("d").GetChildAtIndex(0).GetChildAtIndex(0).GetValueAsUnsigned(0) == 12345, "ensure Derived2 from j1 is correct"); thread.StepOver() self.assertTrue(frame.FindVariable("d").GetChildAtIndex(0).GetChildAtIndex(0).GetValueAsUnsigned(0) == 12346, "ensure Derived2 from j2 is correct"); + + def set_breakpoint(self, line): + # Some compilers (for example GCC 4.4.7 and 4.6.1) emit multiple locations for the statement with the ternary + # operator in the test program, while others emit only 1. + lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False) if __name__ == '__main__': import atexit diff --git a/lldb/test/lang/cpp/dynamic-value/TestCppValueCast.py b/lldb/test/lang/cpp/dynamic-value/TestCppValueCast.py index 23a9fc503b8..431f19f7ae4 100644 --- a/lldb/test/lang/cpp/dynamic-value/TestCppValueCast.py +++ b/lldb/test/lang/cpp/dynamic-value/TestCppValueCast.py @@ -13,38 +13,17 @@ class CppValueCastTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @unittest2.expectedFailure("rdar://problem/10808472 SBValue::Cast test case is failing (virtual inheritance)") - @skipUnlessDarwin @python_api_test - @dsym_test - def test_value_cast_with_dsym_and_virtual_inheritance(self): + def test_value_cast_with_virtual_inheritance(self): """Test SBValue::Cast(SBType) API for C++ types with virtual inheritance.""" - self.buildDsym(dictionary=self.d_virtual) + self.build(dictionary=self.d_virtual) self.setTearDownCleanup(dictionary=self.d_virtual) self.do_sbvalue_cast(self.exe_name) - @unittest2.expectedFailure("rdar://problem/10808472 SBValue::Cast test case is failing (virtual inheritance)") - @python_api_test - @dwarf_test - def test_value_cast_with_dwarf_and_virtual_inheritance(self): - """Test SBValue::Cast(SBType) API for C++ types with virtual inheritance.""" - self.buildDwarf(dictionary=self.d_virtual) - self.setTearDownCleanup(dictionary=self.d_virtual) - self.do_sbvalue_cast(self.exe_name) - - @skipUnlessDarwin - @python_api_test - @dsym_test - def test_value_cast_with_dsym_and_regular_inheritance(self): - """Test SBValue::Cast(SBType) API for C++ types with regular inheritance.""" - self.buildDsym(dictionary=self.d_regular) - self.setTearDownCleanup(dictionary=self.d_regular) - self.do_sbvalue_cast(self.exe_name) - @python_api_test - @dwarf_test - def test_value_cast_with_dwarf_and_regular_inheritance(self): + def test_value_cast_with_regular_inheritance(self): """Test SBValue::Cast(SBType) API for C++ types with regular inheritance.""" - self.buildDwarf(dictionary=self.d_regular) + self.build(dictionary=self.d_regular) self.setTearDownCleanup(dictionary=self.d_regular) self.do_sbvalue_cast(self.exe_name) diff --git a/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py b/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py index 838c7df439d..f7f9e67a014 100644 --- a/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py +++ b/lldb/test/lang/cpp/dynamic-value/TestDynamicValue.py @@ -12,23 +12,6 @@ class DynamicValueTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @python_api_test - @dsym_test - def test_get_dynamic_vals_with_dsym(self): - """Test fetching C++ dynamic values from pointers & references.""" - self.buildDsym(dictionary=self.getBuildFlags()) - self.do_get_dynamic_vals() - - @expectedFailureFreeBSD # FIXME: This needs to be root-caused. - @expectedFailureWindows("llvm.org/pr24663") - @python_api_test - @dwarf_test - def test_get_dynamic_vals_with_dwarf(self): - """Test fetching C++ dynamic values from pointers & references.""" - self.buildDwarf(dictionary=self.getBuildFlags()) - self.do_get_dynamic_vals() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -41,66 +24,12 @@ class DynamicValueTestCase(TestBase): self.main_second_call_line = line_number('pass-to-base.cpp', '// Break here and get real address of reallyA.') - - def examine_value_object_of_this_ptr (self, this_static, this_dynamic, dynamic_location): - - # Get "this" as its static value - - self.assertTrue (this_static) - this_static_loc = int (this_static.GetValue(), 16) - - # Get "this" as its dynamic value - - self.assertTrue (this_dynamic) - this_dynamic_typename = this_dynamic.GetTypeName() - self.assertTrue (this_dynamic_typename.find('B') != -1) - this_dynamic_loc = int (this_dynamic.GetValue(), 16) - - # Make sure we got the right address for "this" - - self.assertTrue (this_dynamic_loc == dynamic_location) - - # And that the static address is greater than the dynamic one - - self.assertTrue (this_static_loc > this_dynamic_loc) - - # Now read m_b_value which is only in the dynamic value: - - use_dynamic = lldb.eDynamicCanRunTarget - no_dynamic = lldb.eNoDynamicValues - - this_dynamic_m_b_value = this_dynamic.GetChildMemberWithName('m_b_value', use_dynamic) - self.assertTrue (this_dynamic_m_b_value) - - m_b_value = int (this_dynamic_m_b_value.GetValue(), 0) - self.assertTrue (m_b_value == 10) - - # Make sure it is not in the static version - - this_static_m_b_value = this_static.GetChildMemberWithName('m_b_value', no_dynamic) - self.assertFalse (this_static_m_b_value) - - # Okay, now let's make sure that we can get the dynamic type of a child element: - - contained_auto_ptr = this_dynamic.GetChildMemberWithName ('m_client_A', use_dynamic) - self.assertTrue (contained_auto_ptr) - contained_b = contained_auto_ptr.GetChildMemberWithName ('_M_ptr', use_dynamic) - if not contained_b: - contained_b = contained_auto_ptr.GetChildMemberWithName ('__ptr_', use_dynamic) - self.assertTrue (contained_b) - - contained_b_static = contained_auto_ptr.GetChildMemberWithName ('_M_ptr', no_dynamic) - if not contained_b_static: - contained_b_static = contained_auto_ptr.GetChildMemberWithName ('__ptr_', no_dynamic) - self.assertTrue (contained_b_static) - - contained_b_addr = int (contained_b.GetValue(), 16) - contained_b_static_addr = int (contained_b_static.GetValue(), 16) - - self.assertTrue (contained_b_addr < contained_b_static_addr) - - def do_get_dynamic_vals(self): - """Get argument vals for the call stack when stopped on a breakpoint.""" + @expectedFailureFreeBSD # FIXME: This needs to be root-caused. + @expectedFailureWindows("llvm.org/pr24663") + @python_api_test + def test_get_dynamic_vals(self): + """Test fetching C++ dynamic values from pointers & references.""" + self.build(dictionary=self.getBuildFlags()) exe = os.path.join(os.getcwd(), "a.out") # Create a target from the debugger. @@ -234,6 +163,62 @@ class DynamicValueTestCase(TestBase): self.assertTrue (anotherA_loc == reallyA_loc) self.assertTrue (anotherA_value.GetTypeName().find ('B') == -1) + def examine_value_object_of_this_ptr (self, this_static, this_dynamic, dynamic_location): + # Get "this" as its static value + self.assertTrue (this_static) + this_static_loc = int (this_static.GetValue(), 16) + + # Get "this" as its dynamic value + + self.assertTrue (this_dynamic) + this_dynamic_typename = this_dynamic.GetTypeName() + self.assertTrue (this_dynamic_typename.find('B') != -1) + this_dynamic_loc = int (this_dynamic.GetValue(), 16) + + # Make sure we got the right address for "this" + + self.assertTrue (this_dynamic_loc == dynamic_location) + + # And that the static address is greater than the dynamic one + + self.assertTrue (this_static_loc > this_dynamic_loc) + + # Now read m_b_value which is only in the dynamic value: + + use_dynamic = lldb.eDynamicCanRunTarget + no_dynamic = lldb.eNoDynamicValues + + this_dynamic_m_b_value = this_dynamic.GetChildMemberWithName('m_b_value', use_dynamic) + self.assertTrue (this_dynamic_m_b_value) + + m_b_value = int (this_dynamic_m_b_value.GetValue(), 0) + self.assertTrue (m_b_value == 10) + + # Make sure it is not in the static version + + this_static_m_b_value = this_static.GetChildMemberWithName('m_b_value', no_dynamic) + self.assertFalse (this_static_m_b_value) + + # Okay, now let's make sure that we can get the dynamic type of a child element: + + contained_auto_ptr = this_dynamic.GetChildMemberWithName ('m_client_A', use_dynamic) + self.assertTrue (contained_auto_ptr) + contained_b = contained_auto_ptr.GetChildMemberWithName ('_M_ptr', use_dynamic) + if not contained_b: + contained_b = contained_auto_ptr.GetChildMemberWithName ('__ptr_', use_dynamic) + self.assertTrue (contained_b) + + contained_b_static = contained_auto_ptr.GetChildMemberWithName ('_M_ptr', no_dynamic) + if not contained_b_static: + contained_b_static = contained_auto_ptr.GetChildMemberWithName ('__ptr_', no_dynamic) + self.assertTrue (contained_b_static) + + contained_b_addr = int (contained_b.GetValue(), 16) + contained_b_static_addr = int (contained_b_static.GetValue(), 16) + + self.assertTrue (contained_b_addr < contained_b_static_addr) + + if __name__ == '__main__': import atexit lldb.SBDebugger.Initialize() diff --git a/lldb/test/lang/cpp/enum_types/TestCPP11EnumTypes.py b/lldb/test/lang/cpp/enum_types/TestCPP11EnumTypes.py index 014a441625d..e8072efa8b2 100644 --- a/lldb/test/lang/cpp/enum_types/TestCPP11EnumTypes.py +++ b/lldb/test/lang/cpp/enum_types/TestCPP11EnumTypes.py @@ -10,108 +10,44 @@ class CPP11EnumTypesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_int8_t(self): + def test_int8_t(self): """Test C++11 enumeration class types as int8_t types.""" - self.buildDsym(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int8_t"'}) + self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int8_t"'}) self.image_lookup_for_enum_type() - @skipUnlessDarwin - @dsym_test - def test_with_dsym_int16_t(self): + def test_int16_t(self): """Test C++11 enumeration class types as int16_t types.""" - self.buildDsym(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int16_t"'}) + self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int16_t"'}) self.image_lookup_for_enum_type() - @skipUnlessDarwin - @dsym_test - def test_with_dsym_int32_t(self): + def test_int32_t(self): """Test C++11 enumeration class types as int32_t types.""" - self.buildDsym(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int32_t"'}) + self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int32_t"'}) self.image_lookup_for_enum_type() - @skipUnlessDarwin - @dsym_test - def test_with_dsym_int64_t(self): + def test_int64_t(self): """Test C++11 enumeration class types as int64_t types.""" - self.buildDsym(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int64_t"'}) + self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int64_t"'}) self.image_lookup_for_enum_type() - @skipUnlessDarwin - @dsym_test - def test_with_dsym_uint8_t(self): + def test_uint8_t(self): """Test C++11 enumeration class types as uint8_t types.""" - self.buildDsym(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint8_t"'}) + self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint8_t"'}) self.image_lookup_for_enum_type() - @skipUnlessDarwin - @dsym_test - def test_with_dsym_uint16_t(self): + def test_uint16_t(self): """Test C++11 enumeration class types as uint16_t types.""" - self.buildDsym(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint16_t"'}) + self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint16_t"'}) self.image_lookup_for_enum_type() - @skipUnlessDarwin - @dsym_test - def test_with_dsym_uint32_t(self): + def test_uint32_t(self): """Test C++11 enumeration class types as uint32_t types.""" - self.buildDsym(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint32_t"'}) + self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint32_t"'}) self.image_lookup_for_enum_type() - @skipUnlessDarwin - @dsym_test - def test_with_dsym_uint64_t(self): + def test_uint64_t(self): """Test C++11 enumeration class types as uint64_t types.""" - self.buildDsym(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint64_t"'}) - self.image_lookup_for_enum_type() - - @dwarf_test - def test_with_dwarf_int8_t(self): - """Test C++11 enumeration class types as int8_t types.""" - self.buildDwarf(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int8_t"'}) - self.image_lookup_for_enum_type() - - @dwarf_test - def test_with_dwarf_int16_t(self): - """Test C++11 enumeration class types as int16_t types.""" - self.buildDwarf(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int16_t"'}) - self.image_lookup_for_enum_type() - - @dwarf_test - def test_with_dwarf_int32_t(self): - """Test C++11 enumeration class types as int32_t types.""" - self.buildDwarf(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int32_t"'}) - self.image_lookup_for_enum_type() - - @dwarf_test - def test_with_dwarf_int64_t(self): - """Test C++11 enumeration class types as int64_t types.""" - self.buildDwarf(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int64_t"'}) - self.image_lookup_for_enum_type() - - @dwarf_test - def test_with_dwarf_uint8_t(self): - """Test C++11 enumeration class types as uint8_t types.""" - self.buildDwarf(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint8_t"'}) - self.image_lookup_for_enum_type() - - @dwarf_test - def test_with_dwarf_uint16_t(self): - """Test C++11 enumeration class types as uint16_t types.""" - self.buildDwarf(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint16_t"'}) - self.image_lookup_for_enum_type() - - @dwarf_test - def test_with_dwarf_uint32_t(self): - """Test C++11 enumeration class types as uint32_t types.""" - self.buildDwarf(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint32_t"'}) - self.image_lookup_for_enum_type() - - @dwarf_test - def test_with_dwarf_uint64_t(self): - """Test C++11 enumeration class types as uint64_t types.""" - self.buildDwarf(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint64_t"'}) + self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint64_t"'}) self.image_lookup_for_enum_type() def setUp(self): diff --git a/lldb/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py b/lldb/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py index c7af66062eb..cc6805e8dc1 100644 --- a/lldb/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py +++ b/lldb/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py @@ -12,28 +12,16 @@ class CPPBreakpointTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test lldb exception breakpoint command for CPP.""" - self.buildDsym() - self.cpp_exceptions() - - @dwarf_test - @expectedFailureWindows("llvm.org/pr24538") # clang-cl does not support throw or catch - def test_with_dwarf(self): - """Test lldb exception breakpoint command for CPP.""" - self.buildDwarf() - self.cpp_exceptions() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) self.source = 'exceptions.cpp' self.catch_line = line_number(self.source, '// This is the line you should stop at for catch') - def cpp_exceptions (self): + @expectedFailureWindows("llvm.org/pr24538") # clang-cl does not support throw or catch + def test(self): """Test lldb exception breakpoint command for CPP.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") # Create a target from the debugger. @@ -73,8 +61,7 @@ class CPPBreakpointTestCase(TestBase): self.assertTrue (frame_functions.count ("intervening_function(int)") == 0, "At catch our intervening function is off the stack") self.assertTrue (frame_functions.count ("catches_exception(int)") == 1, "At catch our catch function is on the stack") - - + if __name__ == '__main__': import atexit lldb.SBDebugger.Initialize() diff --git a/lldb/test/lang/cpp/global_operators/TestCppGlobalOperators.py b/lldb/test/lang/cpp/global_operators/TestCppGlobalOperators.py index 9ea49d6133e..6299116d19a 100644 --- a/lldb/test/lang/cpp/global_operators/TestCppGlobalOperators.py +++ b/lldb/test/lang/cpp/global_operators/TestCppGlobalOperators.py @@ -9,22 +9,10 @@ class TestCppGlobalOperators(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - self.buildDsym() - self.check() - - @dwarf_test @expectedFailureWindows("llvm.org/pr21765") - def test_with_dwarf_and_run_command(self): - self.buildDwarf() - self.check() - - def setUp(self): - TestBase.setUp(self) + def test_with_run_command(self): + self.build() - def check(self): # Get main source file src_file = "main.cpp" src_file_spec = lldb.SBFileSpec(src_file) diff --git a/lldb/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py b/lldb/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py index 090709242e8..3ea22f0b279 100644 --- a/lldb/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py +++ b/lldb/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py @@ -6,10 +6,9 @@ class TestCppIncompleteTypes(TestBase): mydir = TestBase.compute_mydir(__file__) - @dwarf_test @skipIfGcc - def test_with_dwarf_limit_debug_info(self): - self.buildDwarf() + def test_limit_debug_info(self): + self.build() frame = self.get_test_frame('limit') value_f = frame.EvaluateExpression("f") @@ -20,10 +19,9 @@ class TestCppIncompleteTypes(TestBase): self.assertTrue(value_a.IsValid(), "'expr a' results in a valid SBValue object") self.assertFalse(value_a.GetError().Success(), "'expr a' results in an error, but LLDB does not crash") - @dwarf_test @skipIfGcc - def test_with_dwarf_partial_limit_debug_info(self): - self.buildDwarf() + def test_partial_limit_debug_info(self): + self.build() frame = self.get_test_frame('nolimit') value_f = frame.EvaluateExpression("f") @@ -34,9 +32,6 @@ class TestCppIncompleteTypes(TestBase): self.assertTrue(value_a.IsValid(), "'expr a' results in a valid SBValue object") self.assertTrue(value_a.GetError().Success(), "'expr a' is successful") - def setUp(self): - TestBase.setUp(self) - def get_test_frame(self, exe): # Get main source file src_file = "main.cpp" diff --git a/lldb/test/lang/cpp/namespace/TestNamespace.py b/lldb/test/lang/cpp/namespace/TestNamespace.py index 5a71398c739..fd598813e83 100644 --- a/lldb/test/lang/cpp/namespace/TestNamespace.py +++ b/lldb/test/lang/cpp/namespace/TestNamespace.py @@ -12,22 +12,6 @@ class NamespaceTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - # rdar://problem/8668674 - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Test that anonymous and named namespace variables display correctly.""" - self.buildDsym() - self.namespace_variable_commands() - - # rdar://problem/8668674 - @expectedFailureWindows("llvm.org/pr24764") - @dwarf_test - def test_with_dwarf_and_run_command(self): - """Test that anonymous and named namespace variables display correctly.""" - self.buildDwarf() - self.namespace_variable_commands() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -40,8 +24,11 @@ class NamespaceTestCase(TestBase): self.line_break = line_number('main.cpp', '// Set break point at this line.') - def namespace_variable_commands(self): + # rdar://problem/8668674 + @expectedFailureWindows("llvm.org/pr24764") + def test_with_run_command(self): """Test that anonymous and named namespace variables display correctly.""" + self.build() self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line_break, num_expected_locations=1, loc_exact=True) diff --git a/lldb/test/lang/cpp/nsimport/TestCppNsImport.py b/lldb/test/lang/cpp/nsimport/TestCppNsImport.py index 64a1b103451..076356dd162 100644 --- a/lldb/test/lang/cpp/nsimport/TestCppNsImport.py +++ b/lldb/test/lang/cpp/nsimport/TestCppNsImport.py @@ -9,25 +9,10 @@ class TestCppNsImport(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Tests imported namespaces in C++.""" - self.buildDsym() - self.check() - - @dwarf_test @expectedFailureGcc(None, ['>=', '4.9']) - def test_with_dwarf_and_run_command(self): - """Tests imported namespaces in C++.""" - self.buildDwarf() - self.check() - - def setUp(self): - TestBase.setUp(self) - - def check(self): + def test_with_run_command(self): """Tests imported namespaces in C++.""" + self.build() # Get main source file src_file = "main.cpp" diff --git a/lldb/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py b/lldb/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py index af5a016bd84..38cec0f472e 100644 --- a/lldb/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py +++ b/lldb/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py @@ -10,26 +10,14 @@ class CPPStaticMethodsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Test that functions with the same name are resolved correctly""" - self.buildDsym() - self.static_method_commands() - - @dwarf_test - @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") - def test_with_dwarf_and_run_command(self): - """Test that functions with the same name are resolved correctly""" - self.buildDwarf() - self.static_method_commands() - def setUp(self): TestBase.setUp(self) self.line = line_number('main.cpp', '// breakpoint') - - def static_method_commands(self): - """Test that static methods are properly distinguished from regular methods""" + + @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") + def test_with_run_command(self): + """Test that functions with the same name are resolved correctly""" + 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) diff --git a/lldb/test/lang/cpp/rdar12991846/TestRdar12991846.py b/lldb/test/lang/cpp/rdar12991846/TestRdar12991846.py index dc80a9d1662..23bf8a122c6 100644 --- a/lldb/test/lang/cpp/rdar12991846/TestRdar12991846.py +++ b/lldb/test/lang/cpp/rdar12991846/TestRdar12991846.py @@ -27,51 +27,24 @@ class Rdar12991846TestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @unittest2.expectedFailure("rdar://18684408") - @skipUnlessDarwin - @dsym_test - def test_expr1_with_dsym(self): - """Test that the expression parser returns proper Unicode strings.""" - self.buildDsym() - self.rdar12991846(expr=1) - - @unittest2.expectedFailure("rdar://18684408") @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") - @dwarf_test - def test_expr1_with_dwarf(self): + def test_expr1(self): """Test that the expression parser returns proper Unicode strings.""" - self.buildDwarf() + self.build() self.rdar12991846(expr=1) @unittest2.expectedFailure("rdar://18684408") - @skipUnlessDarwin - @dsym_test - def test_expr2_with_dsym(self): - """Test that the expression parser returns proper Unicode strings.""" - self.buildDsym() - self.rdar12991846(expr=2) - - @unittest2.expectedFailure("rdar://18684408") @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") - @dwarf_test - def test_expr2_with_dwarf(self): + def test_expr2(self): """Test that the expression parser returns proper Unicode strings.""" - self.buildDwarf() + self.build() self.rdar12991846(expr=2) @unittest2.expectedFailure("rdar://18684408") - @skipUnlessDarwin - @dsym_test - def test_expr3_with_dsym(self): - """Test that the expression parser returns proper Unicode strings.""" - self.buildDsym() - self.rdar12991846(expr=3) - - @unittest2.expectedFailure("rdar://18684408") @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") - @dwarf_test - def test_expr3_with_dwarf(self): + def test_expr3(self): """Test that the expression parser returns proper Unicode strings.""" - self.buildDwarf() + self.build() self.rdar12991846(expr=3) def setUp(self): diff --git a/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py b/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py index 7fcb599a7dd..ea9d135a224 100644 --- a/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py +++ b/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py @@ -10,30 +10,12 @@ class RvalueReferencesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Test that rvalues are supported in the C++ expression parser""" - self.buildDsym() - self.static_method_commands() - #rdar://problem/11479676 @expectedFailureIcc("ICC (13.1, 14-beta) do not emit DW_TAG_rvalue_reference_type.") @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") - @dwarf_test - def test_with_dwarf_and_run_command(self): - """Test that rvalues are supported in the C++ expression parser""" - self.buildDwarf() - self.static_method_commands() - - def setUp(self): - TestBase.setUp(self) - - def set_breakpoint(self, line): - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=True) - - def static_method_commands(self): + def test_with_run_command(self): """Test that rvalues are supported in the C++ expression parser""" + self.build() self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) self.set_breakpoint(line_number('main.cpp', '// breakpoint 1')) @@ -62,6 +44,9 @@ class RvalueReferencesTestCase(TestBase): self.expect("expression -- int &&k = 6; k", startstr = "(int) $1 = 6") + + def set_breakpoint(self, line): + lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=True) if __name__ == '__main__': import atexit diff --git a/lldb/test/lang/cpp/scope/TestCppScope.py b/lldb/test/lang/cpp/scope/TestCppScope.py index 104d53f0954..4d5ea8bf62b 100644 --- a/lldb/test/lang/cpp/scope/TestCppScope.py +++ b/lldb/test/lang/cpp/scope/TestCppScope.py @@ -10,23 +10,10 @@ class TestCppScopes(TestBase): mydir = TestBase.compute_mydir(__file__) @expectedFailureDarwin - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - self.buildDsym() - self.check() - - @expectedFailureDarwin @expectedFailureWindows("llvm.org/pr24764") - @dwarf_test - def test_with_dwarf_and_run_command(self): - self.buildDwarf() - self.check() - - def setUp(self): - TestBase.setUp(self) + def test_with_run_command(self): + self.build() - def check(self): # Get main source file src_file = "main.cpp" src_file_spec = lldb.SBFileSpec(src_file) diff --git a/lldb/test/lang/cpp/signed_types/TestSignedTypes.py b/lldb/test/lang/cpp/signed_types/TestSignedTypes.py index 36c2b6d414e..9c1f6838efd 100644 --- a/lldb/test/lang/cpp/signed_types/TestSignedTypes.py +++ b/lldb/test/lang/cpp/signed_types/TestSignedTypes.py @@ -13,19 +13,6 @@ class UnsignedTypesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test that variables with signed types display correctly.""" - self.buildDsym() - self.signed_types() - - @dwarf_test - def test_with_dwarf(self): - """Test that variables with signed types display correctly.""" - self.buildDwarf() - self.signed_types() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -33,7 +20,10 @@ class UnsignedTypesTestCase(TestBase): self.source = 'main.cpp' self.line = line_number(self.source, '// Set break point at this line.') - def signed_types(self): + def test(self): + """Test that variables with signed types display correctly.""" + self.build() + # Run in synchronous mode self.dbg.SetAsync(False) diff --git a/lldb/test/lang/cpp/static_members/TestCPPStaticMembers.py b/lldb/test/lang/cpp/static_members/TestCPPStaticMembers.py index 412234a5757..de85a574899 100644 --- a/lldb/test/lang/cpp/static_members/TestCPPStaticMembers.py +++ b/lldb/test/lang/cpp/static_members/TestCPPStaticMembers.py @@ -9,30 +9,11 @@ class CPPStaticMembersTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @unittest2.expectedFailure # llvm.org/pr15401 - @dsym_test - def test_with_dsym_and_run_command(self): - """Test that member variables have the correct layout, scope and qualifiers when stopped inside and outside C++ methods""" - self.buildDsym() - self.static_member_commands() - @unittest2.expectedFailure # llvm.org/pr15401 @expectedFailureWindows("llvm.org/pr21765") - @dwarf_test - def test_with_dwarf_and_run_command(self): - """Test that member variables have the correct layout, scope and qualifiers when stopped inside and outside C++ methods""" - self.buildDwarf() - self.static_member_commands() - - def setUp(self): - TestBase.setUp(self) - - def set_breakpoint(self, line): - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False) - - def static_member_commands(self): + def test_with_run_command(self): """Test that member variables have the correct layout, scope and qualifiers when stopped inside and outside C++ methods""" + self.build() self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) self.set_breakpoint(line_number('main.cpp', '// breakpoint 1')) @@ -67,7 +48,10 @@ class CPPStaticMembersTestCase(TestBase): startstr = "(long) $6 = 2") self.runCmd("process continue") - + + def set_breakpoint(self, line): + lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False) + if __name__ == '__main__': import atexit diff --git a/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py b/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py index d5852724ec9..c44af758c72 100644 --- a/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py +++ b/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py @@ -10,26 +10,14 @@ class CPPStaticMethodsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Test that static methods are properly distinguished from regular methods""" - self.buildDsym() - self.static_method_commands() - - @dwarf_test - @expectedFailureWindows - def test_with_dwarf_and_run_command(self): - """Test that static methods are properly distinguished from regular methods""" - self.buildDwarf() - self.static_method_commands() - def setUp(self): TestBase.setUp(self) self.line = line_number('main.cpp', '// Break at this line') - - def static_method_commands(self): + + @expectedFailureWindows + def test_with_run_command(self): """Test that static methods are properly distinguished from regular methods""" + 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) diff --git a/lldb/test/lang/cpp/stl/TestSTL.py b/lldb/test/lang/cpp/stl/TestSTL.py index 4a1b2e0eb2f..b74009fbefd 100644 --- a/lldb/test/lang/cpp/stl/TestSTL.py +++ b/lldb/test/lang/cpp/stl/TestSTL.py @@ -12,39 +12,6 @@ class STLTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - # rdar://problem/10400981 - @unittest2.expectedFailure - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test some expressions involving STL data types.""" - self.buildDsym() - self.step_stl_exprs() - - # rdar://problem/10400981 - @unittest2.expectedFailure - @dwarf_test - def test_with_dwarf(self): - """Test some expressions involving STL data types.""" - self.buildDwarf() - self.step_stl_exprs() - - @python_api_test - @dsym_test - @skipUnlessDarwin - def test_SBType_template_aspects_with_dsym(self): - """Test APIs for getting template arguments from an SBType.""" - self.buildDsym() - self.sbtype_template_apis() - - @expectedFailureIcc # icc 13.1 and 14-beta do not emit DW_TAG_template_type_parameter - @python_api_test - @dwarf_test - def test_SBType_template_aspects_with_dwarf(self): - """Test APIs for getting template arguments from an SBType.""" - self.buildDwarf() - self.sbtype_template_apis() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -52,8 +19,11 @@ class STLTestCase(TestBase): self.source = 'main.cpp' self.line = line_number(self.source, '// Set break point at this line.') - def step_stl_exprs(self): + # rdar://problem/10400981 + @unittest2.expectedFailure + def test(self): """Test some expressions involving STL data types.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") # The following two lines, if uncommented, will enable loggings. @@ -93,8 +63,11 @@ class STLTestCase(TestBase): self.expect('expr associative_array["hello"]', substrs = [' = 2']) - def sbtype_template_apis(self): + @expectedFailureIcc # icc 13.1 and 14-beta do not emit DW_TAG_template_type_parameter + @python_api_test + def test_SBType_template_aspects(self): """Test APIs for getting template arguments from an SBType.""" + self.build() exe = os.path.join(os.getcwd(), 'a.out') # Create a target by the debugger. diff --git a/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py b/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py index eca9182cbc3..abcc3004a4a 100644 --- a/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py +++ b/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py @@ -23,7 +23,7 @@ class StdCXXDisassembleTestCase(TestBase): @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test") def test_stdcxx_disasm(self): """Do 'disassemble' on each and every 'Code' symbol entry from the std c++ lib.""" - self.buildDefault() + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) diff --git a/lldb/test/lang/cpp/this/TestCPPThis.py b/lldb/test/lang/cpp/this/TestCPPThis.py index 901202c908a..e4b5d615121 100644 --- a/lldb/test/lang/cpp/this/TestCPPThis.py +++ b/lldb/test/lang/cpp/this/TestCPPThis.py @@ -9,35 +9,15 @@ class CPPThisTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - #rdar://problem/9962849 - #@expectedFailureClang - @dsym_test - def test_with_dsym_and_run_command(self): - """Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods""" - self.buildDsym() - self.static_method_commands() - #rdar://problem/9962849 @expectedFailureGcc # llvm.org/pr15439 The 'this' pointer isn't available during expression evaluation when stopped in an inlined member function. @expectedFailureIcc # ICC doesn't emit correct DWARF inline debug info for inlined member functions @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") @expectedFailureWindows("llvm.org/pr24490: We shouldn't be using platform-specific names like `getpid` in tests") - @dwarf_test @expectedFlakeyClang(bugnumber='llvm.org/pr23012', compiler_version=['>=','3.6']) # failed with totclang - clang3.7 - def test_with_dwarf_and_run_command(self): - """Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods""" - self.buildDwarf() - self.static_method_commands() - - def setUp(self): - TestBase.setUp(self) - - def set_breakpoint(self, line): - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False) - - def static_method_commands(self): + def test_with_run_command(self): """Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods""" + self.build() self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) self.set_breakpoint(line_number('main.cpp', '// breakpoint 1')) @@ -68,6 +48,9 @@ class CPPThisTestCase(TestBase): self.expect("expression -- m_a", startstr = "(int) $4 = 2") + + def set_breakpoint(self, line): + lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False) if __name__ == '__main__': import atexit diff --git a/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py b/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py index 799e2fdf23b..c251563228a 100644 --- a/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py +++ b/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py @@ -11,19 +11,6 @@ class UniqueTypesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test for unique types of std::vector<long> and std::vector<short>.""" - self.buildDsym() - self.unique_types() - - @dwarf_test - def test_with_dwarf(self): - """Test for unique types of std::vector<long> and std::vector<short>.""" - self.buildDwarf() - self.unique_types() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -31,8 +18,9 @@ class UniqueTypesTestCase(TestBase): self.line = line_number("main.cpp", "// Set breakpoint here to verify that std::vector 'longs' and 'shorts' have unique types.") - def unique_types(self): + def test(self): """Test for unique types of std::vector<long> and std::vector<short>.""" + self.build() compiler = self.getCompiler() compiler_basename = os.path.basename(compiler) diff --git a/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py b/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py index 5959d863500..d49d3b8f4df 100644 --- a/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py +++ b/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py @@ -13,27 +13,15 @@ class UnsignedTypesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test that variables with unsigned types display correctly.""" - self.buildDsym() - self.unsigned_types() - - @dwarf_test - def test_with_dwarf(self): - """Test that variables with unsigned types display correctly.""" - self.buildDwarf() - self.unsigned_types() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) # Find the line number to break inside main(). self.line = line_number('main.cpp', '// Set break point at this line.') - def unsigned_types(self): + def test(self): """Test that variables with unsigned types display correctly.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) diff --git a/lldb/test/lang/cpp/virtual/TestVirtual.py b/lldb/test/lang/cpp/virtual/TestVirtual.py index 797afaf8c60..0904cfc0c83 100644 --- a/lldb/test/lang/cpp/virtual/TestVirtual.py +++ b/lldb/test/lang/cpp/virtual/TestVirtual.py @@ -22,19 +22,6 @@ class CppVirtualMadness(TestBase): # Assert message. PRINTF_OUTPUT_GROKKED = "The printf output from compiled code is parsed correctly" - @skipIfWindows # Process::GetSTDOUT unsupported on Windows. This test should be re-written to use stdout re-direction - @skipUnlessDarwin - def test_virtual_madness_dsym(self): - """Test that expression works correctly with virtual inheritance as well as virtual function.""" - self.buildDsym() - self.virtual_madness_test() - - @expectedFailureIcc('llvm.org/pr16808') # lldb does not call the correct virtual function with icc - def test_virtual_madness_dwarf(self): - """Test that expression works correctly with virtual inheritance as well as virtual function.""" - self.buildDwarf() - self.virtual_madness_test() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -42,8 +29,10 @@ class CppVirtualMadness(TestBase): self.source = 'main.cpp' self.line = line_number(self.source, '// Set first breakpoint here.') - def virtual_madness_test(self): - """Test that variable expressions with basic types are evaluated correctly.""" + @expectedFailureIcc('llvm.org/pr16808') # lldb does not call the correct virtual function with icc + def test_virtual_madness(self): + """Test that expression works correctly with virtual inheritance as well as virtual function.""" + self.build() # Bring the program to the point where we can issue a series of # 'expression' command to compare against the golden output. diff --git a/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py b/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py index 21b2c838e77..232cda7a5a1 100644 --- a/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py +++ b/lldb/test/lang/cpp/wchar_t/TestCxxWCharT.py @@ -13,20 +13,6 @@ class CxxWCharTTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test that C++ supports wchar_t correctly.""" - self.buildDsym() - self.wchar_t() - - @dwarf_test - @expectedFailureWindows("llvm.org/pr24764") - def test_with_dwarf(self): - """Test that C++ supports wchar_t correctly.""" - self.buildDwarf() - self.wchar_t() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -34,8 +20,10 @@ class CxxWCharTTestCase(TestBase): self.source = 'main.cpp' self.line = line_number(self.source, '// Set break point at this line.') - def wchar_t(self): + @expectedFailureWindows("llvm.org/pr24764") + def test(self): """Test that C++ supports wchar_t correctly.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") # Create a target by the debugger. |