summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-06-05 10:58:44 +0000
committerPavel Labath <labath@google.com>2018-06-05 10:58:44 +0000
commit663773857f5fd0aeaccfa47219ff0eeb764d35e4 (patch)
tree05a3893fa31face3378093b6a8454711ebfd72db /lldb/packages/Python/lldbsuite
parent53d35d2dc4a6ef270d1407d0ea0717d8ccf6fccd (diff)
downloadbcm5719-llvm-663773857f5fd0aeaccfa47219ff0eeb764d35e4.tar.gz
bcm5719-llvm-663773857f5fd0aeaccfa47219ff0eeb764d35e4.zip
dotest: make inline tests compatible with -f
Summary: This is split off from D47265 where I needed to be able to invoke every test with -f. That patch is kinda dead now, but this part seems like a good cleanup anyway. The problem with inline tests was in the way we were adding methods to the class, which left them with an incorrect __name__ property. This prevented dotest from finding them with -f. I fix this with (what I think is) the correct way of dynamically creating classes -- passing the list of methods during type construction instead of fixing up the class afterwards. Among other things this has the advantage of not needing to do anything special for debug info variants. As our test method will be visible to the metaclass, it will automagically do the multiplication for us. Reviewers: JDevlieghere, aprantl, tberghammer Subscribers: eraman, lldb-commits Differential Revision: https://reviews.llvm.org/D47579 llvm-svn: 334009
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbinline.py61
1 files changed, 7 insertions, 54 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbinline.py b/lldb/packages/Python/lldbsuite/test/lldbinline.py
index f19bba4016f..bb925ef908f 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbinline.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbinline.py
@@ -84,18 +84,6 @@ class CommandParser:
class InlineTest(TestBase):
# Internal implementation
- def getRerunArgs(self):
- # The -N option says to NOT run a if it matches the option argument, so
- # if we are using dSYM we say to NOT run dwarf (-N dwarf) and vice
- # versa.
- if self.using_dsym is None:
- # The test was skipped altogether.
- return ""
- elif self.using_dsym:
- return "-N dwarf " + self.mydir
- else:
- return "-N dsym " + self.mydir
-
def BuildMakefile(self):
makefilePath = self.getBuildArtifact("Makefile")
if os.path.exists(makefilePath):
@@ -135,37 +123,10 @@ class InlineTest(TestBase):
makefile.flush()
makefile.close()
- @add_test_categories(["dsym"])
- def __test_with_dsym(self):
- self.using_dsym = True
- self.BuildMakefile()
- self.build()
- self.do_test()
- __test_with_dsym.debug_info = "dsym"
-
- @add_test_categories(["dwarf"])
- def __test_with_dwarf(self):
- self.using_dsym = False
+ def _test(self):
self.BuildMakefile()
self.build()
self.do_test()
- __test_with_dwarf.debug_info = "dwarf"
-
- @add_test_categories(["dwo"])
- def __test_with_dwo(self):
- self.using_dsym = False
- self.BuildMakefile()
- self.build()
- self.do_test()
- __test_with_dwo.debug_info = "dwo"
-
- @add_test_categories(["gmodules"])
- def __test_with_gmodules(self):
- self.using_dsym = False
- self.BuildMakefile()
- self.build()
- self.do_test()
- __test_with_gmodules.debug_info = "gmodules"
def execute_user_command(self, __command):
exec(__command, globals(), locals())
@@ -237,23 +198,15 @@ def MakeInlineTest(__file, __globals, decorators=None):
InlineTest.mydir = TestBase.compute_mydir(__file)
test_name, _ = os.path.splitext(file_basename)
+
+ test_func = ApplyDecoratorsToFunction(InlineTest._test, decorators)
# Build the test case
- test = type(test_name, (InlineTest,), {'using_dsym': None})
- 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)
- test.test_with_dwo = ApplyDecoratorsToFunction(
- test._InlineTest__test_with_dwo, decorators)
- test.test_with_gmodules = ApplyDecoratorsToFunction(
- test._InlineTest__test_with_gmodules, decorators)
+ test_class = type(test_name, (InlineTest,), dict(test=test_func, name=test_name))
# Add the test case to the globals, and hide InlineTest
- __globals.update({test_name: test})
+ __globals.update({test_name: test_class})
# Keep track of the original test filename so we report it
# correctly in test results.
- test.test_filename = __file
- return test
+ test_class.test_filename = __file
+ return test_class
OpenPOWER on IntegriCloud