[Lldb-commits] [PATCH] D134344: [WIP][lldb][test] 1 - Remove gmodules debug_info variant: add decorator for API tests that explicitly test gmodules

Michael Buch via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 21 02:59:09 PDT 2022


Michael137 created this revision.
Michael137 added reviewers: labath, aprantl.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Currently, by default LLDB runs an API test with 3 variants,
one of which, depending on platform, is `gmodules`. However,
most tests don't actually make use of any specific `gmodules`
feature since they compile a single `main.cpp` file without
imporint types from other modules.

Instead of running all tests an extra time with `-gmodules`
enabled, we plan to test `gmodules` features with dedicated
API tests that explicitly opt-into compiling with `-gmodules`.
One of the main benefits of this will be a reduction in total
API test-suite run-time (by around 1/3).

This patch adds the `@gmodules_test` decorator which test cases
will be decorated with to specify that we're running a `gmodules`
test. The decorator serves following purposes:

1. Will skip the test on unsupported platforms
2. Add a single debug-info variant to the test-category such that we don't run a `gmodules` test multiple times

To enable compilation with `-gmodules`, the `MAKE_GMODULES`
flag will be needed in the test's `Makefile`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134344

Files:
  lldb/packages/Python/lldbsuite/test/decorators.py


Index: lldb/packages/Python/lldbsuite/test/decorators.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/decorators.py
+++ lldb/packages/Python/lldbsuite/test/decorators.py
@@ -21,10 +21,10 @@
 from . import test_categories
 from . import lldbtest_config
 from lldbsuite.support import funcutils
+from lldbsuite.support import gmodules
 from lldbsuite.test import lldbplatform
 from lldbsuite.test import lldbplatformutil
 
-
 class DecorateMode:
     Skip, Xfail = range(2)
 
@@ -390,6 +390,25 @@
 
     return skipTestIfFn(should_skip_simulator_test)
 
+def gmodules_test(func):
+    """
+    Use this decorator for 'gmodules'-specific tests. This decorator
+    makes sure we skip the test if 'gmodules' is unsupported on the
+    host platforma and adds a single debug_info category to the test
+    so we don't run it multiple times for each debug_info variant.
+    """
+    def should_skip_gmodules_test(self):
+        supported_platforms = ["darwin", "macosx", "ios", "watchos", "tvos", "bridgeos"]
+        platform = lldbplatformutil.getHostPlatform()
+        compiler_path = self.getCompiler()
+        if platform not in supported_platforms:
+            return "Tests not supported on " % lldbplatformutil.getHostPlatform()
+        elif not gmodules.is_compiler_clang_with_gmodules(compiler_path):
+            return "-gmodules option is not supported on " % compiler_path
+        else:
+            return None
+
+    return skipTestIfFn(should_skip_gmodules_test)(add_test_categories(["dwarf"])(func))
 
 def debugserver_test(func):
     """Decorate the item as a debugserver test."""


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134344.461832.patch
Type: text/x-patch
Size: 1665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220921/c6881fd4/attachment.bin>


More information about the lldb-commits mailing list