Author: Pavel Labath Date: 2020-05-29T11:36:11+02:00 New Revision: 2c22c1473569352efa9326aa165cc451d39da015
URL: https://github.com/llvm/llvm-project/commit/2c22c1473569352efa9326aa165cc451d39da015 DIFF: https://github.com/llvm/llvm-project/commit/2c22c1473569352efa9326aa165cc451d39da015.diff LOG: [lldb] Make "inline" tests more configurable Summary: This patch adds two new arguments to the MakeInlineTest function. The main motivation is a follow-up patch I'm preparing, but they seem generally useful. The first argument allows the user to specify the "build dictionary". With this argument one can avoid the need to provide a custom Makefile if all he needs is to override a couple of make variables. This hooks in neatly into the existing dictionary support for non-inline tests. The second argument specifies the name of the test. This could be used to provide better names to the generated test classes, but it's mainly useful in conjuction with the first argument: now that we can specify a custom build dictionary, it may sometimes make sense to run the same test twice with different build configurations. To achieve that, we need to give the two tests different names, and this argument achieves that. The usage of the arguments is demonstrated via TestBasicEntryValues.py. Reviewers: vsk, JDevlieghere Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D80518 Added: Modified: lldb/packages/Python/lldbsuite/test/lldbinline.py lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py Removed: lldb/test/API/functionalities/param_entry_vals/basic_entry_values/Makefile ################################################################################ diff --git a/lldb/packages/Python/lldbsuite/test/lldbinline.py b/lldb/packages/Python/lldbsuite/test/lldbinline.py index 5ef7aaac42f7..71143ce3f16a 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbinline.py +++ b/lldb/packages/Python/lldbsuite/test/lldbinline.py @@ -120,7 +120,7 @@ def BuildMakefile(self): def _test(self): self.BuildMakefile() - self.build() + self.build(dictionary=self._build_dict) self.do_test() def execute_user_command(self, __command): @@ -190,24 +190,26 @@ def ApplyDecoratorsToFunction(func, decorators): return tmp -def MakeInlineTest(__file, __globals, decorators=None): +def MakeInlineTest(__file, __globals, decorators=None, name=None, + build_dict=None): # Adjust the filename if it ends in .pyc. We want filenames to # reflect the source python file, not the compiled variant. if __file is not None and __file.endswith(".pyc"): # Strip the trailing "c" __file = __file[0:-1] - # Derive the test name from the current file name - file_basename = os.path.basename(__file) - - test_name, _ = os.path.splitext(file_basename) + if name is None: + # Derive the test name from the current file name + file_basename = os.path.basename(__file) + name, _ = os.path.splitext(file_basename) test_func = ApplyDecoratorsToFunction(InlineTest._test, decorators) # Build the test case - test_class = type(test_name, (InlineTest,), dict(test=test_func, name=test_name)) + test_class = type(name, (InlineTest,), dict(test=test_func, + name=name, _build_dict=build_dict)) # Add the test case to the globals, and hide InlineTest - __globals.update({test_name: test_class}) + __globals.update({name: test_class}) # Keep track of the original test filename so we report it # correctly in test results. diff --git a/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/Makefile b/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/Makefile deleted file mode 100644 index ab505a684126..000000000000 --- a/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -CXX_SOURCES := main.cpp -CXXFLAGS_EXTRAS := -O2 -glldb -include Makefile.rules diff --git a/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py b/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py index 94689d14f990..0d6c5e32948e 100644 --- a/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py +++ b/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py @@ -3,9 +3,11 @@ from lldbsuite.test import lldbplatformutil supported_archs = ["x86_64", "aarch64"] - -lldbinline.MakeInlineTest(__file__, globals(), - [skipIf(archs=no_match(supported_archs)), +decorators = [skipIf(archs=no_match(supported_archs)), skipIf(compiler="clang", compiler_version=['<', '10.0']), skipUnlessHasCallSiteInfo, - skipIf(dwarf_version=['<', '4'])]) + skipIf(dwarf_version=['<', '4'])] + +lldbinline.MakeInlineTest(__file__, globals(), decorators=decorators, + name="BasicEntryValues_V5", + build_dict=dict(CXXFLAGS_EXTRAS="-O2 -glldb")) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits