diff options
Diffstat (limited to 'lldb/test/lang/c')
18 files changed, 181 insertions, 530 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() diff --git a/lldb/test/lang/c/array_types/TestArrayTypes.py b/lldb/test/lang/c/array_types/TestArrayTypes.py index 6a5455524f1..e159efc4382 100644 --- a/lldb/test/lang/c/array_types/TestArrayTypes.py +++ b/lldb/test/lang/c/array_types/TestArrayTypes.py @@ -10,42 +10,15 @@ class ArrayTypesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Test 'frame variable var_name' on some variables with array types.""" - self.buildDsym() - self.array_types() - - @skipUnlessDarwin - @python_api_test - @dsym_test - def test_with_dsym_and_python_api(self): - """Use Python APIs to inspect variables with array types.""" - self.buildDsym() - self.array_types_python() - - @dwarf_test - def test_with_dwarf_and_run_command(self): - """Test 'frame variable var_name' on some variables with array types.""" - self.buildDwarf() - self.array_types() - - @python_api_test - @dwarf_test - def test_with_dwarf_and_python_api(self): - """Use Python APIs to inspect variables with array types.""" - self.buildDwarf() - self.array_types_python() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) # Find the line number to break inside main(). self.line = line_number('main.c', '// Set break point at this line.') - def array_types(self): + def test_and_run_command(self): """Test 'frame variable var_name' on some variables with array types.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) @@ -92,8 +65,10 @@ class ArrayTypesTestCase(TestBase): self.expect("frame variable --show-types long_6", VARIABLES_DISPLAYED_CORRECTLY, startstr = '(long [6])') - def array_types_python(self): + @python_api_test + def test_and_python_api(self): """Use Python APIs to inspect variables with array types.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") target = self.dbg.CreateTarget(exe) diff --git a/lldb/test/lang/c/bitfields/TestBitfields.py b/lldb/test/lang/c/bitfields/TestBitfields.py index 1ae77fc959e..090b31950e8 100644 --- a/lldb/test/lang/c/bitfields/TestBitfields.py +++ b/lldb/test/lang/c/bitfields/TestBitfields.py @@ -9,45 +9,17 @@ import lldbutil class BitfieldsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Test 'frame variable ...' on a variable with bitfields.""" - self.buildDsym() - self.bitfields_variable() - - @skipUnlessDarwin - @python_api_test - @dsym_test - def test_with_dsym_and_python_api(self): - """Use Python APIs to inspect a bitfields variable.""" - self.buildDsym() - self.bitfields_variable_python() - - @dwarf_test - @skipIfWindows # BitFields exhibit crashes in record layout on Windows (http://llvm.org/pr21800) - def test_with_dwarf_and_run_command(self): - """Test 'frame variable ...' on a variable with bitfields.""" - self.buildDwarf() - self.bitfields_variable() - - @python_api_test - @dwarf_test - @skipIfWindows # BitFields exhibit crashes in record layout on Windows (http://llvm.org/pr21800) - def test_with_dwarf_and_python_api(self): - """Use Python APIs to inspect a bitfields variable.""" - self.buildDwarf() - self.bitfields_variable_python() - + def setUp(self): # Call super's setUp(). TestBase.setUp(self) # Find the line number to break inside main(). self.line = line_number('main.c', '// Set break point at this line.') - def bitfields_variable(self): + @skipIfWindows # BitFields exhibit crashes in record layout on Windows (http://llvm.org/pr21800) + def test_and_run_command(self): """Test 'frame variable ...' on a variable with bitfields.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) @@ -120,8 +92,11 @@ class BitfieldsTestCase(TestBase): self.expect("expr (more_bits.d)", VARIABLES_DISPLAYED_CORRECTLY, substrs = ['uint8_t', '\\0']) - def bitfields_variable_python(self): + @python_api_test + @skipIfWindows # BitFields exhibit crashes in record layout on Windows (http://llvm.org/pr21800) + def test_and_python_api(self): """Use Python APIs to inspect a bitfields variable.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") target = self.dbg.CreateTarget(exe) diff --git a/lldb/test/lang/c/blocks/TestBlocks.py b/lldb/test/lang/c/blocks/TestBlocks.py index 1a247e90451..6dd4bec46e4 100644 --- a/lldb/test/lang/c/blocks/TestBlocks.py +++ b/lldb/test/lang/c/blocks/TestBlocks.py @@ -11,50 +11,25 @@ class BlocksTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) lines = [] - @dsym_test - @unittest2.expectedFailure("rdar://problem/10413887 - Call blocks in expressions") - def test_expr_with_dsym(self): - self.buildDsym() - self.expr() - - @unittest2.expectedFailure("rdar://problem/10413887 - Call blocks in expressions") - @dwarf_test - def test_expr_with_dwarf(self): - self.buildDwarf() - self.expr() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) # Find the line numbers to break at. self.lines.append(line_number('main.c', '// Set breakpoint 0 here.')) self.lines.append(line_number('main.c', '// Set breakpoint 1 here.')) - - def common_setup(self): + + @unittest2.expectedFailure("rdar://problem/10413887 - Call blocks in expressions") + def test_expr(self): + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.is_started = False + self.is_started = False # Break inside the foo function which takes a bar_ptr argument. - for line in self.lines: + for line in self.lines: lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True) - def wait_for_breakpoint(self): - if self.is_started == False: - self.is_started = True - self.runCmd("process launch", RUN_SUCCEEDED) - else: - self.runCmd("process continue", RUN_SUCCEEDED) - - # The stop reason of the thread should be breakpoint. - self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', - 'stop reason = breakpoint']) - - def expr(self): - self.common_setup() - self.wait_for_breakpoint() self.expect("expression a + b", VARIABLES_DISPLAYED_CORRECTLY, @@ -68,6 +43,18 @@ class BlocksTestCase(TestBase): # This should display correctly. self.expect("expression (int)neg (-12)", VARIABLES_DISPLAYED_CORRECTLY, substrs = ["= 12"]) + + def wait_for_breakpoint(self): + if self.is_started == False: + self.is_started = True + self.runCmd("process launch", RUN_SUCCEEDED) + else: + self.runCmd("process continue", RUN_SUCCEEDED) + + # The stop reason of the thread should be breakpoint. + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs = ['stopped', + 'stop reason = breakpoint']) if __name__ == '__main__': import atexit diff --git a/lldb/test/lang/c/const_variables/TestConstVariables.py b/lldb/test/lang/c/const_variables/TestConstVariables.py index ba2182bd085..8954e49a189 100644 --- a/lldb/test/lang/c/const_variables/TestConstVariables.py +++ b/lldb/test/lang/c/const_variables/TestConstVariables.py @@ -10,12 +10,6 @@ class ConstVariableTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @dsym_test - def test_with_dsym_and_run_command(self): - """Test interpreted and JITted expressions on constant values.""" - self.buildDsym() - self.const_variable() - @expectedFailureAll( oslist=["freebsd", "linux"], compiler="clang", compiler_version=["<", "3.5"]) @@ -28,18 +22,9 @@ class ConstVariableTestCase(TestBase): @expectedFailureAll(oslist=["freebsd", "linux"], compiler="icc") @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 - def test_with_dwarf_and_run_command(self): - """Test interpreted and JITted expressions on constant values.""" - self.buildDwarf() - self.const_variable() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def const_variable(self): + def test_and_run_command(self): """Test interpreted and JITted expressions on constant values.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) diff --git a/lldb/test/lang/c/enum_types/TestEnumTypes.py b/lldb/test/lang/c/enum_types/TestEnumTypes.py index 7ca36e1c236..96d290739a8 100644 --- a/lldb/test/lang/c/enum_types/TestEnumTypes.py +++ b/lldb/test/lang/c/enum_types/TestEnumTypes.py @@ -10,29 +10,15 @@ class EnumTypesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test 'image lookup -t days' and check for correct display and enum value printing.""" - self.buildDsym() - self.image_lookup_for_enum_type() - - # rdar://problem/8394746 - # 'image lookup -t days' returns nothing with dwarf debug format. - @dwarf_test - def test_with_dwarf(self): - """Test 'image lookup -t days' and check for correct display and enum value printing.""" - self.buildDwarf() - self.image_lookup_for_enum_type() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) # Find the line number to break inside main(). self.line = line_number('main.c', '// Set break point at this line.') - def image_lookup_for_enum_type(self): - """Test 'image lookup -t days' and check for correct display.""" + def test(self): + """Test 'image lookup -t days' and check for correct display and enum value printing.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) @@ -80,6 +66,7 @@ class EnumTypesTestCase(TestBase): self.expect("frame variable day", 'check for valid enumeration value', substrs = [enum_value]) lldbutil.continue_to_breakpoint (self.process(), bkpt) + if __name__ == '__main__': import atexit lldb.SBDebugger.Initialize() diff --git a/lldb/test/lang/c/forward/TestForwardDeclaration.py b/lldb/test/lang/c/forward/TestForwardDeclaration.py index 6fb0eb9645a..9eb8ae6d245 100644 --- a/lldb/test/lang/c/forward/TestForwardDeclaration.py +++ b/lldb/test/lang/c/forward/TestForwardDeclaration.py @@ -10,25 +10,9 @@ class ForwardDeclarationTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Display *bar_ptr when stopped on a function with forward declaration of struct bar.""" - self.buildDsym() - self.forward_declaration() - - # rdar://problem/8648070 - # 'expression *bar_ptr' seg faults - # rdar://problem/8546815 - # './dotest.py -v -t forward' fails for test_with_dwarf_and_run_command - @dwarf_test - def test_with_dwarf_and_run_command(self): - """Display *bar_ptr when stopped on a function with forward declaration of struct bar.""" - self.buildDwarf() - self.forward_declaration() - - def forward_declaration(self): + def test_and_run_command(self): """Display *bar_ptr when stopped on a function with forward declaration of struct bar.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) diff --git a/lldb/test/lang/c/function_types/TestFunctionTypes.py b/lldb/test/lang/c/function_types/TestFunctionTypes.py index 3426ae24ef8..f8ac8a68207 100644 --- a/lldb/test/lang/c/function_types/TestFunctionTypes.py +++ b/lldb/test/lang/c/function_types/TestFunctionTypes.py @@ -10,60 +10,15 @@ class FunctionTypesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test 'callback' has function ptr type, then break on the function.""" - self.buildDsym() - self.function_types() - - @dwarf_test - def test_with_dwarf(self): - """Test 'callback' has function ptr type, then break on the function.""" - self.buildDwarf() - self.function_types() - - @skipUnlessDarwin - @dsym_test - def test_pointers_with_dsym(self): - """Test that a function pointer to 'printf' works and can be called.""" - self.buildDsym() - self.function_pointers() - - @dwarf_test - @expectedFailureWindows("llvm.org/pr21765") - def test_pointers_with_dwarf(self): - """Test that a function pointer to 'printf' works and can be called.""" - self.buildDwarf() - self.function_pointers() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) # Find the line number to break inside main(). self.line = line_number('main.c', '// Set break point at this line.') - def runToBreakpoint(self): - exe = os.path.join(os.getcwd(), "a.out") - self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - - # Break inside the main. - lldbutil.run_break_set_by_file_and_line (self, "main.c", 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']) - - # The breakpoint should have a hit count of 1. - self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs = [' resolved, hit count = 1']) - - def function_types(self): + def test(self): """Test 'callback' has function ptr type, then break on the function.""" - + self.build() self.runToBreakpoint() # Check that the 'callback' variable display properly. @@ -78,10 +33,11 @@ class FunctionTypesTestCase(TestBase): self.expect("process status", STOPPED_DUE_TO_BREAKPOINT, substrs = ['a.out`string_not_empty', 'stop reason = breakpoint']) - - def function_pointers(self): + + @expectedFailureWindows("llvm.org/pr21765") + def test_pointers(self): """Test that a function pointer to 'printf' works and can be called.""" - + self.build() self.runToBreakpoint() self.expect("expr string_not_empty", @@ -98,6 +54,24 @@ class FunctionTypesTestCase(TestBase): self.expect("expr $1(\"Hello world\\n\")", startstr = '(int) $2 = 12') + def runToBreakpoint(self): + exe = os.path.join(os.getcwd(), "a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + + # Break inside the main. + lldbutil.run_break_set_by_file_and_line (self, "main.c", 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']) + + # 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() diff --git a/lldb/test/lang/c/global_variables/TestGlobalVariables.py b/lldb/test/lang/c/global_variables/TestGlobalVariables.py index 6a4478c04d4..23005095f43 100644 --- a/lldb/test/lang/c/global_variables/TestGlobalVariables.py +++ b/lldb/test/lang/c/global_variables/TestGlobalVariables.py @@ -10,20 +10,6 @@ class GlobalVariablesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test 'frame variable --scope --no-args' which omits args and shows scopes.""" - self.buildDsym() - self.global_variables() - - @dwarf_test - @expectedFailureWindows("llvm.org/pr24764") - def test_with_dwarf(self): - """Test 'frame variable --scope --no-args' which omits args and shows scopes.""" - self.buildDwarf() - self.global_variables() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -32,8 +18,11 @@ class GlobalVariablesTestCase(TestBase): self.line = line_number(self.source, '// Set break point at this line.') self.shlib_names = ["a"] - def global_variables(self): + @expectedFailureWindows("llvm.org/pr24764") + def test(self): """Test 'frame variable --scope --no-args' which omits args and shows scopes.""" + self.build() + # Create a target by the debugger. target = self.dbg.CreateTarget("a.out") self.assertTrue(target, VALID_TARGET) diff --git a/lldb/test/lang/c/modules/TestCModules.py b/lldb/test/lang/c/modules/TestCModules.py index df47202421d..1ac8484a5f5 100644 --- a/lldb/test/lang/c/modules/TestCModules.py +++ b/lldb/test/lang/c/modules/TestCModules.py @@ -14,35 +14,15 @@ class CModulesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - @expectedFailureDarwin('http://llvm.org/pr24302') - def test_expr_with_dsym(self): - self.buildDsym() - self.expr() - - @dwarf_test @skipIfFreeBSD @expectedFailureDarwin('http://llvm.org/pr24302') @expectedFailureLinux('http://llvm.org/pr23456') # 'fopen' has unknown return type @expectedFailureWindows("llvm.org/pr24489: Name lookup not working correctly on Windows") - def test_expr_with_dwarf(self): - self.buildDwarf() - self.expr() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Find the line number to break inside main(). - self.line = line_number('main.c', '// Set breakpoint 0 here.') - - def applies(self): + def test_expr(self): if platform.system() == "Darwin" and platform.release() < StrictVersion('12.0.0'): - return False + self.skipTest() - return True - - def common_setup(self): + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) @@ -60,12 +40,6 @@ class CModulesTestCase(TestBase): self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, substrs = [' resolved, hit count = 1']) - def expr(self): - if not self.applies(): - return - - self.common_setup() - self.expect("expr @import Darwin; 3", VARIABLES_DISPLAYED_CORRECTLY, substrs = ["int", "3"]) @@ -80,6 +54,12 @@ class CModulesTestCase(TestBase): self.expect("expr stdin", VARIABLES_DISPLAYED_CORRECTLY, substrs = ["(FILE *)", "0x"]) + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + # Find the line number to break inside main(). + self.line = line_number('main.c', '// Set breakpoint 0 here.') if __name__ == '__main__': import atexit diff --git a/lldb/test/lang/c/register_variables/TestRegisterVariables.py b/lldb/test/lang/c/register_variables/TestRegisterVariables.py index 3891fd9aa44..9274524c87a 100644 --- a/lldb/test/lang/c/register_variables/TestRegisterVariables.py +++ b/lldb/test/lang/c/register_variables/TestRegisterVariables.py @@ -10,28 +10,12 @@ class RegisterVariableTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @dsym_test - @expectedFailureAll( - oslist=['macosx'], compiler='clang', compiler_version=['<', '7.0.0']) - def test_with_dsym_and_run_command(self): - """Test expressions on register values.""" - self.buildDsym() - self.const_variable() - - @dwarf_test + @expectedFailureAll(oslist=['macosx'], compiler='clang', compiler_version=['<', '7.0.0'], debug_info="dsym") @expectedFailureClang(None, ['<', '3.5']) @expectedFailureGcc(None, ['is', '4.8.2']) - def test_with_dwarf_and_run_command(self): - """Test expressions on register values.""" - self.buildDwarf() - self.const_variable() - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - - def const_variable(self): + def test_and_run_command(self): """Test expressions on register values.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) diff --git a/lldb/test/lang/c/set_values/TestSetValues.py b/lldb/test/lang/c/set_values/TestSetValues.py index 1f103b25cca..4e64a4100ca 100644 --- a/lldb/test/lang/c/set_values/TestSetValues.py +++ b/lldb/test/lang/c/set_values/TestSetValues.py @@ -10,20 +10,6 @@ class SetValuesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym(self): - """Test settings and readings of program variables.""" - self.buildDsym() - self.set_values() - - @dwarf_test - @expectedFailureWindows("llvm.org/pr21765") - def test_with_dwarf(self): - """Test settings and readings of program variables.""" - self.buildDwarf() - self.set_values() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -34,8 +20,10 @@ class SetValuesTestCase(TestBase): self.line4 = line_number('main.c', '// Set break point #4.') self.line5 = line_number('main.c', '// Set break point #5.') - def set_values(self): + @expectedFailureWindows("llvm.org/pr21765") + def test(self): """Test settings and readings of program variables.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) diff --git a/lldb/test/lang/c/shared_lib/TestSharedLib.py b/lldb/test/lang/c/shared_lib/TestSharedLib.py index ddc86438371..f2a84af0161 100644 --- a/lldb/test/lang/c/shared_lib/TestSharedLib.py +++ b/lldb/test/lang/c/shared_lib/TestSharedLib.py @@ -9,29 +9,27 @@ class SharedLibTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @dsym_test - def test_expr_with_dsym(self): + def test_expr(self): """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.buildDsym() - self.expr() + 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") - @dwarf_test - def test_expr_with_dwarf(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.buildDwarf() - self.expr() + self.build() + self.common_setup() - @dsym_test - def test_frame_variable_with_dsym(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.buildDsym() - self.frame_var() + # This should display correctly. + self.expect("expression --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ["(foo)", "(sub_foo)", "other_element = 3"]) - @dwarf_test - def test_frame_variable_with_dwarf(self): + @unittest2.expectedFailure("rdar://problem/10704639") + def test_frame_variable(self): """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.buildDwarf() - self.frame_var() + self.build() + self.common_setup() + + # This should display correctly. + self.expect("frame variable --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ["(foo)", "(sub_foo)", "other_element = 3"]) def setUp(self): # Call super's setUp(). @@ -67,27 +65,6 @@ class SharedLibTestCase(TestBase): # The breakpoint should have a hit count of 1. self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, substrs = [' resolved, hit count = 1']) - - def expr(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" - - 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() - - # This should display correctly. - self.expect("expression --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY, - substrs = ["(foo)", "(sub_foo)", "other_element = 3"]) - - @unittest2.expectedFailure("rdar://problem/10704639") - def frame_var(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.common_setup() - - # This should display correctly. - self.expect("frame variable --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY, - substrs = ["(foo)", "(sub_foo)", "other_element = 3"]) if __name__ == '__main__': import atexit diff --git a/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py b/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py index 2d921e8f9ac..c6cd427788c 100644 --- a/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py +++ b/lldb/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py @@ -9,31 +9,29 @@ class SharedLibStrippedTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @dsym_test - def test_expr_with_dsym(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.buildDsym() - self.expr() - - @dwarf_test @expectedFailureWindows # Test crashes - def test_expr_with_dwarf(self): + def test_expr(self): """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.buildDwarf() - self.expr() + 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") - @dsym_test - def test_frame_variable_with_dsym(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.buildDsym() - self.frame_var() + self.build() + self.common_setup() + + # This should display correctly. + self.expect("expression --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ["(foo)", "(sub_foo)", "other_element = 3"]) - @dwarf_test @expectedFailureWindows # Test crashes - def test_frame_variable_with_dwarf(self): + @unittest2.expectedFailure("rdar://problem/10381325") + def test_frame_variable(self): """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.buildDwarf() - self.frame_var() + self.build() + self.common_setup() + + # This should display correctly. + self.expect("frame variable --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ["(foo)", "(sub_foo)", "other_element = 3"]) def setUp(self): # Call super's setUp(). @@ -69,28 +67,6 @@ class SharedLibStrippedTestCase(TestBase): # The breakpoint should have a hit count of 1. self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, substrs = [' resolved, hit count = 1']) - - def expr(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" - - 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() - - # This should display correctly. - self.expect("expression --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY, - substrs = ["(foo)", "(sub_foo)", "other_element = 3"]) - - @unittest2.expectedFailure - # rdar://problem/10381325 - def frame_var(self): - """Test that types work when defined in a shared library and forward-declared in the main executable""" - self.common_setup() - - # This should display correctly. - self.expect("frame variable --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY, - substrs = ["(foo)", "(sub_foo)", "other_element = 3"]) if __name__ == '__main__': import atexit diff --git a/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py b/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py index 4915f0e649b..11d639a8902 100644 --- a/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py +++ b/lldb/test/lang/c/stepping/TestStepAndBreakpoints.py @@ -13,32 +13,19 @@ class TestCStepping(TestBase): def getCategories(self): return ['basic_process'] - @skipUnlessDarwin - @python_api_test - @dsym_test - def test_with_dsym_and_python_api(self): - """Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" - self.buildDsym() - self.step_over_stepping() - - @expectedFailureFreeBSD('llvm.org/pr17932') - @expectedFailureLinux # llvm.org/pr14437 - @expectedFailureWindows("llvm.org/pr24777") - @python_api_test - @dwarf_test - def test_with_dwarf_and_python_api(self): - """Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" - self.buildDwarf() - self.step_over_stepping() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) # Find the line numbers that we will step to in main: self.main_source = "main.c" - def step_over_stepping(self): - """Use Python APIs to test stepping over and hitting breakpoints.""" + @expectedFailureFreeBSD('llvm.org/pr17932') + @expectedFailureLinux # llvm.org/pr14437 + @expectedFailureWindows("llvm.org/pr24777") + @python_api_test + def test_and_python_api(self): + """Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") target = self.dbg.CreateTarget(exe) diff --git a/lldb/test/lang/c/stepping/TestThreadStepping.py b/lldb/test/lang/c/stepping/TestThreadStepping.py index 13c8ce88ddc..50322b8287c 100644 --- a/lldb/test/lang/c/stepping/TestThreadStepping.py +++ b/lldb/test/lang/c/stepping/TestThreadStepping.py @@ -13,19 +13,6 @@ class ThreadSteppingTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_step_out_with_dsym_and_run_command(self): - """Exercise thread step-out and frame select followed by thread step-out.""" - self.buildDwarf() - self.thread_step_out() - - @dwarf_test - def test_step_out_with_dwarf_and_run_command(self): - """Exercise thread step-out and frame select followed by thread step-out.""" - self.buildDwarf() - self.thread_step_out() - def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -35,8 +22,9 @@ class ThreadSteppingTestCase(TestBase): self.line3 = line_number('main.c', '// thread step-out while stopped at "c(2)"') self.line4 = line_number('main.c', '// frame select 1, thread step-out while stopped at "c(3)"') - def thread_step_out(self): + def test_step_out_with_run_command(self): """Exercise thread step-out and frame select followed by thread step-out.""" + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) diff --git a/lldb/test/lang/c/strings/TestCStrings.py b/lldb/test/lang/c/strings/TestCStrings.py index 794be62aba6..a2752df7976 100644 --- a/lldb/test/lang/c/strings/TestCStrings.py +++ b/lldb/test/lang/c/strings/TestCStrings.py @@ -9,31 +9,14 @@ class CStringsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - def test_with_dsym_and_run_command(self): - """Tests that C strings work as expected in expressions""" - self.buildDsym() - self.static_method_commands() - - @dwarf_test @expectedFailureWindows("llvm.org/pr21765") - def test_with_dwarf_and_run_command(self): - """Tests that C strings work as expected in expressions""" - 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.c", line, num_expected_locations=1, loc_exact=True) - - def static_method_commands(self): + def test_with_run_command(self): """Tests that C strings work as expected in expressions""" + self.build() self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) - self.set_breakpoint(line_number('main.c', '// breakpoint 1')) + line = line_number('main.c', '// breakpoint 1') + lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True) self.runCmd("process launch", RUN_SUCCEEDED) diff --git a/lldb/test/lang/c/tls_globals/TestTlsGlobals.py b/lldb/test/lang/c/tls_globals/TestTlsGlobals.py index fd90900ca1f..564f069f1b9 100644 --- a/lldb/test/lang/c/tls_globals/TestTlsGlobals.py +++ b/lldb/test/lang/c/tls_globals/TestTlsGlobals.py @@ -10,22 +10,6 @@ class TlsGlobalTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - @unittest2.expectedFailure("rdar://7796742") - def test_with_dsym(self): - """Test thread-local storage.""" - self.buildDsym() - self.tls_globals() - - @dwarf_test - @unittest2.expectedFailure("rdar://7796742") - @skipIfWindows # TLS works differently on Windows, this would need to be implemented separately. - def test_with_dwarf(self): - """Test thread-local storage.""" - self.buildDwarf() - self.tls_globals() - def setUp(self): TestBase.setUp(self) @@ -37,9 +21,11 @@ class TlsGlobalTestCase(TestBase): self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd()) self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath)) - def tls_globals(self): + @unittest2.expectedFailure("rdar://7796742") + @skipIfWindows # TLS works differently on Windows, this would need to be implemented separately. + def test(self): """Test thread-local storage.""" - + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) |