From 5ce142b42913ef07b494c32fc69b1cf891b4d375 Mon Sep 17 00:00:00 2001 From: Chaoren Lin Date: Mon, 27 Jul 2015 21:15:01 +0000 Subject: [PATCH] Only test ObjC expression options on Darwin. Reviewers: dawn, emaste, vharron, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11539 llvm-svn: 243329 --- .../expression_command/options/TestExprOptions.py | 96 ++++++++++++---------- 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/lldb/test/expression_command/options/TestExprOptions.py b/lldb/test/expression_command/options/TestExprOptions.py index cb099f6..17c2fa4 100644 --- a/lldb/test/expression_command/options/TestExprOptions.py +++ b/lldb/test/expression_command/options/TestExprOptions.py @@ -26,9 +26,15 @@ class ExprOptionsTestCase(TestBase): self.line = line_number('main.cpp', '// breakpoint_in_main') self.exe = os.path.join(os.getcwd(), "a.out") - @expectedFailureFreeBSD # ObjC expression broken on FreeBSD? - @expectedFailureLinux # ObjC expression broken on Linux? - def test_expr_options(self): + @skipUnlessDarwin + def test_expr_options_objc_cpp(self): + self.expr_options(test_objc = True, test_cpp = True) + + @skipIfDarwin # Already covered by test_expr_options_objc_cpp + def test_expr_options_cpp(self): + self.expr_options(test_objc = False, test_cpp = True) + + def expr_options(self, test_objc, test_cpp): """These expression command options should work as expected.""" self.buildDefault() @@ -53,47 +59,49 @@ class ExprOptionsTestCase(TestBase): frame = threads[0].GetFrameAtIndex(0) options = lldb.SBExpressionOptions() - # -- test --language on ObjC builtin type using the SB API's -- - # Make sure we can evaluate the ObjC builtin type 'id': - val = frame.EvaluateExpression('id my_id = 0; my_id') - self.assertTrue(val.IsValid()) - self.assertTrue(val.GetError().Success()) - self.assertEqual(val.GetValueAsUnsigned(0), 0) - self.DebugSBValue(val) - - # Make sure it still works if language is set to ObjC: - options.SetLanguage(lldb.eLanguageTypeObjC) - val = frame.EvaluateExpression('id my_id = 0; my_id', options) - self.assertTrue(val.IsValid()) - self.assertTrue(val.GetError().Success()) - self.assertEqual(val.GetValueAsUnsigned(0), 0) - self.DebugSBValue(val) - - # Make sure it fails if language is set to C: - options.SetLanguage(lldb.eLanguageTypeC) - val = frame.EvaluateExpression('id my_id = 0; my_id', options) - self.assertTrue(val.IsValid()) - self.assertFalse(val.GetError().Success()) - - # -- test --language on C++ expression using the SB API's -- - # Make sure we can evaluate 'ns::func'. - val = frame.EvaluateExpression('ns::func') - self.assertTrue(val.IsValid()) - self.assertTrue(val.GetError().Success()) - self.DebugSBValue(val) - - # Make sure it still works if language is set to C++: - options.SetLanguage(lldb.eLanguageTypeC_plus_plus) - val = frame.EvaluateExpression('ns::func', options) - self.assertTrue(val.IsValid()) - self.assertTrue(val.GetError().Success()) - self.DebugSBValue(val) - - # Make sure it fails if language is set to C: - options.SetLanguage(lldb.eLanguageTypeC) - val = frame.EvaluateExpression('ns::func', options) - self.assertTrue(val.IsValid()) - self.assertFalse(val.GetError().Success()) + if test_objc: + # -- test --language on ObjC builtin type using the SB API's -- + # Make sure we can evaluate the ObjC builtin type 'id': + val = frame.EvaluateExpression('id my_id = 0; my_id') + self.assertTrue(val.IsValid()) + self.assertTrue(val.GetError().Success()) + self.assertEqual(val.GetValueAsUnsigned(0), 0) + self.DebugSBValue(val) + + # Make sure it still works if language is set to ObjC: + options.SetLanguage(lldb.eLanguageTypeObjC) + val = frame.EvaluateExpression('id my_id = 0; my_id', options) + self.assertTrue(val.IsValid()) + self.assertTrue(val.GetError().Success()) + self.assertEqual(val.GetValueAsUnsigned(0), 0) + self.DebugSBValue(val) + + # Make sure it fails if language is set to C: + options.SetLanguage(lldb.eLanguageTypeC) + val = frame.EvaluateExpression('id my_id = 0; my_id', options) + self.assertTrue(val.IsValid()) + self.assertFalse(val.GetError().Success()) + + if test_cpp: + # -- test --language on C++ expression using the SB API's -- + # Make sure we can evaluate 'ns::func'. + val = frame.EvaluateExpression('ns::func') + self.assertTrue(val.IsValid()) + self.assertTrue(val.GetError().Success()) + self.DebugSBValue(val) + + # Make sure it still works if language is set to C++: + options.SetLanguage(lldb.eLanguageTypeC_plus_plus) + val = frame.EvaluateExpression('ns::func', options) + self.assertTrue(val.IsValid()) + self.assertTrue(val.GetError().Success()) + self.DebugSBValue(val) + + # Make sure it fails if language is set to C: + options.SetLanguage(lldb.eLanguageTypeC) + val = frame.EvaluateExpression('ns::func', options) + self.assertTrue(val.IsValid()) + self.assertFalse(val.GetError().Success()) if __name__ == '__main__': import atexit -- 2.7.4