labath created this revision. labath added a reviewer: clayborg. labath added a subscriber: lldb-commits.
One of the tests there does not work with gcc, so I'm spinning that off into a separate test, so that we can XFAIL it with more granularity. I am also renaming the test to reflect the fact that it no longer tests only integer arguments. http://reviews.llvm.org/D21923 Files: packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateIntegerArgs.py Index: packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py +++ packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py @@ -1,26 +1,21 @@ """ -Tests that C++ templates work as expected +Test that C++ template classes that have integer parameters work correctly. + +We must reconstruct the types correctly so the template types are correct +and display correctly, and also make sure the expression parser works and +is able the find all needed functions when evaluating expressions """ import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil -class TemplateIntegerArgsTestCase(TestBase): +class TemplateArgsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(bugnumber="llvm.org/pr28354", compiler="gcc", oslist=["linux"]) - def test_with_run_command(self): - """Test that C++ template classes that have integer parameters work correctly. - - We must reconstruct the types correctly so the template types are correct - and display correctly, and also make sure the expression parser works and - is able the find all needed functions when evaluating expressions""" + + def prepareProcess(self): self.build() - - # Set debugger into synchronous mode - self.dbg.SetAsync(False) # Create a target by the debugger. exe = os.path.join(os.getcwd(), "a.out") @@ -43,7 +38,10 @@ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) # Get frame for current thread - frame = thread.GetSelectedFrame() + return thread.GetSelectedFrame() + + def test_integer_args(self): + frame = self.prepareProcess() testpos = frame.FindVariable('testpos') self.assertTrue(testpos.IsValid(), 'make sure we find a local variabble named "testpos"') @@ -63,6 +61,11 @@ self.assertTrue(expr_result.GetValue() == "-1", "testneg.getArg() == -1") self.assertTrue(expr_result.GetType().GetName() == "int", 'expr_result.GetType().GetName() == "int"') + # Gcc does not generate the necessary DWARF attribute for enum template parameters. + @expectedFailureAll(bugnumber="llvm.org/pr28354", compiler="gcc") + def test_enum_args(self): + frame = self.prepareProcess() + # Make sure "member" can be displayed and also used in an expression correctly member = frame.FindVariable('member') self.assertTrue(member.IsValid(), 'make sure we find a local variabble named "member"')
Index: packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py +++ packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py @@ -1,26 +1,21 @@ """ -Tests that C++ templates work as expected +Test that C++ template classes that have integer parameters work correctly. + +We must reconstruct the types correctly so the template types are correct +and display correctly, and also make sure the expression parser works and +is able the find all needed functions when evaluating expressions """ import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil -class TemplateIntegerArgsTestCase(TestBase): +class TemplateArgsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - - @expectedFailureAll(bugnumber="llvm.org/pr28354", compiler="gcc", oslist=["linux"]) - def test_with_run_command(self): - """Test that C++ template classes that have integer parameters work correctly. - - We must reconstruct the types correctly so the template types are correct - and display correctly, and also make sure the expression parser works and - is able the find all needed functions when evaluating expressions""" + + def prepareProcess(self): self.build() - - # Set debugger into synchronous mode - self.dbg.SetAsync(False) # Create a target by the debugger. exe = os.path.join(os.getcwd(), "a.out") @@ -43,7 +38,10 @@ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) # Get frame for current thread - frame = thread.GetSelectedFrame() + return thread.GetSelectedFrame() + + def test_integer_args(self): + frame = self.prepareProcess() testpos = frame.FindVariable('testpos') self.assertTrue(testpos.IsValid(), 'make sure we find a local variabble named "testpos"') @@ -63,6 +61,11 @@ self.assertTrue(expr_result.GetValue() == "-1", "testneg.getArg() == -1") self.assertTrue(expr_result.GetType().GetName() == "int", 'expr_result.GetType().GetName() == "int"') + # Gcc does not generate the necessary DWARF attribute for enum template parameters. + @expectedFailureAll(bugnumber="llvm.org/pr28354", compiler="gcc") + def test_enum_args(self): + frame = self.prepareProcess() + # Make sure "member" can be displayed and also used in an expression correctly member = frame.FindVariable('member') self.assertTrue(member.IsValid(), 'make sure we find a local variabble named "member"')
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits