Skip to content

[lldb] Adding a new decorator for CMAKE_BUILD_TYPE. #141159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025
Merged

Conversation

ashgti
Copy link
Contributor

@ashgti ashgti commented May 22, 2025

In lldb-dap, we have existing tests that are known to be unstable when lldb and lldb-dap are built in the Debug configuration.

This decorator lets us skip those tests in CI jobs that are to slow with those configurations.

This was split out from #140777 to make the patches smaller.

In lldb-dap, we have existing tests that are known to be unstable when lldb and lldb-dap are built in the Debug configuration.

This decorator lets us skip those tests in CI jobs that are to slow with those configurations.
@llvmbot
Copy link
Member

llvmbot commented May 22, 2025

@llvm/pr-subscribers-lldb

Author: John Harrison (ashgti)

Changes

In lldb-dap, we have existing tests that are known to be unstable when lldb and lldb-dap are built in the Debug configuration.

This decorator lets us skip those tests in CI jobs that are to slow with those configurations.

This was split out from #140777 to make the patches smaller.


Full diff: https://github.com/llvm/llvm-project/pull/141159.diff

6 Files Affected:

  • (modified) lldb/packages/Python/lldbsuite/test/configuration.py (+3)
  • (modified) lldb/packages/Python/lldbsuite/test/decorators.py (+12)
  • (modified) lldb/packages/Python/lldbsuite/test/dotest.py (+1)
  • (modified) lldb/packages/Python/lldbsuite/test/dotest_args.py (+6)
  • (modified) lldb/test/API/lit.cfg.py (+3)
  • (modified) lldb/test/API/lit.site.cfg.py.in (+1)
diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py
index 18c1566176331..b2d91fd211477 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/lldb/packages/Python/lldbsuite/test/configuration.py
@@ -137,6 +137,9 @@
 # A plugin whose tests will be enabled, like intel-pt.
 enabled_plugins = []
 
+# the build type of lldb
+# Typical values include Debug, Release, RelWithDebInfo and MinSizeRel
+cmake_build_type = None
 
 def shouldSkipBecauseOfCategories(test_categories):
     if use_categories:
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index 895f2a82547a9..868e9f7e5eca0 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -1102,3 +1102,15 @@ def is_feature_enabled():
                 return "%s is not supported on this system." % feature
 
     return skipTestIfFn(is_feature_enabled)
+
+
+def skipIfBuildType(types: list[str]):
+    """Skip tests if built in a specific CMAKE_BUILD_TYPE.
+
+    Supported types include 'Release', 'RelWithDebInfo', 'Debug', 'MinSizeRel'.
+    """
+    types = [name.lower() for name in types]
+    return unittest.skipIf(
+        configuration.cmake_build_type.lower() in types,
+        "skip on {} build type(s)".format(", ".join(types)),
+    )
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 7cc8f2985043e..d7f274ac4f60e 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -297,6 +297,7 @@ def parseOptionsAndInitTestdirs():
     configuration.libcxx_include_dir = args.libcxx_include_dir
     configuration.libcxx_include_target_dir = args.libcxx_include_target_dir
     configuration.libcxx_library_dir = args.libcxx_library_dir
+    configuration.cmake_build_type = args.cmake_build_type.lower()
 
     if args.channels:
         lldbtest_config.channels = args.channels
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index 98210b7102e1b..e9c21388bc213 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -300,6 +300,12 @@ def create_parser():
         metavar="platform-available-ports",
         help="Ports available for connection to a lldb server on the remote platform",
     )
+    group.add_argument(
+        "--cmake-build-type",
+        dest="cmake_build_type",
+        metavar="cmake-build-type",
+        help="Specifies the build type on single-configuration",
+    )
 
     # Test-suite behaviour
     group = parser.add_argument_group("Runtime behaviour options")
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 08cf11c8a68db..646a446c86fdb 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -271,6 +271,9 @@ def delete_module_cache(path):
 if is_configured("lldb_framework_dir"):
     dotest_cmd += ["--framework", config.lldb_framework_dir]
 
+if is_configured("cmake_build_type"):
+    dotest_cmd += ["--cmake-build-type", config.cmake_build_type]
+
 if "lldb-simulator-ios" in config.available_features:
     dotest_cmd += ["--apple-sdk", "iphonesimulator", "--platform-name", "ios-simulator"]
 elif "lldb-simulator-watchos" in config.available_features:
diff --git a/lldb/test/API/lit.site.cfg.py.in b/lldb/test/API/lit.site.cfg.py.in
index 54807de8819d2..8552d17d66631 100644
--- a/lldb/test/API/lit.site.cfg.py.in
+++ b/lldb/test/API/lit.site.cfg.py.in
@@ -27,6 +27,7 @@ config.dotest_common_args_str = lit_config.substitute("@LLDB_TEST_COMMON_ARGS@")
 config.dotest_user_args_str = lit_config.substitute("@LLDB_TEST_USER_ARGS@")
 config.lldb_platform_url = lit_config.substitute("@LLDB_TEST_PLATFORM_URL@")
 config.lldb_platform_working_dir = lit_config.substitute("@LLDB_TEST_PLATFORM_WORKING_DIR@")
+config.cmake_build_type = "@CMAKE_BUILD_TYPE@"
 config.cmake_sysroot = lit_config.substitute("@LLDB_TEST_SYSROOT@" or "@DEFAULT_SYSROOT@")
 config.lldb_enable_python = @LLDB_ENABLE_PYTHON@
 config.dotest_lit_args_str = None

@ashgti ashgti merged commit 7dc7c15 into llvm:main May 23, 2025
12 checks passed
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
In lldb-dap, we have existing tests that are known to be unstable when
lldb and lldb-dap are built in the Debug configuration.

This decorator lets us skip those tests in CI jobs that are to slow with
those configurations.

This was split out from llvm#140777 to make the patches smaller.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants