This revision was automatically updated to reflect the committed changes.
Closed by commit rG6335deb68b1d: [lldb/test] Use SBPlatform info for 
lldbplatformutil.getPlatform() (authored by labath).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138430/new/

https://reviews.llvm.org/D138430

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/lldbplatformutil.py

Index: lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -98,21 +98,23 @@
     return dictionary
 
 
+def _get_platform_os(p):
+    # Use the triple to determine the platform if set.
+    triple = p.GetTriple()
+    if triple:
+        platform = triple.split('-')[2]
+        if platform.startswith('freebsd'):
+            platform = 'freebsd'
+        elif platform.startswith('netbsd'):
+            platform = 'netbsd'
+        return platform
+
+    return ''
+
+
 def getHostPlatform():
     """Returns the host platform running the test suite."""
-    # Attempts to return a platform name matching a target Triple platform.
-    if sys.platform.startswith('linux'):
-        return 'linux'
-    elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'):
-        return 'windows'
-    elif sys.platform.startswith('darwin'):
-        return 'macosx'
-    elif sys.platform.startswith('freebsd'):
-        return 'freebsd'
-    elif sys.platform.startswith('netbsd'):
-        return 'netbsd'
-    else:
-        return sys.platform
+    return _get_platform_os(lldb.SBPlatform("host"))
 
 
 def getDarwinOSTriples():
@@ -130,16 +132,7 @@
             platform = 'ios'
         return platform
 
-    platform = configuration.lldb_platform_name
-    if platform is None:
-        platform = "host"
-    if platform == "qemu-user":
-        platform = "host"
-    if platform == "host":
-        return getHostPlatform()
-    if platform.startswith("remote-"):
-        return platform[7:]
-    return platform
+    return _get_platform_os(lldb.selected_platform)
 
 
 def platformIsDarwin():
Index: lldb/packages/Python/lldbsuite/test/dotest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -849,14 +849,14 @@
     skip_msg = "Skipping %s tests, as they are not compatible with remote testing on this platform"
     if lldbplatformutil.platformIsDarwin():
         configuration.skip_categories.append("llgs")
-        if configuration.lldb_platform_name:
+        if lldb.remote_platform:
             # <rdar://problem/34539270>
             configuration.skip_categories.append("debugserver")
             if configuration.verbose:
                 print(skip_msg%"debugserver");
     else:
         configuration.skip_categories.append("debugserver")
-        if configuration.lldb_platform_name and lldbplatformutil.getPlatform() == "windows":
+        if lldb.remote_platform and lldbplatformutil.getPlatform() == "windows":
             configuration.skip_categories.append("llgs")
             if configuration.verbose:
                 print(skip_msg%"lldb-server");
@@ -891,14 +891,6 @@
     lldb.SBDebugger.Initialize()
     lldb.SBDebugger.PrintStackTraceOnError()
 
-    checkLibcxxSupport()
-    checkLibstdcxxSupport()
-    checkWatchpointSupport()
-    checkDebugInfoSupport()
-    checkDebugServerSupport()
-    checkObjcSupport()
-    checkForkVForkSupport()
-
     # Use host platform by default.
     lldb.remote_platform = None
     lldb.selected_platform = lldb.SBPlatform.GetHostPlatform()
@@ -957,8 +949,16 @@
     # Note that it's not dotest's job to clean this directory.
     lldbutil.mkdir_p(configuration.test_build_dir)
 
+    checkLibcxxSupport()
+    checkLibstdcxxSupport()
+    checkWatchpointSupport()
+    checkDebugInfoSupport()
+    checkDebugServerSupport()
+    checkObjcSupport()
+    checkForkVForkSupport()
+
     skipped_categories_list = ", ".join(configuration.skip_categories)
-    print("Skipping the following test categories: {}".format(skipped_categories_list))
+    print("Skipping the following test categories: {}".format(configuration.skip_categories))
 
     for testdir in configuration.testdirs:
         for (dirpath, dirnames, filenames) in os.walk(testdir):
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to