[lldb/test] Replace ad-hoc server test choice with test categories

This makes things consistent, and enables further simplifications down
the road.

GitOrigin-RevId: db8420825073371ddc077b020634e71e315e38a1
diff --git a/packages/Python/lldbsuite/test/decorators.py b/packages/Python/lldbsuite/test/decorators.py
index bcf665f..ff445fa 100644
--- a/packages/Python/lldbsuite/test/decorators.py
+++ b/packages/Python/lldbsuite/test/decorators.py
@@ -373,20 +373,12 @@
 
 def debugserver_test(func):
     """Decorate the item as a debugserver test."""
-    def should_skip_debugserver_test():
-        return ("debugserver tests"
-                if not configuration.debugserver_platform
-                else None)
-    return skipTestIfFn(should_skip_debugserver_test)(func)
+    return add_test_categories(["debugserver"])(func)
 
 
 def llgs_test(func):
     """Decorate the item as a lldb-server test."""
-    def should_skip_llgs_tests():
-        return ("llgs tests"
-                if not configuration.llgs_platform
-                else None)
-    return skipTestIfFn(should_skip_llgs_tests)(func)
+    return add_test_categories(["llgs"])(func)
 
 
 def expectedFailureOS(
diff --git a/packages/Python/lldbsuite/test/dotest.py b/packages/Python/lldbsuite/test/dotest.py
index 64a1978..86ea34e 100644
--- a/packages/Python/lldbsuite/test/dotest.py
+++ b/packages/Python/lldbsuite/test/dotest.py
@@ -850,6 +850,14 @@
     if skipped:
         print("Skipping following debug info categories:", skipped)
 
+def checkDebugServerSupport():
+    from lldbsuite.test import lldbplatformutil
+
+    if lldbplatformutil.platformIsDarwin():
+        configuration.skip_categories.append("llgs")
+    else:
+        configuration.skip_categories.append("debugserver")
+
 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.
@@ -944,15 +952,9 @@
     checkLibstdcxxSupport()
     checkWatchpointSupport()
     checkDebugInfoSupport()
+    checkDebugServerSupport()
     checkObjcSupport()
 
-    # Perform LLGS tests only on platforms using it.
-    configuration.llgs_platform = (
-        target_platform in ["freebsd", "linux", "netbsd", "windows"])
-
-    # Perform debugserver tests elsewhere (i.e. on Darwin platforms).
-    configuration.debugserver_platform = not configuration.llgs_platform
-
     for testdir in configuration.testdirs:
         for (dirpath, dirnames, filenames) in os.walk(testdir):
             visit('Test', dirpath, filenames)
diff --git a/packages/Python/lldbsuite/test/test_categories.py b/packages/Python/lldbsuite/test/test_categories.py
index 699fcf4..9f1196e 100644
--- a/packages/Python/lldbsuite/test/test_categories.py
+++ b/packages/Python/lldbsuite/test/test_categories.py
@@ -23,6 +23,7 @@
     'cmdline': 'Tests related to the LLDB command-line interface',
     'darwin-log': 'Darwin log tests',
     'dataformatters': 'Tests related to the type command and the data formatters subsystem',
+    'debugserver': 'Debugserver tests',
     'dsym': 'Tests that can be run with DSYM debug information',
     'dwarf': 'Tests that can be run with DWARF debug information',
     'dwo': 'Tests that can be run with DWO debug information',
@@ -35,6 +36,7 @@
     'libstdcxx': 'Test for libstdcxx data formatters',
     'lldb-server': 'Tests related to lldb-server',
     'lldb-vscode': 'Visual Studio Code debug adaptor tests',
+    'llgs': 'Tests for the gdb-server functionality of lldb-server',
     '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',