aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/decorators.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/dotest.py13
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbpexpect.py2
-rw-r--r--lldb/packages/Python/lldbsuite/test/test_categories.py1
-rw-r--r--lldb/packages/Python/lldbsuite/test/test_result.py6
5 files changed, 19 insertions, 7 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index b691f82..8e13aa6 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -409,10 +409,6 @@ def add_test_categories(cat):
cat = test_categories.validate(cat, True)
def impl(func):
- if isinstance(func, type) and issubclass(func, unittest.TestCase):
- raise Exception(
- "@add_test_categories can only be used to decorate a test method"
- )
try:
if hasattr(func, "categories"):
cat.extend(func.categories)
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 291d7ba..8c29145 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -914,6 +914,18 @@ def checkForkVForkSupport():
configuration.skip_categories.append("fork")
+def checkPexpectSupport():
+ from lldbsuite.test import lldbplatformutil
+
+ platform = lldbplatformutil.getPlatform()
+
+ # llvm.org/pr22274: need a pexpect replacement for windows
+ if platform in ["windows"]:
+ if configuration.verbose:
+ print("pexpect tests will be skipped because of unsupported platform")
+ configuration.skip_categories.append("pexpect")
+
+
def run_suite():
# On MacOS X, check to make sure that domain for com.apple.DebugSymbols defaults
# does not exist before proceeding to running the test suite.
@@ -1013,6 +1025,7 @@ def run_suite():
checkDebugServerSupport()
checkObjcSupport()
checkForkVForkSupport()
+ checkPexpectSupport()
skipped_categories_list = ", ".join(configuration.skip_categories)
print(
diff --git a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
index 9d216d9..998a080 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
@@ -10,7 +10,7 @@ from lldbsuite.test.decorators import *
@skipIfRemote
-@skipIfWindows # llvm.org/pr22274: need a pexpect replacement for windows
+@add_test_categories(["pexpect"])
class PExpectTest(TestBase):
NO_DEBUG_INFO_TESTCASE = True
PROMPT = "(lldb) "
diff --git a/lldb/packages/Python/lldbsuite/test/test_categories.py b/lldb/packages/Python/lldbsuite/test/test_categories.py
index 3f8de17..036bda9 100644
--- a/lldb/packages/Python/lldbsuite/test/test_categories.py
+++ b/lldb/packages/Python/lldbsuite/test/test_categories.py
@@ -33,6 +33,7 @@ all_categories = {
"lldb-server": "Tests related to lldb-server",
"lldb-dap": "Tests for the Debug Adaptor Protocol with lldb-dap",
"llgs": "Tests for the gdb-server functionality of lldb-server",
+ "pexpect": "Tests requiring the pexpect library to be available",
"objc": "Tests related to the Objective-C programming language support",
"pyapi": "Tests related to the Python API",
"std-module": "Tests related to importing the std module",
diff --git a/lldb/packages/Python/lldbsuite/test/test_result.py b/lldb/packages/Python/lldbsuite/test/test_result.py
index 20365f5..2d574b3 100644
--- a/lldb/packages/Python/lldbsuite/test/test_result.py
+++ b/lldb/packages/Python/lldbsuite/test/test_result.py
@@ -148,9 +148,11 @@ class LLDBTestResult(unittest.TextTestResult):
Gets all the categories for the currently running test method in test case
"""
test_categories = []
+ test_categories.extend(getattr(test, "categories", []))
+
test_method = getattr(test, test._testMethodName)
- if test_method is not None and hasattr(test_method, "categories"):
- test_categories.extend(test_method.categories)
+ if test_method is not None:
+ test_categories.extend(getattr(test_method, "categories", []))
test_categories.extend(self._getFileBasedCategories(test))