From: Sean Callanan Date: Tue, 28 Oct 2014 20:23:20 +0000 (+0000) Subject: Added the ability to add attributes to inline X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e17428acfa5a14fa016bf9c9783dee64caf6f1e9;p=platform%2Fupstream%2Fllvm.git Added the ability to add attributes to inline testcases. Also fixed one of the testcases to not run on the platforms that don't support Objective-C. We want to do better with the Objective-C attribute but we'll do that in a future commit. llvm-svn: 220820 --- diff --git a/lldb/test/lldbinline.py b/lldb/test/lldbinline.py index 52925a0..c8209f7 100644 --- a/lldb/test/lldbinline.py +++ b/lldb/test/lldbinline.py @@ -3,6 +3,8 @@ from lldbtest import * import lldbutil import os import new +import unittest2 +import sys def source_type(filename): _, extension = os.path.splitext(filename) @@ -53,7 +55,6 @@ class CommandParser: self.breakpoints.append(current_breakpoint) else: current_breakpoint['command'] = current_breakpoint['command'] + "\n" + command - print self.breakpoints def set_breakpoints(self, target): for breakpoint in self.breakpoints: @@ -113,11 +114,11 @@ class InlineTest(TestBase): self.buildDwarf() @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") - def test_with_dsym(self): + def __test_with_dsym(self): self.buildDsymWithImplicitMakefile() self.do_test() - def test_with_dwarf(self): + def __test_with_dwarf(self): self.buildDwarfWithImplicitMakefile() self.do_test() @@ -161,7 +162,17 @@ class InlineTest(TestBase): report_str = "%s expected: %s got: %s"%(expression, expected_result, answer) self.assertTrue(answer == expected_result, report_str) -def MakeInlineTest(__file, __globals): +def ApplyDecoratorsToFunction(func, decorators): + tmp = func + if type(decorators) == list: + for decorator in decorators: + tmp = decorator(tmp) + elif hasattr(decorators, '__call__'): + tmp = decorators(tmp) + return tmp + + +def MakeInlineTest(__file, __globals, decorators=None): # Derive the test name from the current file name file_basename = os.path.basename(__file) InlineTest.mydir = TestBase.compute_mydir(__file) @@ -170,6 +181,10 @@ def MakeInlineTest(__file, __globals): # Build the test case test = new.classobj(test_name, (InlineTest,), {}) test.name = test_name + + test.test_with_dsym = ApplyDecoratorsToFunction(test._InlineTest__test_with_dsym, decorators) + test.test_with_dwarf = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwarf, decorators) + # Add the test case to the globals, and hide InlineTest __globals.update({test_name : test}) diff --git a/lldb/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py b/lldb/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py index a70d2ca..356979f 100644 --- a/lldb/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py +++ b/lldb/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py @@ -1,3 +1,4 @@ import lldbinline +import lldbtest -lldbinline.MakeInlineTest(__file__, globals()) +lldbinline.MakeInlineTest(__file__, globals(), [lldbtest.skipIfFreeBSD,lldbtest.skipIfLinux,lldbtest.skipIfWindows])